@deephaven/embed-grid 0.38.1-beta.9 → 0.38.1-chart-refactor.20

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