@deephaven/embed-grid 0.37.4-relative-links.2 → 0.37.4-relative-base.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- var gn=Object.defineProperty;var vn=(s,t,e)=>t in s?gn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var T=(s,t,e)=>(vn(s,typeof t!="symbol"?t+"":t,e),e);import{E as bn,r as l,p as g,e as ve,a as L,m as Cn,j as a,c as O,F as z,C as be,l as Pe,$ as xn,s as ye,J as te,L as En,R as Tn,N as yn,O as Nn,Q as vt,T as kn,U as In}from"./vendor-80145ba5.js";import{L as A,ab as wn,ac as Sn,V as Be,Z as He,W as bt,f as On,U as Ct,I as jn,o as Mn,T as Z,y as Rn,ad as An,S as Pn,aa as ne,a as xt,ae as Ln,af as Dn}from"./index-bb4ab651.js";import{A as We,B as H,_ as Et,$ as _n,a0 as Fn,u as Un,y as oe,a1 as Ge,a2 as Tt,H as yt,a3 as $n,x as Ke,a4 as at,w as Le,v as De,a as Vn,L as Bn,e as Hn,k as Wn,a5 as Gn,Y as Kn,l as qn,N as zn,o as Yn,p as Zn,G as Jn,a6 as Qn,K as Xn,M as es,J as ts,a7 as ns,r as ss,V as is,R as os,t as as,q as rs,m as Nt,a8 as ls,S as cs,U as us,f as ds,a9 as hs,aa as ps,ab as fs,ac as kt,ad as ms,ae as Ne,af as ce,ag as gs,ah as vs,ai as bs,i as Cs,D as xs,j as Es,aj as Ts,ak as ys,Q as It,F as _e,I as Ns,al as ks,h as Is,b as ws,Z as Ss,am as Os,an as js,ao as Ms,P as rt,ap as Rs,C as As,aq as Ps}from"./useConnection-dc17671e.js";import{ar as qo,X as zo}from"./useConnection-dc17671e.js";import"./helpers-042e6b4d.js";import"./monaco-0851b9b6.js";var _=(s=>(s.DEBUG="D",s.LOG="L",s.WARN="W",s.ERROR="E",s.UNCAUGHT_ERROR="U",s))(_||{});function ie(s,t){return new CustomEvent(s,{detail:t})}class Ls{constructor(){T(this,"isEnabled",!1);T(this,"debug");T(this,"log");T(this,"warn");T(this,"error");T(this,"eventTarget");T(this,"handleUncaughtError",t=>{const e=[];t.error!=null&&e.push(t.error),t.message&&e.push(t.message),this.eventTarget.dispatchEvent(ie("U",e))});this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new bn}enable(){this.isEnabled||(console.debug=(...t)=>{this.eventTarget.dispatchEvent(ie("D",t)),this.debug.apply(console,t)},console.log=(...t)=>{this.eventTarget.dispatchEvent(ie("L",t)),this.log.apply(console,t)},console.warn=(...t)=>{this.eventTarget.dispatchEvent(ie("W",t)),this.warn.apply(console,t)},console.error=(...t)=>{this.eventTarget.dispatchEvent(ie("E",t)),this.error.apply(console,t)},window.addEventListener("error",this.handleUncaughtError),A.setLogLevel(A.level),this.isEnabled=!0)}disable(){this.isEnabled&&(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),A.setLogLevel(A.level),this.isEnabled=!1)}addEventListener(t,e){this.eventTarget.addEventListener(t,e)}removeEventListener(t,e){this.eventTarget.removeEventListener(t,e)}}const Ds=Ls;class Ce{constructor(t){T(this,"history");T(this,"offset");T(this,"limit");T(this,"isEnabled");T(this,"proxy");this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=t,this.addHistory=this.addHistory.bind(this)}static formatMessages(t){return t.map(n=>{if(typeof n=="string")return n;let o="";try{o=JSON.stringify(n)}catch{o=n.toString()}return o==="{}"?n.toString():o}).join(" ")}static formatStack(t,e){if(t==="")return"";let n=t.split(`
1
+ var gn=Object.defineProperty;var vn=(s,t,e)=>t in s?gn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var T=(s,t,e)=>(vn(s,typeof t!="symbol"?t+"":t,e),e);import{E as bn,r as l,p as g,e as ve,a as L,m as Cn,j as a,c as O,F as z,C as be,l as Pe,$ as xn,s as ye,J as te,L as En,R as Tn,N as yn,O as Nn,Q as vt,T as kn,U as In}from"./vendor-80145ba5.js";import{L as A,ab as wn,ac as Sn,V as Be,Z as He,W as bt,f as On,U as Ct,I as jn,o as Mn,T as Z,y as Rn,ad as An,S as Pn,aa as ne,a as xt,ae as Ln,af as Dn}from"./index-04b032d1.js";import{A as We,B as H,_ as Et,$ as _n,a0 as Fn,u as Un,y as oe,a1 as Ge,a2 as Tt,H as yt,a3 as $n,x as Ke,a4 as at,w as Le,v as De,a as Vn,L as Bn,e as Hn,k as Wn,a5 as Gn,Y as Kn,l as qn,N as zn,o as Yn,p as Zn,G as Jn,a6 as Qn,K as Xn,M as es,J as ts,a7 as ns,r as ss,V as is,R as os,t as as,q as rs,m as Nt,a8 as ls,S as cs,U as us,f as ds,a9 as hs,aa as ps,ab as fs,ac as kt,ad as ms,ae as Ne,af as ce,ag as gs,ah as vs,ai as bs,i as Cs,D as xs,j as Es,aj as Ts,ak as ys,Q as It,F as _e,I as Ns,al as ks,h as Is,b as ws,Z as Ss,am as Os,an as js,ao as Ms,P as rt,ap as Rs,C as As,aq as Ps}from"./useConnection-a2bb8445.js";import{ar as qo,X as zo}from"./useConnection-a2bb8445.js";import"./helpers-042e6b4d.js";import"./monaco-0851b9b6.js";var _=(s=>(s.DEBUG="D",s.LOG="L",s.WARN="W",s.ERROR="E",s.UNCAUGHT_ERROR="U",s))(_||{});function ie(s,t){return new CustomEvent(s,{detail:t})}class Ls{constructor(){T(this,"isEnabled",!1);T(this,"debug");T(this,"log");T(this,"warn");T(this,"error");T(this,"eventTarget");T(this,"handleUncaughtError",t=>{const e=[];t.error!=null&&e.push(t.error),t.message&&e.push(t.message),this.eventTarget.dispatchEvent(ie("U",e))});this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new bn}enable(){this.isEnabled||(console.debug=(...t)=>{this.eventTarget.dispatchEvent(ie("D",t)),this.debug.apply(console,t)},console.log=(...t)=>{this.eventTarget.dispatchEvent(ie("L",t)),this.log.apply(console,t)},console.warn=(...t)=>{this.eventTarget.dispatchEvent(ie("W",t)),this.warn.apply(console,t)},console.error=(...t)=>{this.eventTarget.dispatchEvent(ie("E",t)),this.error.apply(console,t)},window.addEventListener("error",this.handleUncaughtError),A.setLogLevel(A.level),this.isEnabled=!0)}disable(){this.isEnabled&&(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),A.setLogLevel(A.level),this.isEnabled=!1)}addEventListener(t,e){this.eventTarget.addEventListener(t,e)}removeEventListener(t,e){this.eventTarget.removeEventListener(t,e)}}const Ds=Ls;class Ce{constructor(t){T(this,"history");T(this,"offset");T(this,"limit");T(this,"isEnabled");T(this,"proxy");this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=t,this.addHistory=this.addHistory.bind(this)}static formatMessages(t){return t.map(n=>{if(typeof n=="string")return n;let o="";try{o=JSON.stringify(n)}catch{o=n.toString()}return o==="{}"?n.toString():o}).join(" ")}static formatStack(t,e){if(t==="")return"";let n=t.split(`
2
2
  `).map(o=>o.trim());switch(e){case _.ERROR:n=n.splice(t[0]==="Error"?4:3);break;case _.UNCAUGHT_ERROR:n=n.splice(t[0]==="Error"?3:2);break}return n!=null?` ${n.join(`
3
3
  `)}`:""}enable(){this.isEnabled||(this.proxy.addEventListener(_.DEBUG,this.addHistory),this.proxy.addEventListener(_.LOG,this.addHistory),this.proxy.addEventListener(_.WARN,this.addHistory),this.proxy.addEventListener(_.ERROR,this.addHistory),this.proxy.addEventListener(_.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){this.isEnabled&&(this.proxy.removeEventListener(_.DEBUG,this.addHistory),this.proxy.removeEventListener(_.LOG,this.addHistory),this.proxy.removeEventListener(_.WARN,this.addHistory),this.proxy.removeEventListener(_.ERROR,this.addHistory),this.proxy.removeEventListener(_.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:t,detail:e}){const n={type:t,messages:e,time:new Date};switch(t){case _.ERROR:case _.UNCAUGHT_ERROR:n.stack=Error().stack;break}this.history[this.offset%this.limit]=n,this.offset+=1}getHistory(){if(this.offset>this.limit){const t=this.offset%this.limit;this.history=this.history.slice(t).concat(this.history.slice(0,t)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(e=>`${e.time.toISOString()} ${e.type} ${Ce.formatMessages(e.messages)}`+(e.stack!=null?`
4
4
  ${Ce.formatStack(e.stack,e.type)}`:"")).join(`
5
5
  `)}}const _s=Ce,Fs=Object.freeze(Object.defineProperty({__proto__:null,Log:A,LogHistory:_s,LogProxy:Ds,Logger:wn,LoggerLevel:Sn,default:A},Symbol.toStringTag,{value:"Module"}));const Us=100;var wt=(s=>(s.UP="UP",s.DOWN="DOWN",s))(wt||{});const G=class extends l.Component{constructor(e){super(e);T(this,"popper");T(this,"cbContainer");T(this,"menuContainer");T(this,"input");T(this,"getCachedFilteredOptions",Cn((e,n)=>e.filter(o=>o.title.toLowerCase().indexOf(n.toLowerCase())>=0)));let{popperOptions:n}=this.props;n={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...n},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:n},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=ve(this.updateInputValue,Us),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=L.createRef(),this.cbContainer=L.createRef(),this.menuContainer=L.createRef(),this.input=L.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:n}=this.props,o=n.filter(i=>i.title.toLowerCase()===e.toLowerCase());return o.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:o[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:n}=this.state,{value:o,isValid:i}=this.getValueAndValidate(e);n&&this.processFilterChange(e),this.fireOnChange(o,i)}fireOnChange(e,n=!0){const{onChange:o}=this.props;o(e,n)}processFilterChange(e){var c;const{options:n}=this.props,{menuIsOpen:o}=this.state,i=e?this.getCachedFilteredOptions(n,e):n,r=i.length===1&&i[0].title===e;if(this.setState({filteredOptions:i,keyboardOptionIndex:0}),r&&o){this.closeMenu();return}(c=this.popper.current)==null||c.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var r;const{filteredOptions:n,keyboardOptionIndex:o}=this.state,i=n[o];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),i!=null&&(this.setState({title:i.title,invalid:!1}),this.fireOnChange(i.value)),this.closeMenu(),(r=this.input.current)==null||r.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(G.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(G.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(G.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(G.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:n,keyboardOptionIndex:o}=this.state;let i=o;e===G.MENU_NAVIGATION_DIRECTION.UP?o>0?(i=(i-1)%n.length,this.setState({keyboardOptionIndex:i})):o===0&&(i=n.length-1,this.setState({keyboardOptionIndex:i})):e===G.MENU_NAVIGATION_DIRECTION.DOWN&&o<n.length&&(i=(i+1)%n.length,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i)}handleInputKeyDown(e){const{onEnter:n}=this.props,{menuIsOpen:o}=this.state;o?this.handleMenuKeyDown(e):e.key==="Enter"?n():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var n;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(n=this.input.current)==null||n.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:n}=this.state;n&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)==null||e.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var n;(n=this.popper.current)==null||n.show()})}closeMenu(e=!0){var n,o;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((n=this.input.current)==null||n.focus()),(o=this.popper.current)==null||o.hide()}scrollOptionIntoView(e){var n;this.menuContainer.current&&((n=this.menuContainer.current.children.item(e))==null||n.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return a.jsx("div",{className:O("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:n,filteredOptions:o}=this.state;return n&&o.length===0?a.jsx("div",{className:"no-match",children:e}):o.map((i,r)=>this.renderOption(i,r))}renderOption(e,n){const{keyboardOptionIndex:o}=this.state,i=`option-${n}-${e.value}`;return a.jsx("button",{type:"button",className:O("aci-option-btn",{"keyboard-active":o===n}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:n}),children:e.title},i)}render(){const{options:e,inputPlaceholder:n,disabled:o,className:i,defaultTitle:r,spellCheck:c,"data-testid":u}=this.props,{title:d,menuIsOpen:h,popperOptions:p,invalid:m}=this.state;return a.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[a.jsx("input",{value:d||r,className:O("form-control",i,"aci-input",{"is-invalid":m&&!h}),ref:this.input,onChange:this.handleInputChange,placeholder:n||e[0].title,disabled:o,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:c,"data-testid":u}),a.jsx(We,{ref:this.popper,options:p,className:O("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let J=G;T(J,"propTypes",{options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({}),onChange:g.func,inputPlaceholder:g.string,disabled:g.bool,className:g.string,defaultTitle:g.string,spellCheck:g.bool,onEnter:g.func,noMatchText:g.string,"data-testid":g.string}),T(J,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0}),T(J,"MENU_NAVIGATION_DIRECTION",wt);const $s=J;function qe({className:s="",value:t,onChange:e,spellCheck:n=!1,placeholder:o="",disabled:i=!1,delimiter:r="",id:c="","data-testid":u}){const[d,h]=l.useState(t),[p,m]=l.useState(!1),f=l.useRef(null);l.useEffect(function(){h(t)},[t]);function C(E){return E.trim().split(r).filter(x=>x).join(`
6
6
  ${r.trim()}`)}function b(E){return E.split(`
7
7
  `).map(x=>x.trim()).join(" ")}function w(){if(!f.current)return;f.current.style.height="0";const E=f.current.scrollHeight+(f.current.offsetHeight-f.current.clientHeight);E>0&&(f.current.style.height=`${E}px`)}function j(E){let x=E.target.value;p&&(r&&(x=C(x)),m(!1)),h(x),e(x)}function P(){f.current&&(r&&(h(C(d)),w()),f.current.scrollLeft=0)}function v(){f.current&&document.activeElement!==f.current&&f.current.focus()}function y(){r&&(h(b(d)),e(b(d)))}function N(){m(!0)}return l.useEffect(function(){w()},[d]),a.jsx("textarea",{ref:f,id:c,className:O(s,"auto-resize-textarea form-control"),placeholder:o,value:d,rows:1,onChange:j,onFocus:P,onMouseDown:v,onBlur:y,onPaste:N,spellCheck:n,disabled:i,"data-testid":u})}qe.propTypes={value:g.string.isRequired,onChange:g.func.isRequired,className:g.string,placeholder:g.string,spellCheck:g.bool,disabled:g.bool,delimiter:g.string,id:g.string,"data-testid":g.string};qe.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function ue(s){const{children:t,className:e,style:n,"data-testid":o}=s;return a.jsx("div",{className:O("btn-group",e),style:n,role:"group","data-testid":o,children:t})}ue.displayName="ButtonGroup";ue.propTypes={children:g.node.isRequired,className:g.string,style:g.object,"data-testid":g.string};ue.defaultProps={className:null,style:{},"data-testid":void 0};function Vs({className:s,icon:t,isOpen:e,subtitle:n,title:o}){return a.jsx(Be,{isOpen:e,className:s,children:a.jsx(He,{children:a.jsxs("div",{className:"info-modal",children:[t!=null&&a.jsx("div",{className:"message-icon",children:a.jsx(z,{icon:t})}),a.jsx("div",{className:"message-header",children:o}),n!=null&&a.jsx("div",{className:"message-content",children:n})]})})})}function St({className:s="modal-footer",children:t,"data-testid":e}){return a.jsx("div",{className:s,"data-testid":e,children:t})}function ze(s){const{isOpen:t,headerText:e,bodyText:n,onCancel:o,onConfirm:i,onDiscard:r,onModalDisable:c,cancelButtonText:u="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:p=!1,children:m,"data-testid":f}=s,C=l.useRef(null),b=l.useRef(null),w=l.useCallback(()=>{b.current!==null&&b.current.checked&&c&&c(),i()},[i,c]),j=l.useCallback(()=>{var v;(v=C.current)==null||v.focus()},[]);let P="";return t&&(P=typeof n=="function"?n():n),a.jsxs(Be,{isOpen:t,className:"theme-bg-light",onOpened:j,children:[a.jsx(bt,{closeButton:!1,children:e}),a.jsx(He,{children:P}),a.jsxs(St,{children:[c&&a.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[a.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:b,"data-testid":f!==void 0?`${f}-checkbox-confirm`:void 0}),a.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),r&&a.jsx(H,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:r,"data-testid":f!==void 0?`${f}-btn-discard`:void 0,children:h}),o&&a.jsx(H,{kind:"secondary","data-dismiss":"modal",onClick:o,"data-testid":f!==void 0?`${f}-btn-cancel`:void 0,children:u}),a.jsxs(ue,{children:[a.jsx(H,{kind:p?"danger":"primary",onClick:w,ref:C,"data-testid":f!==void 0?`${f}-btn-confirm`:void 0,children:d}),m]})]})]})}ze.propTypes={isOpen:g.bool.isRequired,headerText:g.string.isRequired,bodyText:g.oneOfType([g.string,g.func]).isRequired,onCancel:g.func,onConfirm:g.func.isRequired,onDiscard:g.func,onModalDisable:g.func,cancelButtonText:g.string,confirmButtonText:g.string,discardButtonText:g.string,children:g.node,"data-testid":g.string};ze.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const ke=L.forwardRef((s,t)=>{const{children:e,className:n,disabled:o,onClick:i,style:r,id:c}=s;return a.jsx("button",{ref:t,type:"button",className:O("btn",n),onClick:i,style:r,disabled:o,id:c,children:e})});ke.displayName="Button";ke.propTypes={children:g.node,className:g.string,disabled:g.bool,onClick:g.func,style:g.shape({}),id:g.string};ke.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Bs=ke;function Hs({className:s,isFlipped:t,children:e,"data-testid":n}){const o=u=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[u]},i=l.useRef(null),r=l.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),c=l.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return l.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",r);const d=i.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",r)}},[r]),a.jsxs("div",{className:O(s,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":n,children:[a.jsx("div",{className:"card-flip--back",children:o(0)}),a.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:c,children:o(1)})]})}function xe(s){let t=s;s instanceof CustomEvent&&(t=s.detail);let e="";if(t instanceof Error?e=t.message:t!=null&&(e=`${t}`),e=e.trim(),e.length>0)return e}const K=class extends l.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${K.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${K.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 o=e.querySelector("input, select, textarea");o!=null&&o.focus()}}render(){const{children:t,className:e,in:n,"data-testid":o}=this.props;return a.jsx(be,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:K.handleEnter,onEntering:K.handleEntering,onEntered:this.handleEntered,onExit:K.handleExit,onExiting:K.handleExiting,timeout:350,children:i=>a.jsx("div",{className:O({collapse:i==="exited"},e),"data-testid":o,children:t})})}};let ae=K;T(ae,"propTypes",{className:g.string,in:g.bool.isRequired,children:g.node.isRequired,autoFocusOnShow:g.bool,"data-testid":g.string}),T(ae,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const Ws=ae;function Ot(s,t,{autoLoad:e=!0}={}){const[n,o]=l.useState(null),[i,r]=l.useState(null),[c,u]=l.useState(!1),d=l.useCallback(async()=>{u(!0);try{const h=await s(...t);o(h),r(null)}catch(h){o(null),r(h)}finally{u(!1)}},[s,...t]);return l.useEffect(()=>{e&&d()},[e,d]),{data:n,error:i,isError:i!=null,isLoading:c,reload:d}}const Gs=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:Et,useCopyToClipboard:_n,useForwardedRef:Fn,usePrevious:Un,usePromiseFactory:Ot},Symbol.toStringTag,{value:"Module"})),Ks=A.module("TimeInput"),qs="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",zs=["00:00:00","12:34:56","23:59:59"],jt=L.forwardRef((s,t)=>{const{allowValueWrapping:e=!0,className:n="",onChange:o=()=>!1,value:i=0,onFocus:r=()=>!1,onBlur:c=()=>!1,onSelect:u=()=>!1,"data-testid":d}=s,[h,p]=l.useState(oe.formatTime(i)),[m,f]=l.useState(),C=l.useRef(null);l.useImperativeHandle(t,()=>({focus:()=>{var v;(v=C.current)==null||v.focus()},setSelection:v=>{var y;(y=C.current)==null||y.focus(),f(v)}}),[]),l.useEffect(function(){p(oe.formatTime(i))},[i]);function b(v,y,N){const E=v.selectionStart===0?24:60;let x=parseInt(N,10)-y;return Number.isNaN(x)?x=0:e?x=(x%E+E)%E:x=Math.min(Math.max(0,x),E-1),`${x}`.padStart(2,"0")}function w(v,y,N,E,x){return E===0&&x===2&&y===1&&parseInt(N,10)>1?`0${N}${v.substring(2)}`:Tt(v,y,N)}function j(v){Ks.debug("handleChange",v),p(v),oe.isTimeString(v)&&o(oe.parseTime(v))}const P=l.useCallback(v=>{f(v),u(v)},[u]);return a.jsx(Ge,{ref:C,className:n,example:zs,getNextSegmentValue:b,getPreferredReplacementString:w,onChange:j,onSelect:P,pattern:qs,selection:m,value:h,onFocus:r,onBlur:c,"data-testid":d})});jt.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Ee=jt;const lt=-1;var Mt=(s=>(s.UP="UP",s.DOWN="DOWN",s))(Mt||{});const V=class extends l.Component{constructor(e){super(e);T(this,"csContainer");T(this,"menuContainer");T(this,"button");T(this,"input");const{value:n,valueToTime:o}=e;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=L.createRef(),this.menuContainer=L.createRef(),this.button=L.createRef(),this.input=L.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:o(n),inputFocused:!1}}getSelectedText(){const{options:e,value:n,placeholder:o}=this.props,{customTime:i}=this.state;if(n===null)return o;for(let r=0;r<e.length;r+=1){const c=e[r];if(c.value===n)return c.title}return oe.formatTime(i)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:n}=this.props;n(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var r;const{keyboardOptionIndex:n,inputFocused:o}=this.state,{options:i}=this.props;switch(e.key){case"Enter":case" ":o?this.updateFromCustom():this.updateInputValue(i[n].value),this.closeMenu(),(r=this.button.current)==null||r.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:n,inputFocused:o}=this.state,{options:i}=this.props,r=i.length;let c=n;switch(e){case V.MENU_NAVIGATION_DIRECTION.UP:if(!o&&n===0){this.focusInput();break}else o&&this.focusOption(n);n>0&&!o?(c=(c-1)%r,this.setState({keyboardOptionIndex:c})):n===0&&(c=r-1,this.setState({keyboardOptionIndex:c})),this.scrollOptionIntoView(c);break;case V.MENU_NAVIGATION_DIRECTION.DOWN:if(!o&&n===r-1){this.focusInput();break}else o&&this.focusOption(n);n<r&&!(o&&n===0)&&(c=(c+1)%r,this.setState({keyboardOptionIndex:c})),this.scrollOptionIntoView(c);break}}handleOptionClick(e){const n=Number(e.currentTarget.value),{options:o,timeToValue:i}=this.props,{customTime:r}=this.state;if(n===lt){const c=i(r);this.updateAndClose(c)}else this.updateAndClose(o[n].value)}updateAndClose(e){var n;this.updateInputValue(e),this.closeMenu(),(n=this.button.current)==null||n.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var c;const{options:e,value:n}=this.props,{keyboardOptionIndex:o}=this.state;this.scrollOptionIntoView(o);const i=(c=this.menuContainer.current)==null?void 0:c.querySelector(".cs-option-btn.keyboard-active");if(i instanceof HTMLElement&&i.focus(),n===null)return;e.map(u=>u.value).indexOf(n)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var o;const n=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-options");if(n&&n.children!=null){const i=n.children.item(e);i instanceof HTMLElement&&i.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:n}=this.props,o=n(e);this.updateInputValue(o),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:n}=this.state,o=e(n);this.updateInputValue(o)}toggleMenu(e){const{menuIsOpen:n}=this.state;n?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var n;this.setState({menuIsOpen:!1}),e&&((n=this.button.current)==null||n.focus())}updateKeyboardIndex(){const{options:e,value:n}=this.props;if(n===null)return;const o=e.map(i=>i.value).indexOf(n);o>0&&this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(e){var o;const n=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-options");if(n&&n.children!=null){const i=n.children.item(e);i instanceof HTMLElement&&i.offsetTop>V.DROP_DOWN_MENU_HEIGHT?n.scrollTop=i.offsetTop-V.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(n.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return a.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:n=>{n.stopPropagation()},style:{width:e},children:a.jsx("div",{className:"cs-options-container",children:a.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:n,icon:o,customText:i}=this.props,{keyboardOptionIndex:r,customTime:c,inputFocused:u}=this.state;let d=!1;const h=[];for(let p=0;p<e.length;p+=1){const m=e[p],f=`option-${p}-${m.value}`;d=d||m.value===n,h.push(a.jsxs("button",{type:"button",value:p,className:O("cs-option-btn",{"keyboard-active":r===p&&!u}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[m.value===n&&a.jsx(z,{icon:o,className:"mr-2"}),m.value!==n&&a.jsx("span",{className:"mr-4"}),m.title]},f))}return h.push(a.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(a.jsxs("button",{type:"button",value:lt,className:O("cs-option-btn",{"keyboard-active":u}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&n!==null?a.jsx(z,{icon:o,className:"mr-2"}):a.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),h.push(a.jsxs("div",{className:"cs-custom-container",children:[a.jsx("span",{className:"mr-2"}),a.jsx(Ee,{ref:this.input,onChange:this.handleCustomInput,value:c,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),a.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(a.jsx("hr",{className:"mb-2"},"option-end")),h}render(){const{disabled:e,invalid:n,value:o,"data-testid":i}=this.props,{menuIsOpen:r}=this.state;let{popperOptions:c}=this.props;return c={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...c},a.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:a.jsx("div",{className:O("input-group-append cs-dropdown",{"cs-dropdown-invalid":n}),children:a.jsxs("button",{type:"button",className:O("btn cs-btn form-control",{"cs-btn-invalid":n}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[a.jsx("span",{className:O({"text-muted":o===null}),children:this.getSelectedText()}),a.jsx("span",{children:a.jsx(z,{icon:Ct,className:"cs-caret"})}),a.jsx(yt,{isShown:r,actions:{menuElement:this.renderMenuElement()},popperOptions:c,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Q=V;T(Q,"MENU_NAVIGATION_DIRECTION",Mt),T(Q,"DROP_DOWN_MENU_HEIGHT",125),T(Q,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:On,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0});const Ys=Q,Zs=A.module("DateInput"),Js="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Qs=["2000-01-01","2022-12-31"],Xs="YYYY-MM-DD",Ye=L.forwardRef((s,t)=>{const{className:e="",onChange:n=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:r=()=>{},"data-testid":c}=s,[u,d]=l.useState(o),[h,p]=l.useState(),m=l.useCallback(f=>{Zs.debug("handleChange",f),d(f),n(f)},[n]);return a.jsx("div",{className:"d-flex flex-row align-items-center",children:a.jsx(Ge,{ref:t,className:O(e),example:Qs,getNextSegmentValue:$n,onChange:m,onSelect:p,pattern:Js,placeholder:Xs,selection:h,value:u,onFocus:i,onBlur:r,"data-testid":c})})});Ye.displayName="DateInput";Ye.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ei=Ye;class Rt extends l.PureComponent{constructor(e){super(e);T(this,"searchInput");this.searchInput=L.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=ve(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:o,id:i,"data-testid":r}=this.props,{value:c}=this.state;return a.jsx(Ke,{value:c,placeholder:e,onChange:this.handleChange,className:n,matchCount:o,ref:this.searchInput,id:i,"data-testid":r})}}T(Rt,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const ti=Rt;function ni(s){const{isInvalid:t=!1,items:e,onAdd:n=()=>{},onDelete:o=()=>{},validate:i=()=>null}=s,[r,c]=l.useState(null),[u,d]=l.useState([]),[h,p]=l.useState(""),m=l.useCallback(v=>{d(v)},[]),f=l.useCallback(()=>{o(at.getItemsInRanges(e,u)),d([])},[e,u,o]),C=l.useCallback(()=>{if(h==="")return;const v=i(h);v==null?(n(h),p("")):c(v)},[h,n,i]),b=l.useCallback(v=>{const{value:y}=v.target;p(y),c(y===""?null:i(y))},[i]),w=l.useCallback(()=>{d([])},[]),j=l.useCallback(v=>{v.key==="Enter"&&C()},[C]),P=l.useMemo(()=>14+Pe(e.length,1,6)*Le.DEFAULT_ROW_HEIGHT,[e.length]);return a.jsxs("div",{className:O("editable-item-list-container",{"is-invalid":t}),children:[a.jsx("div",{style:{height:P},children:a.jsx(Le,{itemCount:e.length,items:e.map((v,y)=>({value:v,isSelected:at.isSelected(u,y)})),offset:0,selectedRanges:u,onSelectionChange:m,isMultiSelect:!0})}),a.jsxs("div",{className:"d-flex flex-row pt-2",children:[a.jsx("div",{className:"d-flex flex-grow-1",children:a.jsx("input",{className:O("form-control",{"is-invalid":r!=null}),placeholder:"Enter value",type:"text",value:h,onChange:b,onFocus:w,onKeyDown:j})}),a.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[a.jsx(H,{kind:"ghost",onClick:C,disabled:r!=null||h==="",icon:jn,tooltip:"Add new item","data-testid":"add-item-button"}),a.jsx(H,{kind:"ghost",onClick:f,disabled:u.length===0,icon:Mn,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}const le=class extends l.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const o=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return o&&i?null:o}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:o}=this.props,i=new Map(n),r=i.get(t);if(r instanceof Map){const u=new Map(r);if(e!=null)u.set(e,r.get(e)===void 0);else{const d=le.isParentSelected(t,i),h=d==null||!d;r.forEach((p,m)=>u.set(m,h))}i.set(t,u)}else i.set(t,r==null||!r);const c=i.get(t);if(e===void 0&&c!==void 0&&typeof c!="boolean"){const u=le.isParentSelected(t,n);u!=null&&u?c.forEach((d,h)=>c.set(h,!1)):c.forEach((d,h)=>c.set(h,!0))}o(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,o=new Map;e.forEach((i,r)=>{if(typeof i=="boolean")o.set(r,t);else{const c=new Map;i.forEach((u,d)=>c.set(d,t)),o.set(r,c)}}),n(o)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return a.jsxs("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,o])=>a.jsxs("div",{children:[a.jsx(De,{className:"hcm-parent",checked:le.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),o!==void 0&&typeof o!="boolean"&&Array.from(o.entries()).map(([i,r])=>a.jsx(De,{className:"hcm-child",checked:r,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),a.jsx(H,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),a.jsx(H,{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:o,"data-testid":i}=this.props,{menuIsOpen:r}=this.state;return a.jsxs("button",{type:"button",className:O("btn hcm-btn",e),onClick:this.toggleMenu,id:o,"data-testid":i,children:[a.jsxs("span",{children:[n&&a.jsx(z,{icon:n,className:"hcm-icon mr-1"}),t]}),a.jsx(z,{icon:Ct,className:"hcm-icon ml-1"}),a.jsx(We,{options:{placement:"bottom"},isShown:r,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let ge=le;T(ge,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const si=ge;const ii=.025,oi=.9,ai=.1,ri=.618,je=Z["primary-dark"],ct=80,li=Z["gray-800"],ci=Z["gray-900"],Y={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},W=18,ui=250,di=60*1e3,hi=L.memo(()=>{const s=l.useRef(null),t=l.useRef(null),[e,n]=l.useState(!1),o=window.devicePixelRatio;let i,r,c,u,d,h=null,p=[];function m(){t.current!=null&&(c=t.current.offsetWidth,u=t.current.offsetHeight),s.current!=null&&(s.current.style.width=`${c}px`,s.current.style.height=`${u}px`,s.current.width=c*o,s.current.height=u*o),i==null||i.scale(o,o)}function f(){const I=document.createElement("canvas");I.width=Y.SIZE,I.height=Y.SIZE;const k=I.getContext("2d");return k!=null&&(k.fillStyle=je,k.fillRect(0,0,Y.DOT_SIZE,Y.DOT_SIZE),k.fillStyle=je+Math.round(255*Y.FILL_OPACITY).toString(16).padStart(2,"0"),k.fillRect(0,0,Y.SIZE,Y.SIZE)),k==null?void 0:k.createPattern(I,"repeat")}function C(I){const k=Math.random()-.5;let D=ii*k;return I<ai?D=Math.abs(D):I>oi&&(D=-Math.abs(D)),I+D}function b(){const I=[];let k=ri;for(let D=0;D<c+W;D+=1)k=C(k),I.push(k);return I}function w(){for(;p.length>=c+W;)p.pop();for(;p.length<c+W;)p.push(C(p[p.length-1]))}function j(I,k){k.beginPath(),k.moveTo(-1,u+1),k.lineTo(-1,u*I[0]);for(let D=0;D<I.length;D+=1)k.lineTo(D,u*I[D]);k.lineTo(c+W,u*I[I.length-1]),k.lineTo(c+W,u+1),k.closePath()}function P(I){I.beginPath();for(let k=1;k<c;k+=ct)I.moveTo(k,0),I.lineTo(k,u);for(let k=1;k<u;k+=ct)I.moveTo(0,k),I.lineTo(c,k)}function v(I){h=h??I,Vn(i),i.fillStyle=ci,i.fillRect(0,0,c,u),P(i),i.lineWidth=1,i.strokeStyle=li,i.stroke();const k=((h??0)-(I??0))/(1e3/W);if(i.translate(k,0),j(p,i),i.lineWidth=2,i.strokeStyle=je,i.stroke(),i.translate(-k,0),r!=null&&(i.fillStyle=r),i.fill(),i.setTransform(o,0,0,o,0,0),(I??0)-(h??0)>1e3/W){const D=Math.floor(((I??0)-(h??0))/(1e3/W));for(let de=0;de<D;de+=1)p.shift(),p.push(C(p[p.length-1]));h=I}d!=null&&cancelAnimationFrame(d),d=requestAnimationFrame(v)}const y=ve(()=>{d=requestAnimationFrame(I=>{m(),w(),n(!1),v(I)})},ui,{leading:!0});function N(){n(!0),d!=null&&cancelAnimationFrame(d),d=null,h=null}const E=ve(()=>{N()},di);function x(){d==null&&(n(!1),m(),w(),d=requestAnimationFrame(v)),E()}function U(){document.hasFocus()&&x()}function se(){d!=null&&cancelAnimationFrame(d),E(),y()}return l.useEffect(()=>{var I;return i=(I=s.current)==null?void 0:I.getContext("2d",{alpha:!1}),m(),p=b(),r=f(),v(),E(),window.addEventListener("resize",se),window.addEventListener("focus",x),window.addEventListener("blur",N),window.addEventListener("mousemove",U),window.addEventListener("keydown",U),()=>{d!=null&&cancelAnimationFrame(d),window.removeEventListener("resize",se),window.removeEventListener("focus",x),window.removeEventListener("blur",N),window.removeEventListener("mousemove",U),window.removeEventListener("keydown",U),E.cancel(),y.cancel()}},[]),a.jsx("div",{className:"random-area-plot-animation-container",ref:t,children:a.jsx("canvas",{ref:s,className:e?"shade":""})})}),At=hi;const Ze=L.forwardRef((s,t)=>{const{children:e,className:n,disabled:o,id:i,isLinked:r,isLinkedSource:c,isInvalid:u,onClick:d,onMouseEnter:h,onMouseLeave:p,style:m,"data-testid":f}=s;return a.jsxs("button",{ref:t,type:"button",className:O("btn-socketed",{"btn-socketed-linked":r!==void 0&&r||c},{"btn-socketed-linked-source":c},{"is-invalid":u},n),id:i,onClick:d,onMouseEnter:h,onMouseLeave:p,style:m,disabled:o,"data-testid":f,children:[e,a.jsx(z,{icon:Rn,className:"linked btn-socketed-icon",transform:"down-1"}),a.jsx(z,{icon:An,className:"is-invalid btn-socketed-icon"})]})});Ze.displayName="SocketedButton";Ze.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const pi=Ze,fi={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},mi={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:gi,light:vi,dark:bi,medium:Ci,large:xi}=xn,Ei={global:gi,light:{...vi,...mi},dark:{...bi,...fi},medium:Ci,large:xi},Ti="_track_535ju_30",yi="_handle_535ju_13",Ni="_ticks_535ju_98",Pt={"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:Ti,"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:yi,ticks:Ni,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const fe=parseInt(Pt["handle-size"],10),ut=parseInt(Pt["popover-width"],10),F=24*60*60-1,dt=5*60;function ki({startTime:s,endTime:t,onChange:e,isStartModified:n=!1,isEndModified:o=!1,"data-testid":i}){const[r,c]=l.useState(s),[u,d]=l.useState(t),h=l.useRef(null);l.useEffect(function(){c(s),d(t)},[s,t]);const p=l.useCallback((C,b)=>{let w=C,j=b;w===j&&(j<F?j+=1:w-=1),c(w),d(j),e({startTime:w,endTime:j})},[c,d,e]),m=l.useCallback(C=>{p(C,u)},[p,u]),f=l.useCallback(C=>{p(r,C)},[p,r]);return a.jsxs("div",{className:"time-slider","data-testid":i,children:[a.jsx(Ii,{startTime:r,endTime:u,onStartTimeChange:m,onEndTimeChange:f,isStartModified:n,isEndModified:o}),a.jsxs("div",{className:"track",ref:h,children:[a.jsx(wi,{startTime:r,endTime:u}),a.jsx("div",{className:"ticks",children:Array(24).fill(null).map((C,b)=>a.jsx("div",{className:"tick"},b))}),a.jsx(ht,{track:h,time:r,setTime:m}),a.jsx(ht,{track:h,time:u,setTime:f})]}),a.jsxs("div",{className:"tick-labels",children:[a.jsx("div",{className:"tick-label",children:"0:00"}),a.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((C,b)=>a.jsx("div",{className:"tick-label",children:`${b+1}:00`},b))})]})]})}function Ii(s){const{startTime:t,endTime:e,onStartTimeChange:n,onEndTimeChange:o,isStartModified:i,isEndModified:r,"data-testid":c}=s,u=t>e,[d,h]=l.useState(u?e:t),[p,m]=l.useState(u?t:e),f=l.useRef(null),C=l.useRef(null),b=l.useRef(null),w=l.useRef(null);l.useEffect(function(){h(t>e?e:t),m(t>e?t:e)},[t,e]),l.useEffect(function(){var E,x;b.current!==null&&((E=C.current)==null||E.setSelection(b.current)),w.current!==null&&((x=f.current)==null||x.setSelection(w.current))},[u]);function j(N){t<=e?n(N):o(N)}function P(N){t<=e?o(N):n(N)}const v=l.useCallback(N=>{b.current=N,w.current=null},[]),y=l.useCallback(N=>{b.current=null,w.current=N},[]);return a.jsxs("div",{className:"time-slider-popovers",children:[a.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/F*100}% - ${ut/2}px)`}}),a.jsxs("div",{className:"handle-popper",children:[a.jsx("label",{className:O({modified:u?r:i}),children:u?"End Time":"Start Time"}),a.jsx(Ee,{ref:f,allowValueWrapping:!1,value:d,onChange:j,onSelect:v,"data-testid":c!==void 0?`${c}-input-1`:void 0})]}),a.jsx("div",{className:"flex-spacer"}),a.jsxs("div",{className:"handle-popper",children:[a.jsx("label",{className:O({modified:u?i:r}),children:u?"Start Time":"End Time"}),a.jsx(Ee,{ref:C,allowValueWrapping:!1,value:p,onChange:P,onSelect:y,"data-testid":c!==void 0?`${c}-input-2`:void 0})]}),a.jsx("div",{className:"flex",style:{flexBasis:`calc(${(F-p)/F*100}% - ${ut/2}px)`}})]})}function wi(s){const{startTime:t,endTime:e,"data-testid":n}=s;return a.jsxs("div",{className:"track-fills","data-testid":n,children:[t>e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/F})`}}),a.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(F-t)/F})`}})]}),t<e&&a.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${t/F*100}%) scaleX(${(e-t)/F})`}})]})}function ht(s){const{track:t,time:e,setTime:n,"data-testid":o}=s,i=l.useMemo(()=>{let f=fe/2;return e<3600?f=e/3600*(fe/2):e>23*3600&&(f=fe/2+1/(F-23*3600)*(e-23*3600)*(fe/2)),`translateX(calc(${e/F*100}% - ${f}px))`},[e]),r=l.useCallback(m=>{if(!t.current)return 0;const f=t.current.getBoundingClientRect(),C=Math.max(m-f.left,0),b=F*Math.min(1,C/f.width),w=dt*Math.round(b/dt);return Math.min(F,w)},[t]),c=l.useCallback(({clientX:m})=>{n(r(m))},[n,r]),u=l.useCallback(({clientX:m})=>{n(r(m)),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),document.documentElement.classList.remove("drag-pointer-events-none")},[n,r,c]),d=l.useCallback(()=>{window.addEventListener("mousemove",c),window.addEventListener("mouseup",u),document.documentElement.classList.add("drag-pointer-events-none")},[c,u]),h=l.useCallback(()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),document.documentElement.classList.remove("drag-pointer-events-none")},[c,u]),p=l.useCallback(()=>{d()},[d]);return l.useEffect(function(){return()=>{h()}},[h]),a.jsx("div",{className:"handle-track",style:{transform:i},children:a.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:p,"data-testid":o})})}function Lt({buttons:s,isShown:t=!1,classNames:e,message:n,type:o,onClick:i,onDismiss:r,"data-testid":c}){const u=s&&s.length!==0;return a.jsx(be,{in:t,timeout:Z.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:a.jsxs("div",{className:O("toast-notification",e,o),role:"presentation",onClick:i,onKeyPress:i,"data-testid":c,children:[a.jsx("div",{className:"message-container",children:a.jsx("span",{className:"message",children:n})}),a.jsx(be,{in:u,timeout:Z.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:a.jsx("div",{className:"buttons-container",children:s})}),r&&a.jsx(H,{kind:"ghost",icon:Pn,tooltip:"Close notification",className:"my-2",onClick:r})]})})}Lt.TYPE=Object.freeze({ERROR:"error"});function Si(s){const{children:t,className:e,labelText:n,hintText:o,isModified:i,validationError:r,showValidationError:c=!0,"data-testid":u,id:d}=s,{current:h}=l.useRef(d??ye());return a.jsxs(a.Fragment,{children:[a.jsx("label",{className:O("validate-label",e,{modified:i}),htmlFor:h,"data-testid":u,children:n}),L.Children.toArray(t).map(p=>L.isValidElement(p)?L.cloneElement(p,{className:O(p.props.className,{"is-invalid":r})}):a.jsx("div",{className:O(e),children:p})),o!==void 0&&a.jsx("small",{className:"form-text text-muted",children:o}),r!==void 0&&c&&a.jsx("p",{className:"validate-label-error text-danger",children:r})]})}const Oi=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:$s,AutoResizeTextarea:qe,BasicModal:ze,Button:H,ButtonGroup:ue,ButtonOld:Bs,CardFlip:Hs,Checkbox:De,Collapse:Ws,ComboBox:Bn,ContextActionUtils:Hn,ContextActions:Wn,ContextMenuItem:Gn,ContextMenuRoot:Kn,CopyButton:qn,CustomTimeSelect:Ys,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:Tt,DateInput:ei,DateTimeInput:zn,DebouncedSearchInput:ti,DragUtils:Yn,DraggableItemList:Zn,DropdownMenu:yt,EditableItemList:ni,GLOBAL_SHORTCUTS:Jn,HierarchicalCheckboxMenu:si,InfoModal:Vs,ItemList:Le,ItemListItem:Qn,KEY:Xn,LoadingOverlay:ne,LoadingSpinner:xt,MODIFIER:es,MaskedInput:Ge,Menu:ts,MenuItem:ns,Modal:Be,ModalBody:He,ModalFooter:St,ModalHeader:bt,Option:ss,Page:is,Popper:We,RadioGroup:os,RadioItem:as,RandomAreaPlotAnimation:At,SearchInput:Ke,Select:rs,SelectValueList:Nt,Shortcut:ls,ShortcutRegistry:cs,SocketedButton:pi,Stack:us,ThemeExport:Z,TimeInput:Ee,TimeSlider:ki,ToastNotification:Lt,Tooltip:ds,UISwitch:hs,ValidateLabelInput:Si,fillToLength:ps,themeDHDefault:Ei,trimTrailingMask:fs},Symbol.toStringTag,{value:"Module"})),ji=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Ln,ApiContext:Dn,ClientBootstrap:kt,ClientContext:ms,useApi:Ne,useClient:ce},Symbol.toStringTag,{value:"Module"})),Me=A.module("MessageUtils"),Dt="io.deephaven.message.LoginOptions.request",_t="io.deephaven.message.SessionDetails.request",Ft="io.deephaven.broadcast",Je="io.deephaven.broadcast.Login",Ut="io.deephaven.broadcast.Logout";function Ie(s){const t=s;return t!=null&&typeof t.id=="string"&&typeof t.message=="string"}function $t(s){return Ie(s)&&s.message===Je}function Vt(s){return Ie(s)&&s.message===Ut}function Bt(s){const t=s;return t!=null&&typeof t.id=="string"}function Qe(s,t=ye(),e){return{message:s,id:t,payload:e}}function Mi(s,t){return{id:s,payload:t}}async function Xe(s,t=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((e,n)=>{let o;const i=ye(),r=c=>{const{data:u}=c;if(!Bt(u)){Me.debug("Ignoring non-deephaven response",u);return}if(Me.debug("Received message",u),(u==null?void 0:u.id)!==i){Me.debug("Ignore message, id doesn't match",u);return}window.clearTimeout(o),window.removeEventListener("message",r),e(u.payload)};window.addEventListener("message",r),o=window.setTimeout(()=>{window.removeEventListener("message",r),n(new gs("Request timed out"))},t),window.opener.postMessage(Qe(s,i),"*")})}class Ht extends Error{constructor(){super(...arguments);T(this,"isNoConsolesError",!0)}}function Wt(s){return s.isNoConsolesError}const X=A.module("SessionUtils");function Ri(s){return X.info(`Starting connection to '${s}'...`),new dh.IdeConnection(s)}async function Gt(s,t){X.info("Getting console types...");const e=await s.getConsoleTypes();if(e.length===0)throw new Ht("No console types available");X.info("Available types:",e);const n=e[0];X.info("Starting session with type",n);const o=await s.startSession(n),i={type:n,id:ye.generate()};return X.info("Console session established",i),{session:o,config:i,connection:s,details:t}}function Ai(s,t){return X.info("createCoreClient",s),new dh.CoreClient(s,t)}function Pi(s){return s!=null&&typeof s=="object"}async function Li(){const s=await Xe(_t);if(!Pi(s))throw new Error(`Unexpected session details response: ${s}`);return s}async function Di(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return Li()}return{}}async function _i(s,t){let e;try{e=await Gt(s,t)}catch(n){if(!Wt(n))throw n}return e}const Fi=A.module("ViewportDataUtils");function Kt(s,t){return String(s.offsetInSnapshot+t)}function qt(s,t,e){return function(o){if(s==null)return;const{offset:i,rows:r}=o.detail;Fi.debug("table updated",o.detail),r.forEach(c=>{const u=e(c,s.columns),d={key:Kt(c,i),item:u};t.getItem(d.key)!=null?t.update(d.key,d):t.append(d)})}}function zt(s,t){return t.reduce((e,n)=>(e[n.name]=s.get(n),e),{})}function*Yt(s){for(let t=0;t<s;++t)yield{key:String(t)}}function we(s){return s==null||et(s)?0:s.size}function et(s){return"isClosed"in s?s.isClosed:!1}function Zt(s,t,e,n){const o=s+t-1,[i,r]=[0,n-1],c=Pe(s-e,i,r),u=Pe(o+e,i,r);return[c,u]}const Ui=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:Ft,BROADCAST_LOGIN_MESSAGE:Je,BROADCAST_LOGOUT_MESSAGE:Ut,BooleanColumnFormatter:vs,CharColumnFormatter:bs,DateTimeColumnFormatter:Cs,DateUtils:xs,DecimalColumnFormatter:Es,DefaultColumnFormatter:Ts,FETCH_TIMEOUT:ys,Formatter:It,FormatterUtils:_e,IntegerColumnFormatter:Ns,LOGIN_OPTIONS_REQUEST:Dt,NoConsolesError:Ht,SESSION_DETAILS_REQUEST:_t,StringColumnFormatter:ks,TableColumnFormatter:Is,TableUtils:ws,createConnection:Ri,createCoreClient:Ai,createKeyFromOffsetRow:Kt,createOnTableUpdatedHandler:qt,createSessionWrapper:Gt,defaultRowDeserializer:zt,fetchVariableDefinition:Ss,generateEmptyKeyedItems:Yt,getColumnFormats:Os,getDateTimeFormatterOptions:js,getSessionDetails:Di,getSize:we,isBroadcastLoginMessage:$t,isBroadcastLogoutMessage:Vt,isClosed:et,isCustomColumnFormatDefined:Ms,isMessage:Ie,isNoConsolesError:Wt,isResponse:Bt,loadSessionWrapper:_i,makeMessage:Qe,makeResponse:Mi,padFirstAndLastRow:Zt,requestParentResponse:Xe},Symbol.toStringTag,{value:"Module"})),pt=A.module("useTableListener"),$i=(s,t,e)=>l.useEffect(function(){if(s==null){pt.debug2("Emitter undefined, skipping addEventListener",t);return}return pt.debug2("Adding listener",t),s.addEventListener(t,e)},[s,t,e]),re=$i;class Vi extends Error{constructor(){super(...arguments);T(this,"isColumnNameError",!0)}}const Bi=Vi;class Hi extends Error{constructor(){super(...arguments);T(this,"isTableDisconnectError",!0)}}const Wi=Hi,me=A.module("useTable"),Gi=(s,t,e,n)=>{const o=Ne(),[i,r]=l.useState(void 0),[c,u]=l.useState([]),[d,h]=l.useState(null),[p,m]=l.useState(null);l.useEffect(()=>{if(n===void 0){r(s==null?void 0:s.columns),h(null);return}try{r(s==null?void 0:s.findColumns(n)),h(null)}catch(w){me.error("Column not found",w,n),h(new Bi("Invalid columnNames argument"))}},[s,n]),l.useEffect(()=>{if(!i||!s){me.debug2("Table or column not initialized, skip viewport update.");return}me.debug2("Setting viewport",t,e),s.setViewport(t,e,i)},[i,s,t,e]);const f=l.useCallback(({detail:w})=>{if(!i){me.error("Columns not initialized.");return}const j=i.map(P=>w.rows.map(v=>v.get(P)));u(j)},[i]),C=l.useCallback(()=>{m(new Wi("Table disconnected"))},[]),b=l.useCallback(()=>{m(null)},[]);return re(s,o.Table.EVENT_UPDATED,f),re(s,o.Table.EVENT_DISCONNECT,C),re(s,o.Table.EVENT_RECONNECT,b),{columns:i,data:c,error:p??d}},Jt=Gi,Ki=(s,t,e,n)=>{const o=l.useMemo(()=>[n],[n]),{columns:i=[],data:r=[],error:c}=Jt(s,t,e,o);return{column:i[0],data:r[0],error:c}},Qt=Ki;const B=A.module("TableInput"),Re=250;function tt(s){const{className:t=void 0,columnName:e,settings:n,defaultValue:o=[],isInvalid:i=!1,onChange:r=()=>!1,onBlur:c=()=>!1,table:u}=s,d=l.useRef(null),h=l.useMemo(()=>{const M=_e.getColumnFormats(n),S=_e.getDateTimeFormatterOptions(n),{defaultDecimalFormatOptions:R={},defaultIntegerFormatOptions:$={}}=n;return new It(M,S,R,$)},[n]),[p,m]=l.useState(""),[f,C]=l.useState(new Set(o)),[b,w]=l.useState(),j=l.useRef(null),P=Math.min((b==null?void 0:b.size)??0,Re),{column:v,data:y,error:N}=Qt(b,0,Re-1,e),E=l.useCallback(M=>v?h.getFormattedString(M,v.type,v.name):`${M}`,[v,h]),[x,U]=l.useMemo(()=>{const M=new Set(f),S=[];if(y==null)return[S,null];if(y.forEach(R=>{const $=`${R}`,pe=f.has($);pe&&M.delete($),S.push({value:$,displayValue:E(R),isSelected:pe})}),M.size>0){B.debug2("Selection has items that are missing from the viewport");const R=new Set(f);return Array.from(M).forEach($=>{R.delete($)}),[S,R]}return[S,null]},[y,f,E]);l.useEffect(()=>{U!==null&&(C(U),r(Array.from(U)))},[r,U]);const se=l.useCallback(async M=>{try{const S=await M;B.debug("Table resolved",S),w(S)}catch(S){if(rt.isCanceled(S))return;B.error(S)}},[]);l.useEffect(()=>{const M=rt.makeCancelable(u);return se(M),()=>{B.debug2("Cancel table promise"),M.cancel()}},[u,se]);const I=l.useCallback(M=>{var $;const{value:S}=M.target;m(S);const R=x.findIndex(pe=>pe.displayValue.includes(S));R>-1?(B.debug2(`Found ${S} at index ${R}`),($=j.current)==null||$.scrollIntoView(R)):B.debug2(`${S} not found`)},[x,j]),k=l.useCallback(M=>{if(B.debug("handleSelect",M),M>=x.length){B.error("Invalid index",M);return}const S=x[M].value,R=new Set(f);x[M].isSelected?R.delete(S):R.add(S),C(R),r(Array.from(R))},[r,x,f]),D=l.useCallback(()=>{const M=x.map(R=>R.value),S=new Set(M);C(S),r(M)},[x,r]),de=l.useCallback(()=>{C(new Set),r([])},[r]),mn=l.useCallback(()=>{},[]),he=l.useCallback(M=>{var R;const{relatedTarget:S}=M;B.debug("handleChildBlur",S,S instanceof HTMLElement,d.current,(R=d.current)==null?void 0:R.contains(S)),(!S||d.current&&S instanceof HTMLElement&&!d.current.contains(S))&&c()},[c]),Oe=x.length===0;return a.jsxs("div",{ref:d,className:O("table-input-container d-flex flex-column position-relative",t),children:[a.jsx(Ke,{disabled:!!N||Oe,value:p,placeholder:"Search",onChange:I,className:"mb-2 d-flex",onBlur:he}),a.jsx(Nt,{className:"table-input-list",disabled:b===void 0||Oe,isInvalid:i,items:Oe?[{value:"Empty",isSelected:!1}]:x,itemCount:P,offset:0,onSelect:k,onViewportChange:mn,ref:j,onBlur:he}),b&&a.jsxs("div",{className:"meta-row",children:[a.jsx("div",{className:"d-flex align-items-center text-muted small",children:b!=null&&b.size>P&&a.jsxs(a.Fragment,{children:["Table is too large, showing the first ",Re," items."]})}),a.jsxs("div",{children:[a.jsx("button",{type:"button",className:"btn btn-link",onBlur:he,onClick:D,children:"Select All"}),a.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:he,onClick:de,children:"Clear"})]})]}),b==null||N&&a.jsx("div",{className:"h-100 w-100 position-absolute",children:a.jsx(ne,{isLoaded:b!=null,isLoading:b==null&&N==null,errorMessage:(N==null?void 0:N.message)??null})})]})}tt.displayName="TableInput";tt.defaultProps={isInvalid:!1,className:void 0};const ft=A.module("useBroadcastChannel");function nt(s=Rs,t=Ft){const e=l.useMemo(()=>new BroadcastChannel(t),[t]);return l.useEffect(()=>()=>{e.close()},[e]),l.useEffect(()=>{function n(o){const{data:i}=o;if(!Ie(i)){ft.debug("Ignoring non-deephaven message",i);return}ft.debug("event received",i),s(o)}return e.addEventListener("message",n),()=>{e.removeEventListener("message",n)}},[e,s]),e}function Se(s,t){const e=l.useCallback(n=>{$t(n.data)?s==null||s(n.data):Vt(n.data)&&(t==null||t(n.data))},[s,t]);nt(e)}const Te="io.deephaven.web.client.auth.refreshToken",Xt=l.createContext(null),qi=A.module("RefreshTokenUtils");function Fe(){const s=te.get(Te);try{if(s!=null)return JSON.parse(s)}catch(t){qi.error("Error parsing refresh token",s,t)}return null}function Ue(s){if(s==null){te.remove(Te);return}const t=JSON.stringify({bytes:s.bytes,expiry:s.expiry}),e=new Date(s.expiry);te.set(Te,t,{secure:!0,sameSite:"strict",expires:e})}function en({children:s}){const t=Ne(),e=ce(),[n,o]=l.useState(Fe());l.useEffect(function(){return e.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{const{detail:h}=d;Ue(h),o(h)})},[t,e,n]);const i=l.useCallback(()=>{o(Fe())},[]),r=l.useCallback(()=>{Ue(null),o(null)},[]);return Se(i,r),a.jsx(Xt.Provider,{value:n,children:s})}function tn(s){const t=En({});return l.useEffect(()=>{s&&(t.items.length&&t.remove(...t.items.map(({key:e})=>e)),t.insert(0,...Yt(we(s))))},[s]),t}function zi(s,...t){const e=l.useCallback(async()=>(s==null?void 0:s.selectDistinct(s.findColumns(t)))??null,[s,...t]),{data:n,error:o,isError:i,isLoading:r}=Ot(e,[]);return l.useEffect(()=>()=>{n==null||n.close()},[n]),{distinctTable:n,error:o,isError:i,isLoading:r}}function nn(s,t,e){return l.useCallback(function(o){const[i,r]=Zt(o,t,e,we(s));s==null||s.setViewport(i,r)},[s,e,t])}function Yi({table:s,viewportSize:t=10,viewportPadding:e=50,deserializeRow:n=zt}){const o=tn(s),i=nn(s,t,e);return re(s,dh.Table.EVENT_UPDATED,qt(s,o,n)),l.useEffect(()=>{s&&!et(s)&&i(0)},[s,i]),{viewportData:o,size:we(s),setViewport:i}}const Zi=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:Te,RefreshTokenBootstrap:en,RefreshTokenContext:Xt,TableInput:tt,readRefreshToken:Fe,storeRefreshToken:Ue,useBroadcastChannel:nt,useBroadcastLoginListener:Se,useInitializeViewportData:tn,useSelectDistinctTable:zi,useSetPaddedViewportCallback:nn,useTable:Jt,useTableColumn:Qt,useTableListener:re,useViewportData:Yi},Symbol.toStringTag,{value:"Module"})),sn=l.createContext(!1);function Ji({fontClassNames:s=["fira-sans-regular","fira-sans-bold","fira-mono"],children:t}){const[e,n]=l.useState(!1);return l.useEffect(function(){document.fonts.ready.then(()=>{n(!0)})},[]),a.jsxs(a.Fragment,{children:[a.jsx(sn.Provider,{value:e,children:t}),a.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:s.map(o=>a.jsx("p",{className:o,children:"preload"},o))})]})}function on(s){if(s==null)return!1;const t=s;return t.Component!==void 0&&typeof t.isAvailable=="function"}const an="io.deephaven.auth.AnonymousAuthenticationHandler",Qi="io.deephaven.authentication.psk.PskAuthenticationHandler";class Xi extends Error{constructor(){super(...arguments);T(this,"name","AuthenticationError");T(this,"isAuthenticationError",!0)}}const rn=Xi,mt=A.module("AuthPluginBase");function st({children:s,getLoginOptions:t}){const e=ce(),[n,o]=l.useState(),[i,r]=l.useState(!1);return l.useEffect(()=>{let c=!1;function u(){if(c)throw new As("Login canceled.")}async function d(){try{const h=await t();u(),mt.info("Logging in..."),await e.login(h),u(),r(!0)}catch(h){if(!c){mt.error("Unable to login:",h);const p=xe(h)??"Unable to login. Verify credentials.";o(new rn(p)),r(!1)}}}return d(),()=>{c=!0}},[e,t]),i?a.jsx(a.Fragment,{children:s}):a.jsx(ne,{"data-testid":"auth-base-loading",isLoading:n==null,isLoaded:!1,errorMessage:xe(n)})}const eo=l.createContext({}),it=l.createContext({}),to={canLogout:!1};function no({children:s}){const t=Ne(),e=l.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return a.jsx(st,{getLoginOptions:e,children:a.jsx(it.Provider,{value:to,children:s})})}const so={Component:no,isAvailable:s=>s.includes(an)},ln=so,io=A.module("AuthPluginParent"),oo={canLogout:!1};function ao(s){return s!=null&&typeof s.type=="string"}async function ro(){io.info("Logging in by delegating to parent window...");const s=await Xe(Dt);if(!ao(s))throw new Error(`Unexpected login options response: ${s}`);return s}function lo(){return new URLSearchParams(window.location.search).get("authProvider")??""}function co({children:s}){return a.jsx(st,{getLoginOptions:ro,children:a.jsx(it.Provider,{value:oo,children:s})})}const uo={Component:co,isAvailable:()=>window.opener!=null&&lo()==="parent"},cn=uo;function un({children:s,errorMessage:t,isLoggingIn:e=!1,onSubmit:n}){return a.jsxs("form",{className:"login-form",onSubmit:o=>{o.preventDefault(),o.stopPropagation(),n==null||n(o)},children:[a.jsx("div",{className:"flex-spacer"}),a.jsxs("div",{className:"flex-wrapper",children:[a.jsx("fieldset",{disabled:e,className:"container-fluid",children:s}),a.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:a.jsxs("button",{type:"submit",className:O("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&a.jsxs("span",{children:[a.jsx(xt,{}),a.jsx("span",{className:"btn-normal-content",children:"Logging in"}),a.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),a.jsx("div",{className:"flex-spacer",children:t!=null&&a.jsx("p",{className:"error-message mb-0",role:"alert",children:`${t}`})})]})}function dn({children:s,logoPath:t="/logo.png"}){return a.jsxs("div",{className:"login-container",children:[a.jsx(At,{}),a.jsxs("div",{className:"login-box",children:[a.jsx("div",{className:"logo",children:a.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),s,a.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const $e="io.deephaven.authentication.psk.PskAuthenticationHandler",hn="psk",Ve="io.deephaven.web.client.auth.psk.token",ee=A.module("AuthPluginPsk");function ho(){return new URLSearchParams(window.location.search).get(hn)}function po(){ee.debug2("clearWindowToken");const s=new URL(window.location.href);s.searchParams.delete(hn),window.history.replaceState(null,"",s.href)}function gt(){return te.get(Ve)??null}function Ae(s){ee.debug2("Storing token in cookie",s),s!=null?te.set(Ve,s,{secure:!0,sameSite:"strict"}):te.remove(Ve)}function fo({children:s,logoPath:t}){const e=ce(),n=l.useRef(null),o=l.useRef(null),[i,r]=l.useState(),[c,u]=l.useState(!1),[d,h]=l.useState(!1),[p,m]=l.useState(!1),[f,C]=l.useState(""),b=l.useCallback(async(y,N=!0)=>{ee.info("Logging in..."),m(!0);let E=null;try{if(E=e.login({type:$e,token:y}),o.current=E,await E,ee.info("Logged in successfully"),o.current!==E)return;Ae(y),h(!0)}catch(x){if(o.current!==E)return;if(u(!0),N){ee.error("Unable to login",x);const U=xe(x)??"Unable to login: Verify credentials.";r(new rn(U))}}m(!1)},[e]),w=l.useCallback(()=>{o.current=null,m(!1)},[]),j=l.useCallback(async()=>{ee.debug("onLogin");const y=gt();d||p||y==null||b(y,!1)},[d,p,b]),P=l.useCallback(()=>{Ae(null)},[]);Se(j,P),l.useEffect(()=>{let y=!1;async function N(){const E=ho()??gt();if(po(),E==null){u(!0);return}m(!0);try{await e.login({type:$e,token:E}),y||(Ae(E),h(!0),m(!1))}catch{y||(u(!0),m(!1))}}return N(),()=>{y=!0}},[e]);const v=l.useCallback(()=>{p?w():b(f)},[w,p,b,f]);return l.useEffect(function(){var N;(N=n.current)==null||N.focus()},[n,c]),a.jsxs(a.Fragment,{children:[d&&s,c&&a.jsx(be,{in:!d,timeout:Z.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:a.jsx(dn,{logoPath:t,children:a.jsx(un,{errorMessage:xe(i),isLoggingIn:p,onSubmit:v,children:a.jsxs("div",{className:"form-group",children:[a.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),a.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:n,value:f,onChange:y=>{r(void 0),C(y.target.value)}})]})})})}),a.jsx(ne,{"data-testid":"auth-psk-loading",isLoaded:d||c,isLoading:!d&&!c})]})}const mo={Component:fo,isAvailable:s=>s.includes($e)},pn=mo,go=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:an,AUTH_HANDLER_TYPE_PSK:Qi,AuthPluginAnonymous:ln,AuthPluginBase:st,AuthPluginParent:cn,AuthPluginPsk:pn,Login:dn,LoginForm:un,UserOverrideContext:eo,UserPermissionsOverrideContext:it,isAuthPlugin:on},Symbol.toStringTag,{value:"Module"})),fn={react:L,"react-dom":Tn,redux:yn,"react-redux":Nn,"@deephaven/auth-plugins":go,"@deephaven/components":Oi,"@deephaven/jsapi-bootstrap":ji,"@deephaven/jsapi-components":Zi,"@deephaven/jsapi-utils":Ui,"@deephaven/log":Fs,"@deephaven/react-hooks":Gs},vo=vt.createRequires(()=>fn),bo=vt.createRemoteComponent({requires:vo}),Co=bo,xo=kn.createRequires(fn),Eo=In({requires:xo}),To=Eo,q=A.module("@deephaven/app-utils.PluginUtils");function Vo(s,t){const e=new URL(`${t}.js`,s),n=L.forwardRef((o,i)=>a.jsx(Co,{url:e.href,render:({err:r,Component:c})=>{if(r!=null&&r!==""){const u=`Error loading plugin ${t} from ${e} due to ${r}`;return q.error(u),a.jsx("div",{className:"error-message",children:`${u}`})}return a.jsx(c,{ref:i,...o})}}));return n.pluginName=t,n.displayName="Plugin",n}async function yo(s){return await To(s)}async function No(s){const t=await fetch(s);if(!t.ok)throw new Error(t.statusText);try{return await t.json()}catch{throw new Error("Could not be parsed as JSON")}}async function ko(s){q.debug("Loading plugins...");try{const t=await No(`${s}/manifest.json`);if(!Array.isArray(t.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");q.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:r,main:c}=t.plugins[i],u=`${s}/${r}/${c}`;e.push(yo(u))}const n=await Promise.allSettled(e),o=new Map;for(let i=0;i<n.length;i+=1){const r=n[i],{name:c}=t.plugins[i];r.status==="fulfilled"?o.set(c,r.value):q.error(`Unable to load plugin ${c}`,r.reason)}return q.info("Plugins loaded:",o),o}catch(t){return q.error("Unable to load plugins:",t),new Map}}function Io(s){var t;return((t=s.get("AuthHandlers"))==null?void 0:t.split(","))??[]}function wo(s,t,e){const n=Io(t),o=[...s.entries()].filter(([,u])=>on(u.AuthPlugin)).map(([u,d])=>[u,d.AuthPlugin]);o.push(...e??[]);const i=o.filter(([u,d])=>d.isAvailable(n,t));if(i.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${n}`);i.length>1&&q.warn("More than one login plugin available, will use the first one: ",i.map(([u])=>u).join(", "));const[r,c]=i[0];return q.info("Using LoginPlugin",r),c.Component}const ot=l.createContext(null);function So({pluginsUrl:s,children:t}){const[e,n]=l.useState(null);return l.useEffect(function(){let i=!1;async function r(){const c=await ko(s);i||n(c)}return r(),()=>{i=!0}},[s]),a.jsx(ot.Provider,{value:e,children:t})}function Oo(){const s=nt();return l.useEffect(function(){s.postMessage(Qe(Je))},[s]),null}const jo=new Map([["@deephaven/auth-plugins.AuthPluginPsk",pn],["@deephaven/auth-plugins.AuthPluginParent",cn],["@deephaven/auth-plugins.AuthPluginAnonymous",ln]]);function Mo({children:s}){const t=ce(),e=l.useContext(ot),[n,o]=l.useState(),[i,r]=l.useState();l.useEffect(function(){let h=!1;async function p(){try{const m=await t.getAuthConfigValues();h||o(new Map(m))}catch(m){h||r(m)}}return p(),()=>{h=!0}},[t]);const c=l.useMemo(()=>{if(!(e==null||n==null))try{return wo(e,n,jo)}catch(d){r(d)}},[n,e]),u=c==null||n==null;return u||i!=null?a.jsx(ne,{isLoading:u,errorMessage:i!=null?`${i}`:void 0}):a.jsx(c,{authConfigValues:n,children:a.jsxs(a.Fragment,{children:[a.jsx(Oo,{}),s]})})}function Bo(s){return new URL(s,`${window.location}`)}function Ro(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function Ao(){const s=Ro();return s!=null?{headers:{"envoy-prefix":s}}:{headers:{}}}function Po({children:s}){return l.useContext(sn)?a.jsx(a.Fragment,{children:s}):a.jsx(ne,{"data-testid":"fonts-loaded-loading"})}function Ho({fontClassNames:s,pluginsUrl:t,serverUrl:e,children:n}){const o=l.useMemo(()=>Ao(),[]),[i,r]=l.useState(0),c=l.useCallback(()=>{},[]),u=l.useCallback(()=>{r(d=>d+1)},[]);return Se(c,u),a.jsx(Ji,{fontClassNames:s,children:a.jsx(So,{pluginsUrl:t,children:a.jsx(kt,{serverUrl:e,options:o,children:a.jsx(en,{children:a.jsx(Mo,{children:a.jsx(Ps,{children:a.jsx(Po,{children:n})})})})},i)})})}function Wo(){return Et(ot,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{Ho as AppBootstrap,Mo as AuthBootstrap,Ps as ConnectionBootstrap,qo as ConnectionContext,Ji as FontBootstrap,Po as FontsLoaded,sn as FontsLoadedContext,So as PluginsBootstrap,ot as PluginsContext,Co as RemoteComponent,Io as getAuthHandlers,wo as getAuthPluginComponent,Bo as getBaseUrl,Ao as getConnectOptions,Ro as getEnvoyPrefix,Vo as loadComponentPlugin,No as loadJson,yo as loadModulePlugin,ko as loadModulePlugins,zo as useConnection,Wo as usePlugins};
8
- //# sourceMappingURL=index-d17bec11.js.map
8
+ //# sourceMappingURL=index-045a91bf.js.map