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