@deephaven/code-studio 0.37.4-relative-base.7 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import{A as e,C as n}from"./vendor-4a7e2c7c.js";import{q as h}from"./index-32b27852.js";import{ai as C,a7 as m,aj as P,ab as A,ak as L,al as j,am as v,an as y,ao as B,ap as w,aq as E,ar as M,as as F,at as S,au as k}from"./useConnection-dbff5b5b.js";import{av as K,aw as Q,aB as W,ax as X,az as Y,ay as Z,aA as nn,ac as tn,ad as en}from"./useConnection-dbff5b5b.js";import"./helpers-042e6b4d.js";import"./monaco-6eaf53f7.js";const p=e.createContext(!1);function R({fontClassNames:t=["fira-sans-regular","fira-sans-bold","fira-mono"],children:s}){const[a,o]=e.useState(!1);return e.useEffect(function(){document.fonts.ready.then(()=>{o(!0)})},[]),n.jsxs(n.Fragment,{children:[n.jsx(p.Provider,{value:a,children:s}),n.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:t.map(i=>n.jsx("p",{className:i,children:"preload"},i))})]})}function b(){const t=C();return e.useEffect(function(){t.postMessage(m(P))},[t]),null}const O=new Map([["@deephaven/auth-plugins.AuthPluginPsk",y],["@deephaven/auth-plugins.AuthPluginParent",B],["@deephaven/auth-plugins.AuthPluginAnonymous",w]]);function U({children:t}){const s=A(),a=e.useContext(L),[o,i]=e.useState(),[r,u]=e.useState();e.useEffect(function(){let g=!1;async function x(){try{const f=await s.getAuthConfigValues();g||i(new Map(f))}catch(f){g||u(f)}}return x(),()=>{g=!0}},[s]);const l=e.useMemo(()=>{if(!(a==null||o==null))try{return j(a,o,O)}catch(d){u(d)}},[o,a]),c=l==null||o==null;return c||r!=null?n.jsx(h,{isLoading:c&&r==null,errorMessage:v(r)}):n.jsx(l,{authConfigValues:o,children:n.jsxs(n.Fragment,{children:[n.jsx(b,{}),t]})})}function z(t){return new URL(t,`${window.location}`)}function V(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function _(){const t=V();return t!=null?{headers:{"envoy-prefix":t}}:{headers:{}}}function G({children:t}){return e.useContext(p)?n.jsx(n.Fragment,{children:t}):n.jsx(h,{"data-testid":"fonts-loaded-loading"})}function D({fontClassNames:t,pluginsUrl:s,serverUrl:a,children:o}){const i=e.useMemo(()=>_(),[]),[r,u]=e.useState(0),l=e.useCallback(()=>{},[]),c=e.useCallback(()=>{u(d=>d+1)},[]);return E(l,c),n.jsx(R,{fontClassNames:t,children:n.jsx(M,{pluginsUrl:s,children:n.jsx(F,{serverUrl:a,options:i,children:n.jsx(S,{children:n.jsx(U,{children:n.jsx(k,{children:n.jsx(G,{children:o})})})})},r)})})}export{D as AppBootstrap,U as AuthBootstrap,k as ConnectionBootstrap,K as ConnectionContext,R as FontBootstrap,G as FontsLoaded,p as FontsLoadedContext,M as PluginsBootstrap,L as PluginsContext,Q as RemoteComponent,W as getAuthHandlers,j as getAuthPluginComponent,z as getBaseUrl,_ as getConnectOptions,V as getEnvoyPrefix,X as loadComponentPlugin,Y as loadJson,Z as loadModulePlugin,nn as loadModulePlugins,tn as useConnection,en as usePlugins};
2
+ //# sourceMappingURL=index-ce86c5b9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ce86c5b9.js","sources":["../../../app-utils/src/components/FontBootstrap.tsx","../../../app-utils/src/components/LoginNotifier.tsx","../../../app-utils/src/components/AuthBootstrap.tsx","../../../app-utils/src/utils/ConnectUtils.ts","../../../app-utils/src/components/FontsLoaded.tsx","../../../app-utils/src/components/AppBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport 'fira';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-bold', 'fira-mono'],\n children,\n}: FontBootstrapProps) {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n","import { useBroadcastChannel } from '@deephaven/jsapi-components';\nimport { BROADCAST_LOGIN_MESSAGE, makeMessage } from '@deephaven/jsapi-utils';\nimport { useEffect } from 'react';\n\n/**\n * Component that broadcasts a message when mounted. Should be mounted after the user has logged in.\n */\nexport function LoginNotifier() {\n const channel = useBroadcastChannel();\n useEffect(\n function notifyLogin() {\n channel.postMessage(makeMessage(BROADCAST_LOGIN_MESSAGE));\n },\n [channel]\n );\n return null;\n}\n\nexport default LoginNotifier;\n","import React, { useContext, useEffect, useMemo, useState } from 'react';\nimport {\n AuthConfigMap,\n AuthPluginAnonymous,\n AuthPluginParent,\n AuthPluginPsk,\n} from '@deephaven/auth-plugins';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useClient } from '@deephaven/jsapi-bootstrap';\nimport { getErrorMessage } from '@deephaven/utils';\nimport { PluginsContext } from './PluginsBootstrap';\nimport { getAuthPluginComponent } from '../plugins';\nimport LoginNotifier from './LoginNotifier';\n\nexport type AuthBootstrapProps = {\n /**\n * The children to render after authentication is completed.\n */\n children: React.ReactNode;\n};\n\n/** Core auth plugins that are always loaded */\nconst CORE_AUTH_PLUGINS = new Map([\n ['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk],\n ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent],\n ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous],\n]);\n\n/**\n * AuthBootstrap component. Handles displaying the auth plugin and authenticating.\n */\nexport function AuthBootstrap({ children }: AuthBootstrapProps) {\n const client = useClient();\n // `useContext` instead of `usePlugins` so that we don't have to wait for the plugins to load\n // We want to load the auth config values in parallel with the plugins\n const plugins = useContext(PluginsContext);\n const [authConfig, setAuthConfig] = useState<AuthConfigMap>();\n const [error, setError] = useState<unknown>();\n\n useEffect(\n function initAuthConfigValues() {\n let isCanceled = false;\n async function loadAuthConfigValues() {\n try {\n const newAuthConfigValues = await client.getAuthConfigValues();\n if (!isCanceled) {\n setAuthConfig(new Map(newAuthConfigValues));\n }\n } catch (e) {\n if (!isCanceled) {\n setError(e);\n }\n }\n }\n loadAuthConfigValues();\n return () => {\n isCanceled = true;\n };\n },\n [client]\n );\n\n const AuthComponent = useMemo(() => {\n if (plugins == null || authConfig == null) {\n return undefined;\n }\n\n try {\n return getAuthPluginComponent(plugins, authConfig, CORE_AUTH_PLUGINS);\n } catch (e) {\n setError(e);\n }\n }, [authConfig, plugins]);\n\n const isLoading = AuthComponent == null || authConfig == null;\n\n if (isLoading || error != null) {\n return (\n <LoadingOverlay\n isLoading={isLoading && error == null}\n errorMessage={getErrorMessage(error)}\n />\n );\n }\n return (\n <AuthComponent authConfigValues={authConfig}>\n <>\n <LoginNotifier />\n {children}\n </>\n </AuthComponent>\n );\n}\n\nexport default AuthBootstrap;\n","import { ConnectOptions } from '@deephaven/jsapi-types';\n\n/**\n * Get the base URL of the API\n * @param apiUrl API URL\n * @returns URL for the base of the API\n */\nexport function getBaseUrl(apiUrl: string): URL {\n return new URL(apiUrl, `${window.location}`);\n}\n\n/**\n * Get the Envoy prefix header value\n * @returns Envoy prefix header value\n */\nexport function getEnvoyPrefix(): string | null {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get('envoyPrefix');\n}\n\nexport function getConnectOptions(): ConnectOptions {\n const envoyPrefix = getEnvoyPrefix();\n return envoyPrefix != null\n ? { headers: { 'envoy-prefix': envoyPrefix } }\n : { headers: {} };\n}\n","import React, { useContext } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { FontsLoadedContext } from './FontBootstrap';\n\nexport type FontsLoadedProps = {\n /** Children to show when the fonts have completed loading */\n children: React.ReactNode;\n};\n\nexport function FontsLoaded({ children }: FontsLoadedProps) {\n const isFontsLoaded = useContext(FontsLoadedContext);\n\n if (!isFontsLoaded) {\n return <LoadingOverlay data-testid=\"fonts-loaded-loading\" />;\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default FontsLoaded;\n","import React, { useCallback, useMemo, useState } from 'react';\nimport '@deephaven/components/scss/BaseStyleSheet.scss';\nimport { ClientBootstrap } from '@deephaven/jsapi-bootstrap';\nimport {\n RefreshTokenBootstrap,\n useBroadcastLoginListener,\n} from '@deephaven/jsapi-components';\nimport FontBootstrap from './FontBootstrap';\nimport PluginsBootstrap from './PluginsBootstrap';\nimport AuthBootstrap from './AuthBootstrap';\nimport ConnectionBootstrap from './ConnectionBootstrap';\nimport { getConnectOptions } from '../utils';\nimport FontsLoaded from './FontsLoaded';\n\nexport type AppBootstrapProps = {\n /** URL of the server. */\n serverUrl: string;\n\n /** URL of the plugins to load. */\n pluginsUrl: string;\n\n /** Font class names to load. */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped when everything is loaded and authenticated.\n */\n children: React.ReactNode;\n};\n\n/**\n * AppBootstrap component. Handles loading the fonts, client, and authentication.\n * Will display the children when everything is loaded and authenticated.\n */\nexport function AppBootstrap({\n fontClassNames,\n pluginsUrl,\n serverUrl,\n children,\n}: AppBootstrapProps) {\n const clientOptions = useMemo(() => getConnectOptions(), []);\n\n // On logout, we reset the client and have user login again\n const [logoutCount, setLogoutCount] = useState(0);\n const onLogin = useCallback(() => undefined, []);\n const onLogout = useCallback(() => {\n setLogoutCount(value => value + 1);\n }, []);\n useBroadcastLoginListener(onLogin, onLogout);\n return (\n <FontBootstrap fontClassNames={fontClassNames}>\n <PluginsBootstrap pluginsUrl={pluginsUrl}>\n <ClientBootstrap\n serverUrl={serverUrl}\n options={clientOptions}\n key={logoutCount}\n >\n <RefreshTokenBootstrap>\n <AuthBootstrap>\n <ConnectionBootstrap>\n <FontsLoaded>{children}</FontsLoaded>\n </ConnectionBootstrap>\n </AuthBootstrap>\n </RefreshTokenBootstrap>\n </ClientBootstrap>\n </PluginsBootstrap>\n </FontBootstrap>\n );\n}\n\nexport default AppBootstrap;\n"],"names":["FontsLoadedContext","createContext","FontBootstrap","fontClassNames","children","isLoaded","setIsLoaded","useState","useEffect","jsxs","Fragment","jsx","className","LoginNotifier","channel","useBroadcastChannel","makeMessage","BROADCAST_LOGIN_MESSAGE","CORE_AUTH_PLUGINS","AuthPluginPsk","AuthPluginParent","AuthPluginAnonymous","AuthBootstrap","client","useClient","plugins","useContext","PluginsContext","authConfig","setAuthConfig","error","setError","isCanceled","loadAuthConfigValues","newAuthConfigValues","e","AuthComponent","useMemo","getAuthPluginComponent","isLoading","LoadingOverlay","getErrorMessage","getBaseUrl","apiUrl","getEnvoyPrefix","getConnectOptions","envoyPrefix","FontsLoaded","AppBootstrap","pluginsUrl","serverUrl","clientOptions","logoutCount","setLogoutCount","onLogin","useCallback","onLogout","value","useBroadcastLoginListener","PluginsBootstrap","ClientBootstrap","RefreshTokenBootstrap","ConnectionBootstrap"],"mappings":"waAGa,MAAAA,EAAqBC,gBAAuB,EAAK,EAkBvD,SAASC,EAAc,CAC5B,eAAAC,EAAiB,CAAC,oBAAqB,iBAAkB,WAAW,EACpE,SAAAC,CACF,EAAuB,CACrB,KAAM,CAACC,EAAUC,CAAW,EAAIC,WAAS,EAAK,EAC9CC,OAAAA,EAAA,UAAU,UAAqB,CACpB,SAAA,MAAM,MAAM,KAAK,IAAM,CAC9BF,EAAY,EAAI,CAAA,CACjB,CACH,EAAG,CAAE,CAAA,EAIDG,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACX,EAAmB,SAAnB,CAA4B,MAAOK,EACjC,SAAAD,EACH,EAUAO,EAAA,IAAC,MAAA,CACC,GAAG,gBACH,MAAO,CAAE,WAAY,SAAU,SAAU,WAAY,IAAK,IAAO,EAGhE,SAAAR,EAAe,IACdS,GAAAD,EAAA,IAAC,KAAkB,UAAAC,EAAsB,SAAA,SAAA,EAAjCA,CAER,CACD,CAAA,CACH,CACF,CAAA,CAAA,CAEJ,CCpDO,SAASC,GAAgB,CAC9B,MAAMC,EAAUC,IAChBP,OAAAA,EAAA,UACE,UAAuB,CACbM,EAAA,YAAYE,EAAYC,CAAuB,CAAC,CAC1D,EACA,CAACH,CAAO,CAAA,EAEH,IACT,CCMA,MAAMI,MAAwB,IAAI,CAChC,CAAC,wCAAyCC,CAAa,EACvD,CAAC,2CAA4CC,CAAgB,EAC7D,CAAC,8CAA+CC,CAAmB,CACrE,CAAC,EAKe,SAAAC,EAAc,CAAE,SAAAlB,GAAgC,CAC9D,MAAMmB,EAASC,IAGTC,EAAUC,aAAWC,CAAc,EACnC,CAACC,EAAYC,CAAa,EAAItB,EAAwB,SAAA,EACtD,CAACuB,EAAOC,CAAQ,EAAIxB,EAAkB,SAAA,EAE5CC,EAAA,UACE,UAAgC,CAC9B,IAAIwB,EAAa,GACjB,eAAeC,GAAuB,CAChC,GAAA,CACI,MAAAC,EAAsB,MAAMX,EAAO,sBACpCS,GACWH,EAAA,IAAI,IAAIK,CAAmB,CAAC,QAErCC,GACFH,GACHD,EAASI,CAAC,CAEd,CACF,CACqB,OAAAF,IACd,IAAM,CACED,EAAA,EAAA,CAEjB,EACA,CAACT,CAAM,CAAA,EAGH,MAAAa,EAAgBC,EAAAA,QAAQ,IAAM,CAC9B,GAAA,EAAAZ,GAAW,MAAQG,GAAc,MAIjC,GAAA,CACK,OAAAU,EAAuBb,EAASG,EAAYV,CAAiB,QAC7DiB,GACPJ,EAASI,CAAC,CACZ,CAAA,EACC,CAACP,EAAYH,CAAO,CAAC,EAElBc,EAAYH,GAAiB,MAAQR,GAAc,KAErD,OAAAW,GAAaT,GAAS,KAEtBnB,EAAA,IAAC6B,EAAA,CACC,UAAWD,GAAaT,GAAS,KACjC,aAAcW,EAAgBX,CAAK,CAAA,CAAA,EAKtCnB,EAAA,IAAAyB,EAAA,CAAc,iBAAkBR,EAC/B,SACEnB,EAAA,KAAAC,WAAA,CAAA,SAAA,CAAAC,EAAA,IAACE,EAAc,EAAA,EACdT,CAAA,CACH,CAAA,CACF,CAAA,CAEJ,CCrFO,SAASsC,EAAWC,EAAqB,CAC9C,OAAO,IAAI,IAAIA,EAAQ,GAAG,OAAO,UAAU,CAC7C,CAMO,SAASC,GAAgC,CAEvC,OADc,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC3C,IAAI,aAAa,CACvC,CAEO,SAASC,GAAoC,CAClD,MAAMC,EAAcF,IACpB,OAAOE,GAAe,KAClB,CAAE,QAAS,CAAE,eAAgBA,CAAY,GACzC,CAAE,QAAS,CAAA,EACjB,CChBgB,SAAAC,EAAY,CAAE,SAAA3C,GAA8B,CAG1D,OAFsBsB,aAAW1B,CAAkB,oBAOzC,SAAAI,CAAS,CAAA,EAJVO,EAAA,IAAC6B,EAAe,CAAA,cAAY,sBAAuB,CAAA,CAK9D,CCgBO,SAASQ,EAAa,CAC3B,eAAA7C,EACA,WAAA8C,EACA,UAAAC,EACA,SAAA9C,CACF,EAAsB,CACpB,MAAM+C,EAAgBd,EAAQ,QAAA,IAAMQ,EAAkB,EAAG,CAAE,CAAA,EAGrD,CAACO,EAAaC,CAAc,EAAI9C,WAAS,CAAC,EAC1C+C,EAAUC,EAAA,YAAY,IAAM,GAAW,CAAE,CAAA,EACzCC,EAAWD,EAAAA,YAAY,IAAM,CAClBF,EAAAI,GAASA,EAAQ,CAAC,CACnC,EAAG,CAAE,CAAA,EACL,OAAAC,EAA0BJ,EAASE,CAAQ,EAExC7C,EAAA,IAAAT,EAAA,CAAc,eAAAC,EACb,SAAAQ,EAAA,IAACgD,GAAiB,WAAAV,EAChB,SAAAtC,EAAA,IAACiD,EAAA,CACC,UAAAV,EACA,QAASC,EAGT,SAAAxC,EAAAA,IAACkD,EACC,CAAA,SAAAlD,EAAAA,IAACW,EACC,CAAA,SAAAX,EAAA,IAACmD,EACC,CAAA,SAAAnD,EAAA,IAACoC,EAAa,CAAA,SAAA3C,CAAA,CAAS,CACzB,CAAA,CACF,CAAA,EACF,CAAA,EARKgD,CAAA,CAUT,CAAA,CACF,CAAA,CAEJ"}
@@ -0,0 +1,5 @@
1
+ import{A as d,B as g,H as E,aC as Ps,C as c,D as ye,F as x,R as Cn,N as We,O as ee,G as z,Z as Te,aD as Ls,aE as js,a5 as $s,a6 as Vs,aF as Bs,a2 as gt,E as Sn,aG as Hs,aH as ke,aI as Us,aJ as Ks,aK as _s,aL as vn,aM as Ws,aN as qs}from"./vendor-4a7e2c7c.js";import{T as ce,g as B,aV as Gs,aW as zs,aX as Zs,aY as Xs,ad as Et,ah as xt,ae as Mn,aZ as yn,L as wt,ar as Qs,e as Js,a_ as Ys,a$ as ei,p as ti,ac as Tn,X as ni,a3 as si,m as ii,b0 as ai,c as In,V as oi,b1 as ri,q as Le,b2 as En,b3 as li}from"./index-32b27852.js";class ci extends d.Component{static propTypes={children:g.node.isRequired,options:g.shape({}),className:g.string,timeout:g.number,onEntered:g.func,onExited:g.func,isShown:g.bool,closeOnBlur:g.bool,interactive:g.bool,referenceObject:g.shape({}),"data-testid":g.string};static defaultProps={options:{},className:"",timeout:ce.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0};constructor(e){super(e),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=E.createRef(),this.rAF=0;const{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}element;container;rAF;getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){let{popper:e}=this.state;const{closeOnBlur:t,referenceObject:n}=this.props;if(e||this.container.current===null)return;let{options:s}=this.props;s={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...s},document.body.appendChild(this.element);let i=this.getVisibleElement(this.container.current);i==null&&(i=this.container.current),e=new Ps(n||i,this.element,s),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const o=this.element.firstElementChild;o instanceof HTMLElement&&o.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:n,interactive:s,closeOnBlur:i}=this.props,{show:o}=this.state;return c.jsx(ye,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:c.jsx("div",{onClick:r=>{r.stopPropagation()},onKeyDown:r=>{r.key==="Escape"&&this.hide()},className:x("popper",{interactive:s},e),onBlur:i?this.handleBlur:void 0,tabIndex:i?-1:void 0,role:"presentation",children:c.jsxs("div",{className:"popper-content",children:[t,c.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return c.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Cn.createPortal(this.renderContent(),this.element)})}}const De=ci,ui=Object.freeze(Object.defineProperty({__proto__:null,Log:B,LogHistory:Gs,LogProxy:zs,Logger:Zs,LoggerLevel:Xs,default:B},Symbol.toStringTag,{value:"Module"})),di=B.module("Tooltip");class X extends d.Component{static defaultTimeout=500;static defaultReshowTimeout=100;static triggerReshowThreshold=300;static shownTooltipCount=0;static lastHiddenTime=Date.now();static defaultProps={interactive:!1,options:{},popperClassName:"",reshowTimeout:X.defaultReshowTimeout,timeout:X.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0};static handleHidden(){X.shownTooltipCount-=1,X.shownTooltipCount===0&&(X.lastHiddenTime=Date.now())}static handleShown(){X.shownTooltipCount+=1}constructor(e){super(e),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=E.createRef(),this.popper=E.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:n}=t,{isShown:s}=this.state;s!==n&&(s?X.handleShown():X.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&X.handleHidden()}container;popper;parent;timer;startListening(){if(!this.container.current||!this.container.current.parentElement){di.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,n=e.clientY,{isShown:s}=this.state;if(!this.popper.current||!this.parent)return;const i=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=i.left&&t<=i.left+i.width&&n>=i.top&&n<=i.top+i.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():s&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let n=e;(X.shownTooltipCount>0||Date.now()-X.lastHiddenTime<X.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){const{isShown:e}=this.state;if(this.stopTimer(),!e){this.popper.current?.show(),this.setState({isShown:!0});const{interactive:t}=this.props;t&&this.startListeningWindow()}}hide(){this.popper.current?.hide(),this.stopListeningWindow()}update(){this.popper.current?.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:n,popperClassName:s,"data-testid":i,onEntered:o}=this.props,{isShown:r}=this.state;let{options:l}=this.props;return l={placement:"bottom",...l},c.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":i,children:c.jsx(De,{className:x(s),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:c.jsxs("div",{className:"tooltip-content",children:[" ",r&&t]})})})}}const Nt=X;const hi=100;var xn=(a=>(a.UP="UP",a.DOWN="DOWN",a))(xn||{});class me extends d.Component{static 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};static defaultProps={onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0};static MENU_NAVIGATION_DIRECTION=xn;constructor(e){super(e);let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=We(this.updateInputValue,hi),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=E.createRef(),this.cbContainer=E.createRef(),this.menuContainer=E.createRef(),this.input=E.createRef()}popper;cbContainer;menuContainer;input;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=ee((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0));getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,n=t.filter(s=>s.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:n,isValid:s}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,s)}fireOnChange(e,t=!0){const{onChange:n}=this.props;n(e,t)}processFilterChange(e){const{options:t}=this.props,{menuIsOpen:n}=this.state,s=e?this.getCachedFilteredOptions(t,e):t,i=s.length===1&&s[0].title===e;if(this.setState({filteredOptions:s,keyboardOptionIndex:0}),i&&n){this.closeMenu();return}this.popper.current?.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state,s=t[n];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s!=null&&(this.setState({title:s.title,invalid:!1}),this.fireOnChange(s.value)),this.closeMenu(),this.input.current?.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(me.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:n}=this.state;let s=n;e===me.MENU_NAVIGATION_DIRECTION.UP?n>0?(s=(s-1)%t.length,this.setState({keyboardOptionIndex:s})):n===0&&(s=t.length-1,this.setState({keyboardOptionIndex:s})):e===me.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(s=(s+1)%t.length,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),this.input.current?.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.input.current?.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(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&this.input.current?.focus(),this.popper.current?.hide()}scrollOptionIntoView(e){this.menuContainer.current&&this.menuContainer.current.children.item(e)?.scrollIntoView({behavior:"smooth",block:"nearest"})}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:x("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:n}=this.state;return t&&n.length===0?c.jsx("div",{className:"no-match",children:e}):n.map((s,i)=>this.renderOption(s,i))}renderOption(e,t){const{keyboardOptionIndex:n}=this.state,s=`option-${t}-${e.value}`;return c.jsx("button",{type:"button",className:x("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},s)}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultTitle:i,spellCheck:o,"data-testid":r}=this.props,{title:l,menuIsOpen:u,popperOptions:h,invalid:p}=this.state;return c.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:x("form-control",s,"aci-input",{"is-invalid":p&&!u}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r}),c.jsx(De,{ref:this.popper,options:h,className:x("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}const pi=me;function kt({className:a="",value:e,onChange:t,spellCheck:n=!1,placeholder:s="",disabled:i=!1,delimiter:o="",id:r="","data-testid":l}){const[u,h]=d.useState(e),[p,m]=d.useState(!1),f=d.useRef(null);d.useEffect(function(){h(e)},[e]);function v(A){return A.trim().split(o).filter(L=>L).join(`
2
+ ${o.trim()}`)}function S(A){return A.split(`
3
+ `).map(L=>L.trim()).join(" ")}function C(){if(!f.current)return;f.current.style.height="0";const A=f.current.scrollHeight+(f.current.offsetHeight-f.current.clientHeight);A>0&&(f.current.style.height=`${A}px`)}function w(A){let L=A.target.value;p&&(o&&(L=v(L)),m(!1)),h(L),t(L)}function O(){f.current&&(o&&(h(v(u)),C()),f.current.scrollLeft=0)}function M(){f.current&&document.activeElement!==f.current&&f.current.focus()}function F(){o&&(h(S(u)),t(S(u)))}function P(){m(!0)}return d.useEffect(function(){C()},[u]),c.jsx("textarea",{ref:f,id:r,className:x(a,"auto-resize-textarea form-control"),placeholder:s,value:u,rows:1,onChange:w,onFocus:O,onMouseDown:M,onBlur:F,onPaste:P,spellCheck:n,disabled:i,"data-testid":l})}kt.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};kt.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function je(a){const{children:e,className:t,style:n,"data-testid":s}=a;return c.jsx("div",{className:x("btn-group",t),style:n,role:"group","data-testid":s,children:e})}je.displayName="ButtonGroup";je.propTypes={children:g.node.isRequired,className:g.string,style:g.object,"data-testid":g.string};je.defaultProps={className:null,style:{},"data-testid":void 0};const mi=["primary","secondary","tertiary","success","danger","inline","ghost"],fi=["group-end"];function gi(a,e){switch(a){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return x("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function bi(a){switch(a){case"group-end":return x("pl-2","pr-3")}}const Je=E.forwardRef((a,e)=>{const{kind:t,variant:n,type:s,tooltip:i,icon:o,disabled:r=!1,active:l,onClick:u,onContextMenu:h,onMouseDown:p,onMouseUp:m,onMouseEnter:f,onMouseLeave:v,onKeyDown:S,className:C,style:w,children:O,tabIndex:M,"data-testid":F,"aria-label":P}=a,A=Boolean(o&&O==null),L=gi(t,A);let W;n&&(W=bi(n));let oe;o&&(oe=E.isValidElement(o)?o:c.jsx(z,{icon:o}));let $;i!==void 0&&($=typeof i=="string"?c.jsx(Nt,{children:i}):i);let j=P;P===void 0&&A&&i!=null&&typeof i=="string"&&(j=i);const U=c.jsxs("button",{"data-testid":F,ref:e,type:s,className:x("btn",L,W,{active:l},C),onClick:u,onContextMenu:h,onMouseUp:m,onMouseDown:p,onMouseEnter:f,onMouseLeave:v,onKeyDown:S,style:w,disabled:r,tabIndex:M,"aria-label":j,children:[o&&oe,O,i!=null&&!r&&$]});return r?c.jsxs("span",{className:"btn-disabled-wrapper",children:[U,i!==void 0&&$]}):U});Je.displayName="Button";Je.propTypes={kind:g.oneOf(mi).isRequired,variant:g.oneOf(fi),type:g.oneOf(["submit","reset","button"]),tooltip(a){const{tooltip:e,icon:t,children:n}=a;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(a){const{children:e,icon:t}=a;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!E.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:g.bool,active:g.bool,onClick(a){const{onClick:e,type:t}=a;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:g.func,onMouseUp:g.func,onMouseDown:g.func,onMouseEnter:g.func,onMouseLeave:g.func,onKeyDown:g.func,tabIndex:g.number,children:g.node,className:g.string,style:g.object,"data-testid":g.string};Je.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const te=Je;function $e(a,e="No value available in context. Was code wrapped in a provider?"){const t=d.useContext(a);if(t==null)throw new Error(e);return t}function wn(a){const e=d.useRef();return d.useEffect(function(){e.current=a}),e.current}function Dt(a){const e=d.useRef(null);return d.useEffect(function(){a&&(typeof a=="function"?a(e.current):a.current=e.current)}),e}const fr=Object.freeze([]),gr=new Map,Ci=()=>{};class Si extends Error{isCanceled=!0}const bt=Si;async function vi(a){const{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(a)}catch{return Xt(a)}Xt(a)}function Xt(a){const e=document.activeElement,t=document.createElement("textarea");t.value=a,document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}class Nn extends CustomEvent{constructor(e,t){super(e,t)}}class Mi extends Error{isTimeout=!0}const Ye=Mi;class Pe{static makeCancelable(e,t){let n=!1,s,i;const o=new Promise((r,l)=>{i=l,Promise.resolve(e).then(u=>{n?t&&t(u):(s=u,r(u))}).catch(u=>l(u))});return o.cancel=()=>{n=!0,i(new bt),s!=null&&t&&t(s)},o}static isCanceled(e){return e instanceof bt}static isTimedOut(e){return e instanceof Ye}static withTimeout(e,t){return new Promise((n,s)=>{setTimeout(()=>{try{n(t())}catch(i){s(i)}},e)})}}function yi(a){if(a==null)throw new Error("Value is null or undefined")}function br(a,e,t=void 0){const n=a.get(e)??t;if(n!==void 0)return n;throw new Error(`Missing value for key ${e}`)}function qe(a){let e=a;a instanceof CustomEvent&&(e=a.detail);let t="";if(e instanceof Error?t=e.message:e!=null&&(t=`${e}`),t=t.trim(),t.length>0)return t}class Ot{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!Ot.isValidRange(e))throw new Error(`Invalid range! ${e}`)}static isSelected(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],i=s[0],o=s[1];if(i<=t&&t<=o)return!0}return!1}static selectRange(e,t){let[n,s]=t;const i=[...e];for(let o=i.length-1;o>=0;o-=1){const r=i[o],l=r[0],u=r[1];if(l<=n&&s<=u)return i;n<=u&&l<=s&&(n=Math.min(n,l),s=Math.max(s,u),i.splice(o,1))}return i.push([n,s]),i}static deselectRange(e,t){const[n,s]=t,i=[...e];for(let o=i.length-1;o>=0;o-=1){const r=i[o],l=r[0],u=r[1];if(!(s<l||u<n))if(l<n&&s<u){i[o]=[l,n-1],i.splice(o+1,0,[s+1,u]);break}else n<=l&&u<=s?i.splice(o,1):l<n?i[o]=[l,n-1]:i[o]=[s+1,u]}return i}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,s)=>{const i=[...n];for(let o=s[0];o<=s[1];o+=1)i.push(e[o]);return i},[])}}const le=Ot;class Ti{static join(e,t="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${t} ${e[1]}`;const n=e.slice(0,e.length-1).join(", "),s=e[e.length-1];return`${n}, ${t} ${s}`}static toLower(e,t=!0){if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t,n=!0){return e<t?n?-1:1:e>t?n?1:-1:0}}const Ii=Ti;class At{static TIME_PATTERN="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]";static TIME_ZONES=Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]);static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return`${t>0?`${t}h `:""}${n>0||t>0?`${n}m `:""}${e>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error(`${e} is not a number that can be expressed as a formatted time`);const t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),s=String(Math.floor(n/60)).padStart(2,"0"),i=n%60,o=String(Math.ceil(i)).padStart(2,"0");return`${t}:${s}:${o}`}static isTimeString(e){return new RegExp(At.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error(`${e} is not a valid string`);const t=e.split(":");if(t.length!==3)throw new Error(`${e} is not a time string that can be parsed`);return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}const Ae=At,Ei=3500,xi=B.module("useCopyToClipboard");function kn(){const[a,e]=d.useState(!1),t=d.useRef(null),n=d.useCallback(s=>{vi(s).then(()=>{e(!0)}).catch(i=>xi.error(`Unable to copy ${s}`,`
4
+ `,i))},[]);return d.useEffect(()=>(t.current&&clearTimeout(t.current),a&&(t.current=setTimeout(()=>{e(!1)},Ei)),()=>{t.current&&clearTimeout(t.current)}),[a]),[a,n]}function Dn(a,e,{autoLoad:t=!0}={}){const[n,s]=d.useState(null),[i,o]=d.useState(null),[r,l]=d.useState(!1),u=d.useCallback(async()=>{l(!0);try{const h=await a(...e);s(h),o(null)}catch(h){s(null),o(h)}finally{l(!1)}},[a,...e]);return d.useEffect(()=>{t&&u()},[t,u]),{data:n,error:i,isError:i!=null,isLoading:r,reload:u}}function On(a,e){const[t,n]=d.useState(a);return d.useEffect(()=>{const s=setTimeout(()=>{n(a)},e);return()=>{clearTimeout(s)}},[a,e]),t}const wi=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:$e,useCopyToClipboard:kn,useDebouncedValue:On,useForwardedRef:Dt,usePrevious:wn,usePromiseFactory:Dn},Symbol.toStringTag,{value:"Module"}));function Ni({blockInteraction:a=!0,children:e,debounceMs:t,isOpen:n=!1}){const s=On(n,t);return c.jsxs(c.Fragment,{children:[a&&n&&c.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),E.cloneElement(e,{isOpen:n&&s})]})}function ki({className:a,icon:e,isOpen:t=!1,subtitle:n,title:s}){return c.jsx(Et,{isOpen:t,className:a,children:c.jsx(xt,{children:c.jsxs("div",{className:"info-modal",children:[e!=null&&c.jsx("div",{className:"message-icon",children:c.jsx(z,{icon:e})}),c.jsx("div",{className:"message-header",children:s}),n!=null&&c.jsx("div",{className:"message-content",children:n})]})})})}function An({className:a="modal-footer",children:e,"data-testid":t}){return c.jsx("div",{className:a,"data-testid":t,children:e})}function Ft(a){const{isOpen:e,headerText:t,bodyText:n,onCancel:s,onConfirm:i,onDiscard:o,onModalDisable:r,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:h="Discard",isConfirmDanger:p=!1,children:m,"data-testid":f}=a,v=d.useRef(null),S=d.useRef(null),C=d.useCallback(()=>{S.current!==null&&S.current.checked&&r&&r(),i()},[i,r]),w=d.useCallback(()=>{v.current?.focus()},[]);let O="";return e&&(O=typeof n=="function"?n():n),c.jsxs(Et,{isOpen:e,className:"theme-bg-light",onOpened:w,children:[c.jsx(Mn,{closeButton:!1,children:t}),c.jsx(xt,{children:O}),c.jsxs(An,{children:[r&&c.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[c.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:S,"data-testid":f!==void 0?`${f}-checkbox-confirm`:void 0}),c.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&c.jsx(te,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":f!==void 0?`${f}-btn-discard`:void 0,children:h}),s&&c.jsx(te,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":f!==void 0?`${f}-btn-cancel`:void 0,children:l}),c.jsxs(je,{children:[c.jsx(te,{kind:p?"danger":"primary",onClick:C,ref:v,"data-testid":f!==void 0?`${f}-btn-confirm`:void 0,children:u}),m]})]})]})}Ft.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};Ft.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const et=E.forwardRef((a,e)=>{const{children:t,className:n,disabled:s,onClick:i,style:o,id:r}=a;return c.jsx("button",{ref:e,type:"button",className:x("btn",n),onClick:i,style:o,disabled:s,id:r,children:t})});et.displayName="Button";et.propTypes={children:g.node,className:g.string,disabled:g.bool,onClick:g.func,style:g.shape({}),id:g.string};et.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Di=et;function Oi({className:a,isFlipped:e,children:t,"data-testid":n}){const s=l=>{if(t.length!==2)throw new Error("CardFlip requires 2 children to function");return t[l]},i=d.useRef(null),o=d.useCallback(l=>{l.target===l.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),r=d.useCallback(l=>{l.target===l.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return d.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",o);const u=i.current;return function(){if(u!=null)return u.removeEventListener("transitionstart",o)}},[o]),c.jsxs("div",{className:x(a,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":n,children:[c.jsx("div",{className:"card-flip--back",children:s(0)}),c.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:r,children:s(1)})]})}function dt(a){return a.then!==void 0}class Me{static actionsDisabled=!1;static disableAllActions(){Me.actionsDisabled=!0}static enableAllActions(){Me.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){return e.group!==t.group?(e.group??0)>(t.group??0)?1:-1:e.order!==t.order?(e.order??0)>(t.order??0)?1:-1:e.title!==t.title?(e.title??"")>(t.title??"")?1:-1:e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];const t=e.slice();return t.sort(Me.compareActions),t}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Me.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=Me.getModifierKey();return e[t]}static getMenuItems(e,t=!0){let n=[],s=e;Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i+=1){const o=s[i];let r;typeof o=="function"?r=o():r=o,r!=null&&(r instanceof Promise?t&&n.push(r):Array.isArray(r)?n=n.concat(r):n.push(r))}return n=n.filter(i=>i.title!==void 0||i.then!=null||i.menuElement),n}static getNextMenuItem(e,t,n){let s=e;s<0&&t<0&&(s=n.length);for(let i=1;i<n.length+1;i+=1){const o=(s+t*i+n.length)%n.length,r=n[o];if(!(r instanceof Promise)&&r.disabled!==!0)return o}return e}}const K=Me,Qt=B.module("GlobalContextAction");class Ai extends d.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){const t=e;t.contextActions==null&&(t.contextActions=[]);const{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),Qt.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){const{action:t}=this.props;!K.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)&&(Qt.debug("Global hotkey matched!",e),t.action?.(e),e.preventDefault(),e.stopPropagation())}render(){return null}}const Fi=Ai;class Ri extends d.Component{render(){const{actions:e,"data-testid":t}=this.props,n=[];for(let s=0;s<e.length;s+=1){const i=e[s],{shortcut:o}=i;if(i.title!=null||i.menuElement||o){const r=c.jsx(Fi,{action:i,"data-testid":t},`${i.title}.${o?.id}`);n.push(r)}}return n}}const Pi=Ri;const Be=B.module("ContextActions");class Li extends d.Component{static groups={default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100};static triggerMenu(e,t,n,s){if(s.length===0)return;const i=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});i.contextActions=s,e.dispatchEvent(i)}constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=E.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(s=>!dt(s)&&typeof s!="function"&&s.isGlobal),n=e.actions.filter(s=>!dt(s)&&typeof s!="function"&&(s.isGlobal===void 0||!s.isGlobal)&&s.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){this.container.current?.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){this.container.current?.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}container;handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let s=e.target;for(;s!=null;){const{classList:i}=s,o=t.find(r=>i.contains(r));if(o!==void 0){Be.debug2(`Contextmenu event ignored based on the target className "${o}"`);return}s=s.parentElement}}if(K.isContextActionEvent(e)||(e.contextActions=[]),!K.isContextActionEvent(e))return;const{actions:n}=this.props;if(n!=null){let s=n;Array.isArray(s)&&(s=s.filter(i=>dt(i)||typeof i=="function"||i.isGlobal===void 0||!i.isGlobal)),e.contextActions=e.contextActions.concat(s)}Be.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){const{keyboardActions:t}=this.state;for(let n=0;n<t.length;n+=1){const s=t[n];!K.actionsDisabled&&s.shortcut!=null&&s.shortcut.matchesEvent(e)&&(Be.debug("Context hotkey matched!",e),s.action?.(e),e.stopPropagation(),e.preventDefault(),Be.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return c.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:c.jsx(Pi,{actions:t})})}}const ji=Li,Rt=E.forwardRef((a,e)=>{function t(C){const{menuItem:w,onMenuItemClick:O}=a;O(w,C)}function n(C){const{menuItem:w,onMenuItemMouseMove:O}=a;O(w,C)}function s(C){const{menuItem:w,onMenuItemContextMenu:O}=a;O(w,C)}function i(C,w,O){if(typeof C.type=="string")return C;const{closeMenu:M,menuItem:F,isKeyboardSelected:P,isMouseSelected:A,"data-testid":L}=a,W={menuItem:F,closeMenu:M,isKeyboardSelected:P,isMouseSelected:A,iconElement:w,displayShortcut:O,"data-testid":L};return E.cloneElement(C,{forwardedProps:W})}const{children:o,menuItem:r,isKeyboardSelected:l=!1,isMouseSelected:u=!1,"data-testid":h}=a,p=r.shortcut?.getDisplayText();let m=null;if(r.icon){const C=r.icon;if(E.isValidElement(C))m=C;else{let w;r.iconColor!=null&&(r.disabled===void 0||!r.disabled)&&(w={color:r.iconColor}),m=c.jsx(z,{icon:C,style:w})}}let f=null;const v=Boolean(o);r.actions&&(f=c.jsx(z,{icon:yn}));let S=null;if(r.menuElement)S=c.jsx("div",{className:"custom-menu-item",onMouseMove:n,children:i(r.menuElement,m,p)});else{const C=r.disabled,w=r.iconOutline;S=c.jsx("button",{type:"button",className:x("btn-context-menu",{disabled:C},{active:(v||u)&&(C===void 0||!C)},{"keyboard-active":l&&(C===void 0||!C)}),onClick:t,onMouseMove:n,onContextMenu:s,title:r.description??"",children:c.jsxs("div",{className:"btn-context-menu-wrapper",children:[c.jsx("span",{className:x("icon",{outline:w}),children:m}),c.jsx("span",{className:"title",children:r.title}),p!==void 0&&c.jsx("span",{className:"shortcut",children:p}),f&&c.jsx("span",{className:x("submenu-indicator",{disabled:C}),children:f})]})})}return c.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":h,children:[o,S]})});Rt.displayName="ContextMenuItem";Rt.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Pt=Rt,Jt=B.module("ContextMenu");class Ge extends d.PureComponent{static defaultProps={subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=E.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=E.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e,t){const{actions:n}=this.props,{activeSubMenu:s}=this.state;s!==t.activeSubMenu&&(s==null?this.container.current?.focus():this.setActiveSubMenuPosition()),e.actions!==n&&(this.initMenu(),(this.container.current==null||!this.container.current.contains(document.activeElement))&&this.container.current?.focus()),this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),cancelAnimationFrame(this.rAF)}container;oldFocus;activeSubMenuRef;subMenuTimer;rAF;initialPosition;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){this.cancelPromises(),cancelAnimationFrame(this.rAF);const{options:e}=this.props;let t=e.initialKeyboardIndex;t===void 0&&(t=-1);const{actions:n}=this.props,s=K.getMenuItems(n),i=[];for(let o=s.length-1;o>=0;o-=1){const r=s[o];r instanceof Promise?this.initMenuPromise(r):i.push(r)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:K.sortActions(i)})}initMenuPromise(e){const t=Pe.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{menuItems:K.sortActions(s.menuItems.concat(n)),pendingItems:o}}return null})},n=>{Pe.isCanceled(n)||(this.setState(s=>{const i=s.pendingItems.indexOf(t);if(i>=0){const o=s.pendingItems.slice();return o.splice(i,1),{pendingItems:o}}return null}),Jt.error(n))})}cancelPromises(){const{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current===null)return;const e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}verifyPosition(){const{options:e,updatePosition:t,subMenuParentWidth:n,subMenuParentHeight:s,top:i,left:o}=this.props;if(!this.container.current||e.doNotVerifyPosition!=null&&e.doNotVerifyPosition)return;let{top:r,left:l}=this.initialPosition;const{width:u,height:h}=this.container.current?.getBoundingClientRect()??{width:0,height:0},p=(this.container.current?.scrollHeight??0)>window.innerHeight;h===0||u===0||(r+h>window.innerHeight&&(r-h-s>0?r-=h-s:r=window.innerHeight-h),l+u>window.innerWidth&&(l=l-u-n),(o!==l||i!==r)&&(this.setState({hasOverflow:p}),t(r,l)))}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){Jt.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){let t=e.relatedTarget,n=!1;for(;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){const{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n,i=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?i=!0:s=0:this.isEscapeKey(e.key)?s=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?s=K.getNextMenuItem(s,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(s=K.getNextMenuItem(s,1,t)),i){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){const{menuItems:t,activeSubMenu:n}=this.state,s=t[e].actions?e:null;n!==s&&this.setState({activeSubMenu:s,subMenuTop:null,subMenuLeft:null})}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();const{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{top:t,left:n}=this.props,{activeSubMenu:s,hasOverflow:i,keyboardIndex:o,menuItems:r,mouseIndex:l,pendingItems:u,subMenuTop:h,subMenuLeft:p,subMenuParentWidth:m,subMenuParentHeight:f}=this.state;for(let O=0;O<r.length;O+=1){const M=r[O];O>0&&M.group!==r[O-1].group&&e.push(c.jsx("hr",{},`${O}.separator`));const F=c.jsx(Pt,{ref:s===O?this.activeSubMenuRef:null,isKeyboardSelected:o===O,isMouseSelected:l===O,menuItem:M,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},O);e.push(F)}let v=null;u.length>0&&(v=c.jsx("div",{className:"loading",children:c.jsx(wt,{})}));const{menuStyle:S,"data-testid":C}=this.props,w=s!==null&&h!==null&&p!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:x({"has-overflow":i},"context-menu-container"),style:{top:t,left:n,...S},ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Ge.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":C,children:[e,v]}),w&&s!==null&&h!==null&&p!==null&&c.jsx(Ge,{actions:r[s].actions||[],closeMenu:this.handleCloseSubMenu,top:h,left:p,updatePosition:(O,M)=>{this.setState({subMenuTop:O,subMenuLeft:M})},subMenuParentWidth:m,subMenuParentHeight:f},`sub-${s}`)]})}}const $i=Ge;class Vi extends d.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=E.createRef(),this.openMenu=E.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}container;openMenu;handleContextMenu(e){if(!K.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const t=K.getMenuItems(e.contextActions),n=this.container.current.getBoundingClientRect(),s=e.clientY-n.top,i=e.clientX-n.left;if(t.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const o=document.elementFromPoint(i,s),r=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});o?.dispatchEvent(r)});return}return}e.preventDefault(),this.setState({actions:t,top:s,left:i})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":t}=this.props,{actions:n,top:s,left:i}=this.state;return n&&(e=c.jsx($i,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:s,left:i,updatePosition:(o,r)=>{this.setState({top:o,left:r})},"data-testid":t})),c.jsx("div",{className:x("context-menu-root",{active:n}),ref:this.container,children:e})}}const Bi=Vi;class fe extends d.Component{static propTypes={className:g.string,in:g.bool.isRequired,children:g.node.isRequired,autoFocusOnShow:g.bool,"data-testid":g.string};static defaultProps={className:"",autoFocusOnShow:!1,"data-testid":void 0};static handleEnter(e){const t=e;t.style.height="0"}static handleEntering(e){const t=e;t.style.height=`${fe.getHeight(t)}px`}static handleExiting(e){const t=e;t.style.height="0"}static handleExit(e){const t=e;t.style.height=`${fe.getHeight(t)}px`}static getHeight(e){const t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){const t=e;t.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const s=t.querySelector("input, select, textarea");s?.focus()}}render(){const{children:e,className:t,in:n,"data-testid":s}=this.props;return c.jsx(ye,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:fe.handleEnter,onEntering:fe.handleEntering,onEntered:this.handleEntered,onExit:fe.handleExit,onExiting:fe.handleExiting,timeout:350,children:i=>c.jsx("div",{className:x({collapse:i==="exited"},t),"data-testid":s,children:e})})}}const Hi=fe,tt=E.forwardRef((a,e)=>{const{checked:t=!1,children:n,className:s,disabled:i,inputClassName:o,isInvalid:r,labelClassName:l,name:u,onChange:h,"data-testid":p}=a,[m]=d.useState(Te()),f=Dt(e);d.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);const v=d.useCallback(S=>{f.current&&(f.current.indeterminate=t===null),h&&h(S)},[f,t,h]);return c.jsxs("div",{className:x("custom-control custom-checkbox",s),children:[c.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:x("custom-control-input",o,{"is-invalid":r}),disabled:i,id:m,name:u,onChange:v,"data-testid":p}),c.jsx("label",{className:x("custom-control-label",l),htmlFor:m,children:n})]})});tt.displayName="Checkbox";tt.propTypes={checked:(a,e)=>{const{[e]:t}=a;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:g.node.isRequired,className:g.string,disabled:g.bool,inputClassName:g.string,isInvalid:g.bool,labelClassName:g.string,name:g.string,onChange:g.func,"data-testid":g.string};tt.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ze=tt;class Ui extends d.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0};constructor(e){super(e),this.inputField=E.createRef()}inputField;focus(){this.inputField.current?.focus()}render(){const{value:e,placeholder:t,onBlur:n,onChange:s,className:i,disabled:o,matchCount:r,id:l,onKeyDown:u,"data-testid":h}=this.props;return c.jsxs("div",{className:x("search-group",i),children:[c.jsx("input",{type:"search",value:e,onBlur:n,onChange:s,onKeyDown:u,className:"form-control",disabled:o,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),r!=null&&c.jsx("span",{className:"search-match",children:r}),c.jsx("span",{className:"search-icon",children:c.jsx(z,{icon:Qs})})]})}}const nt=Ui;var Fn=(a=>(a.UP="UP",a.DOWN="DOWN",a))(Fn||{});class xe extends d.Component{static MENU_NAVIGATION_DIRECTION=Fn;static DROP_DOWN_MENU_HEIGHT=200;static propTypes={options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({title:g.string.isRequired,value:g.string.isRequired}),onChange:g.func,inputPlaceholder:g.string,searchPlaceholder:g.string,disabled:g.bool,className:g.string,defaultValue:g.string,spellCheck:g.bool,onEnter:g.func,"data-testid":g.string};static defaultProps={onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0};constructor(e){super(e),this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=E.createRef(),this.cbContainer=E.createRef(),this.toggleButton=E.createRef(),this.menuContainer=E.createRef(),this.input=E.createRef(),this.searchInput=E.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}popper;cbContainer;toggleButton;menuContainer;input;searchInput;setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getCachedFilteredOptions=ee((e,t)=>e.filter(n=>n.title.toLowerCase().indexOf(t.toLowerCase())>=0||n.value.toLowerCase().indexOf(t.toLowerCase())>=0));focus(){this.input.current?.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,o=t?n:i;switch(e.key){case"Enter":o[s]?.value!=null&&this.updateInputValue(o[s].value),this.closeMenu(),this.input.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(xe.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(xe.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&s===o.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:n,keyboardOptionIndex:s}=this.state,{options:i}=this.props,r=(t?n:i).length;let l=0;switch(e){case xe.MENU_NAVIGATION_DIRECTION.UP:l=-1;break;case xe.MENU_NAVIGATION_DIRECTION.DOWN:l=1;break}l!==0&&this.setState({keyboardOptionIndex:(s+l+r)%r})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:n}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?n||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){const t=Number(e.currentTarget.value),{filter:n,filteredOptions:s}=this.state,{options:i}=this.props,o=n?s:i;this.updateInputValue(o[t].value),this.closeMenu(),this.input.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){const{options:t}=this.props,n=e.target.value,s=this.getCachedFilteredOptions(t,n);this.setState({filter:n,filteredOptions:s,keyboardOptionIndex:0}),this.popper.current?.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){this.scrollOptionIntoView(),this.searchInput.current?.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),this.popper.current?.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{this.popper.current?.show()})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.input.current?.focus(),this.popper.current?.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:n}=this.state,{options:s}=this.props,o=(t?n:s).findIndex(r=>r.value===e);this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(){const e=this.menuContainer.current?.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:n}=this.state;return c.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:s=>{s.stopPropagation()},style:{width:n},onBlur:this.handleMenuBlur,children:[c.jsx("div",{className:"cb-search-input-container",children:c.jsx(nt,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),c.jsx("div",{className:"cb-options-container",children:c.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:n,filteredOptions:s}=this.state;return(n?s:e).map((o,r)=>{const l=`option-${r}-${o.value}`;return c.jsx("button",{type:"button",value:r,className:x("cb-option-btn",{"keyboard-active":t===r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:o.title},l)})}render(){const{options:e,inputPlaceholder:t,disabled:n,className:s,defaultValue:i,spellCheck:o,"data-testid":r}=this.props,{value:l}=this.state;let{popperOptions:u}=this.props;return u={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...u},c.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[c.jsx("input",{value:l||i,className:x("form-control",s,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:n,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":r!==void 0?`${r}-input`:void 0}),c.jsx("div",{className:"input-group-append cb-dropdown",children:c.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:n,"data-testid":r!==void 0?`${r}-btn`:void 0,children:[c.jsx(z,{icon:Js}),c.jsx(De,{ref:this.popper,options:u,className:x("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}}const Ki=xe;function _i({copy:a,kind:e="ghost",tooltip:t="Copy",className:n,"data-testid":s,children:i}){const[o,r]=kn();return c.jsx(te,{kind:e,className:n,"data-testid":s,icon:o?Ys:ei,tooltip:o?"Copied":t,onClick:()=>{r(typeof a=="function"?a():a)},children:i})}function st(a,e,t){return a.substring(0,e)+t+a.substring(e+1)}function Rn(a,e,t){return a.length<t?`${a}${e.substring(a.length,t)}`:a}function Ct(a,e){let{length:t}=a;for(let n=a.length-1;n>=0&&e[n]===a[n];n-=1)t=n;return a.substring(0,t)}const ie=B.module("MaskedInput"),Ie={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},He=" ",Pn=E.forwardRef((a,e)=>{const{className:t,example:n,getNextSegmentValue:s=(k,D,y)=>y,getPreferredReplacementString:i=st,onChange:o=()=>!1,onSelect:r=()=>!1,onSubmit:l,pattern:u,placeholder:h,selection:p,value:m,onFocus:f=()=>!1,onBlur:v=()=>!1,"data-testid":S}=a,C=Dt(e),w=d.useMemo(()=>Array.isArray(n)?n:[n],[n]),O=d.useMemo(()=>w[0].replace(/[a-zA-Z0-9]/g,He),[w]);d.useEffect(function(){if(p!=null){ie.debug("setting selection...",p);const{selectionStart:D,selectionEnd:y,selectionDirection:V}=p;C.current?.setSelectionRange(D,y,V),ie.debug("selection set!")}},[p,C]);const M=d.useCallback(k=>{let D=k,y=k;const V=w.length>0?w[0]:m;for(let I=D-1;I>=0&&/[a-zA-Z0-9]/g.test(V.charAt(I));I-=1)D=I;for(let I=y;I<V.length&&/[a-zA-Z0-9]/g.test(V.charAt(I));I+=1)y=I+1;const R=D===y?Ie.NONE:Ie.BACKWARD;return{selectionStart:D,selectionEnd:y,selectionDirection:R}},[w,m]);function F(k,D,y=k.length){let V="";for(let R=0;R<y;R+=1)k.charAt(R)!==He?V=V.concat(k[R]):V=V.concat(D[R]);return V=V.concat(D.substring(y)),V}function P(k,D=k.length){const y=new RegExp(`^${u}$`);if(y.test(k))return!0;for(let V=0;V<w.length;V+=1){const R=F(k,w[V],D);if(y.test(R))return!0}return!1}function A(k){const D=M(k),y=D.selectionEnd+1;return y>=m.length?D:M(y)}function L(k){const D=M(k),y=D.selectionStart-1;return y<=0?D:M(y)}function W(k,D){const y=M(k),V=m.substring(y.selectionStart,y.selectionEnd),R=s(y,D,V,m),I=m.substring(0,y.selectionStart)+R+m.substring(y.selectionEnd);P(I,y.selectionEnd)&&(o(I),r(y))}const oe=d.useCallback(k=>{const{selectionStart:D=0,selectionEnd:y=0,selectionDirection:V="none"}=k.target;if(D===null||y===null||V===null){ie.error("Selection attempted on non-text input element",k.target);return}if(ie.debug2("handleSelect",D,y,V),!(p!=null&&D===p.selectionStart&&y===p.selectionEnd)){if(p!=null&&D===m.length&&y===m.length&&k.nativeEvent.type!=="mouseup"){r({...p});return}if(D===y){const R=M(D);ie.debug("Selection segment from ",D,y,"=>",R),r(R)}else r({selectionStart:D,selectionEnd:y,selectionDirection:V})}},[M,r,p,m]),$=d.useCallback(k=>{if(!C.current)return;ie.debug("handleSelectCapture",k);const D=C.current.selectionStart??0;D===m.length&&p!=null&&D!==p.selectionStart&&(k.preventDefault(),k.stopPropagation())},[C,p,m]);function j(k){if(k.preventDefault(),k.stopPropagation(),!C.current)return;const{key:D}=k,{selectionStart:y=0,selectionEnd:V=0}=C.current;if(y===null||V===null){ie.error("Selection arrow nvaigation attempted on non-text input element",k.target);return}D==="ArrowLeft"?r(L(y)):D==="ArrowRight"?r(A(V)):D==="ArrowUp"?W(y,-1):D==="ArrowDown"&&W(y,1)}function U(k){if(!C.current)return;ie.debug("handleKeyDown",k);const{key:D}=k,{selectionStart:y=0,selectionEnd:V=0}=C.current;if(y===null||V===null){ie.error("Selection key event on non-text input element",k.target);return}if(D==="Enter"){l?.(k);return}if(D.startsWith("Arrow")){j(k);return}if(D==="Delete"||D==="Backspace"){if(k.preventDefault(),k.stopPropagation(),V>=Ct(m,O).length){const I=m.substring(0,y===V?y-1:y),H=Ct(I,O);H!==m&&(o(H),r({selectionStart:H.length,selectionEnd:H.length,selectionDirection:Ie.NONE}));return}if(y!==V){const I=m.substring(0,y)+m.substring(y,V).replace(/[a-zA-Z0-9]/g,He)+m.substring(V);ie.debug("Range ",y,V,"deleted, setting value",I),o(I),r({selectionStart:y,selectionEnd:y,selectionDirection:Ie.NONE})}else if(y>0)for(let I=y-1;I>=0;I-=1){const H=m.substring(0,I)+m.substring(I,y).replace(/[a-zA-Z0-9]/g,He)+m.substring(y);if(H!==m){o(H),r({selectionStart:I,selectionEnd:I,selectionDirection:Ie.NONE});return}}return}if(k.altKey||k.metaKey||k.ctrlKey||D.length>1)return;k.preventDefault(),k.stopPropagation();const R=Array.from(new Set([D,D.toUpperCase(),D.toLowerCase()]));for(let I=0;I<R.length;I+=1){const H=R[I],ne=/[a-zA-Z0-9]/g.test(H)?w[0].length-1:y;for(let se=y;se<=ne;se+=1){const Rs=Rn(m,w[0],se+1),lt=i(Rs,se,H,y,V);if(P(lt,se+1)){const zt=M(se),ct=se+1;let ut={selectionStart:ct,selectionEnd:ct,selectionDirection:Ie.NONE};if(ct>=zt.selectionEnd){const Zt=A(se);Zt.selectionStart!==zt.selectionStart&&(ut=Zt)}ie.debug("handleKeyDown",D,"=>",lt,ut),o(lt),r(ut);return}}}}return c.jsx("input",{ref:C,className:x("form-control masked-input",t),type:"text",pattern:u,placeholder:h,value:m,onChange:()=>{},onKeyDown:U,onSelect:oe,onSelectCapture:$,onFocus:f,onBlur:v,"data-testid":S})});Pn.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(a,e,t)=>t,getPreferredReplacementString:st,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const it=Pn,Wi=B.module("TimeInput"),qi="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",Gi=["00:00:00","12:34:56","23:59:59"],Ln=E.forwardRef((a,e)=>{const{allowValueWrapping:t=!0,className:n="",onChange:s=()=>!1,value:i=0,onFocus:o=()=>!1,onBlur:r=()=>!1,onSelect:l=()=>!1,"data-testid":u}=a,[h,p]=d.useState(Ae.formatTime(i)),[m,f]=d.useState(),v=d.useRef(null);d.useImperativeHandle(e,()=>({focus:()=>{v.current?.focus()},setSelection:M=>{v.current?.focus(),f(M)}}),[]),d.useEffect(function(){p(Ae.formatTime(i))},[i]);function S(M,F,P){const A=M.selectionStart===0?24:60;let L=parseInt(P,10)-F;return Number.isNaN(L)?L=0:t?L=(L%A+A)%A:L=Math.min(Math.max(0,L),A-1),`${L}`.padStart(2,"0")}function C(M,F,P,A,L){return A===0&&L===2&&F===1&&parseInt(P,10)>1?`0${P}${M.substring(2)}`:st(M,F,P)}function w(M){Wi.debug("handleChange",M),p(M),Ae.isTimeString(M)&&s(Ae.parseTime(M))}const O=d.useCallback(M=>{f(M),l(M)},[l]);return c.jsx(it,{ref:v,className:n,example:Gi,getNextSegmentValue:S,getPreferredReplacementString:C,onChange:w,onSelect:O,pattern:qi,selection:m,value:h,onFocus:o,onBlur:r,"data-testid":u})});Ln.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Ze=Ln;let zi=class extends d.PureComponent{static defaultProps={closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=E.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,n=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:n,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{this.container.current?.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}container;oldFocus;rAF;getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=K.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:K.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,n=this.getKeyboardIndex();let s=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?s=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?s=K.getNextMenuItem(s??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(s=K.getNextMenuItem(s??0,1,t)),n!==s&&(s!==null?this.setKeyboardIndex(s):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:s,mouseIndex:i}=this.state;for(let r=0;r<s.length;r+=1){const l=s[r];r>0&&l.group!==s[r-1].group&&e.push(c.jsx("hr",{},`${r}.separator`));const u=c.jsx(Pt,{isKeyboardSelected:n===r,isMouseSelected:i===r,menuItem:l,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},r);e.push(u)}const{menuStyle:o}=this.props;return c.jsx("div",{className:"context-menu-container",style:{...o},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}};const Zi=zi;class Xi extends d.PureComponent{static defaultProps={isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0};constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=E.createRef(),this.parent=null,this.popper=E.createRef(),this.isOpen=!1}componentDidMount(){const{isShown:e}=this.props;e===null?this.container.current?.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}container;parent;popper;isOpen;closeMenu(){this.popper.current?.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){this.popper.current?.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":s}=this.props,{menuStyle:i}=this.props;let{options:o,popperOptions:r}=this.props;return r={placement:"bottom",...r},o={separateKeyboardMouse:!0,...o},c.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":s,children:c.jsx(De,{ref:this.popper,options:r,className:x("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:c.jsx(Zi,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:i})})})}}const jn=Xi;const Yt=-1;var $n=(a=>(a.UP="UP",a.DOWN="DOWN",a))($n||{});class re extends d.Component{static MENU_NAVIGATION_DIRECTION=$n;static DROP_DOWN_MENU_HEIGHT=125;static defaultProps={onChange(){},value:null,disabled:!1,popperOptions:{},icon:ti,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};constructor(e){super(e);const{value:t,valueToTime:n}=e;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=E.createRef(),this.menuContainer=E.createRef(),this.button=E.createRef(),this.input=E.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}csContainer;menuContainer;button;input;getSelectedText(){const{options:e,value:t,placeholder:n}=this.props,{customTime:s}=this.state;if(t===null)return n;for(let i=0;i<e.length;i+=1){const o=e[i];if(o.value===t)return o.title}return Ae.formatTime(s)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){this.button.current?.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props;switch(e.key){case"Enter":case" ":n?this.updateFromCustom():this.updateInputValue(s[t].value),this.closeMenu(),this.button.current?.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(re.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:s}=this.props,i=s.length;let o=t;switch(e){case re.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(o=(o-1)%i,this.setState({keyboardOptionIndex:o})):t===0&&(o=i-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case re.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===i-1){this.focusInput();break}else n&&this.focusOption(t);t<i&&!(n&&t===0)&&(o=(o+1)%i,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:n,timeToValue:s}=this.props,{customTime:i}=this.state;if(t===Yt){const o=s(i);this.updateAndClose(o)}else this.updateAndClose(n[t].value)}updateAndClose(e){this.updateInputValue(e),this.closeMenu(),this.button.current?.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){const{options:e,value:t}=this.props,{keyboardOptionIndex:n}=this.state;this.scrollOptionIntoView(n);const s=this.menuContainer.current?.querySelector(".cs-option-btn.keyboard-active");if(s instanceof HTMLElement&&s.focus(),t===null)return;e.map(o=>o.value).indexOf(t)<0&&this.focusInput()}focusInput(){this.input.current?.focus()}focusOption(e){const t=this.menuContainer.current?.querySelector(".cs-options");if(t&&t.children!=null){const n=t.children.item(e);n instanceof HTMLElement&&n.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){this.setState({menuIsOpen:!1}),e&&this.button.current?.focus()}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const n=e.map(s=>s.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}scrollOptionIntoView(e){const t=this.menuContainer.current?.querySelector(".cs-options");if(t&&t.children!=null){const n=t.children.item(e);n instanceof HTMLElement&&n.offsetTop>re.DROP_DOWN_MENU_HEIGHT?t.scrollTop=n.offsetTop-re.DROP_DOWN_MENU_HEIGHT:(n instanceof HTMLElement&&n.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return c.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:c.jsx("div",{className:"cs-options-container",children:c.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:n,customText:s}=this.props,{keyboardOptionIndex:i,customTime:o,inputFocused:r}=this.state;let l=!1;const u=[];for(let h=0;h<e.length;h+=1){const p=e[h],m=`option-${h}-${p.value}`;l=l||p.value===t,u.push(c.jsxs("button",{type:"button",value:h,className:x("cs-option-btn",{"keyboard-active":i===h&&!r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[p.value===t&&c.jsx(z,{icon:n,className:"mr-2"}),p.value!==t&&c.jsx("span",{className:"mr-4"}),p.title]},m))}return u.push(c.jsx("hr",{className:"cs-divider"},"option-divider")),u.push(c.jsxs("button",{type:"button",value:Yt,className:x("cs-option-btn",{"keyboard-active":r}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?c.jsx(z,{icon:n,className:"mr-2"}):c.jsx("span",{className:"mr-4"}),s]},"option-custom-label")),u.push(c.jsxs("div",{className:"cs-custom-container",children:[c.jsx("span",{className:"mr-2"}),c.jsx(Ze,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),c.jsx("span",{className:"ml-2"})]},"cs-custom-container")),u.push(c.jsx("hr",{className:"mb-2"},"option-end")),u}render(){const{disabled:e,invalid:t,value:n,"data-testid":s}=this.props,{menuIsOpen:i}=this.state;let{popperOptions:o}=this.props;return o={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...o},c.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":s,children:c.jsx("div",{className:x("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:c.jsxs("button",{type:"button",className:x("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[c.jsx("span",{className:x({"text-muted":n===null}),children:this.getSelectedText()}),c.jsx("span",{children:c.jsx(z,{icon:Tn,className:"cs-caret"})}),c.jsx(jn,{isShown:i,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}const Qi=re;function Ee(a,e,t,n,s){const i=n-t+1;return`${((parseInt(e,10)-a-t)%i+i)%i+t}`.padStart(s,"0")}function Vn(a,e,t){const{selectionStart:n}=a;return n===0?Ee(e,t,1900,2099,4):n===5?Ee(e,t,1,12,2):n===8?Ee(e,t,1,31,2):n===11?Ee(e,t,0,23,2):n===17||n===14?Ee(e,t,0,59,2):n===20||n===24||n===28?Ee(e,t,0,999,3):t}function St(a){const e=a.substring(0,23),t=a.substring(23,26),n=a.substring(26);return[e,t,n].filter(s=>s!=="").join("​")}const Ji=B.module("DateTimeInput"),Yi="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",ea="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",ta=`${Yi} ${ea}`,_e="2022-01-01",Bn=`${_e} 00:00:00.000000000`,na="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function en(a){return a!=null&&a.length>=_e.length?`${a.substring(0,_e.length)}${a.substring(_e.length).replace(/\u2007/g,"0")}${Bn.substring(a.length)}`:a}function tn(a){return a.replace(/\u200B/g,"")}const sa=[St(Bn)],Lt=E.forwardRef((a,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:o=()=>{},onSubmit:r,"data-testid":l}=a,[u,h]=d.useState(s.length>0?St(s):""),[p,m]=d.useState(),f=d.useCallback(S=>{Ji.debug("handleChange",S),h(S),n(en(tn(S)))},[n]),v=d.useCallback(()=>{const S=tn(u),C=en(S);C!==S&&h(St(C)),o()},[u,o]);return c.jsx("div",{className:"d-flex flex-row align-items-center",children:c.jsx(it,{ref:e,className:x(t),example:sa,getNextSegmentValue:Vn,onChange:f,onSelect:m,onSubmit:r,pattern:ta,placeholder:na,selection:p,value:u,onFocus:i,onBlur:v,"data-testid":l})})});Lt.displayName="DateTimeInput";Lt.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const ia=Lt,aa=B.module("DateInput"),oa="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",ra=["2000-01-01","2022-12-31"],la="YYYY-MM-DD",jt=E.forwardRef((a,e)=>{const{className:t="",onChange:n=()=>{},defaultValue:s="",onFocus:i=()=>{},onBlur:o=()=>{},"data-testid":r}=a,[l,u]=d.useState(s),[h,p]=d.useState(),m=d.useCallback(f=>{aa.debug("handleChange",f),u(f),n(f)},[n]);return c.jsx("div",{className:"d-flex flex-row align-items-center",children:c.jsx(it,{ref:e,className:x(t),example:ra,getNextSegmentValue:Vn,onChange:m,onSelect:p,pattern:oa,placeholder:la,selection:h,value:l,onFocus:i,onBlur:o,"data-testid":r})})});jt.displayName="DateInput";jt.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ca=jt;class ua extends d.PureComponent{static defaultProps={placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0};constructor(e){super(e),this.searchInput=E.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=We(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&this.setState({value:t})}searchInput;focus(){this.searchInput.current?.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){const{placeholder:e,className:t,matchCount:n,id:s,"data-testid":i}=this.props,{value:o}=this.state;return c.jsx(nt,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:s,"data-testid":i})}}const da=ua;const ha=B.module("ItemListItem");class $t extends d.Component{static defaultProps={children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}};static handleKeyDown(){return ha.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=E.createRef()}itemRef;handleBlur(e){const{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){const{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){const{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){const{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){const{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:n,style:s,children:i,"data-testid":o}=this.props;return c.jsx("div",{className:x("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:$t.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:s,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":o,children:i})}}const Hn=$t;const nn=B.module("ItemList"),sn=5;class ae extends d.PureComponent{static CACHE_SIZE=1e3;static DEFAULT_ROW_HEIGHT=20;static DEFAULT_OVERSCAN=10;static defaultProps={offset:0,items:[],rowHeight:ae.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:ae.DEFAULT_OVERSCAN,renderItem:ae.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0};static renderItem({item:e}){return c.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}constructor(e){super(e),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=E.createRef(),this.listContainer=E.createRef();const{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){const{selectedRanges:n,itemCount:s}=this.props,{focusIndex:i,isStuckToBottom:o,scrollOffset:r,height:l,selectedRanges:u}=this.state;if(o&&!this.isListAtBottom()&&s>0&&this.scrollToBottom(),(r!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==u)this.setSelectedRanges(n);else if(u!==t.selectedRanges){const{onSelectionChange:h}=this.props;h(u)}if(i!==t.focusIndex){const{onFocusChange:h}=this.props;h(i)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}list;listContainer;getItemSelected=ee((e,t)=>le.isSelected(t,e),{max:ae.CACHE_SIZE});getCachedItem=ee((e,t,n,s,i,o,r,l)=>{const u=o({item:n,itemIndex:e,isFocused:s,isSelected:i,style:r});return c.jsx(Hn,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:l,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:i,itemIndex:e,style:r,children:u},t)},{max:ae.CACHE_SIZE});getOuterElement=ee(e=>{const t=E.forwardRef((n,s)=>c.jsx("div",{ref:s,tabIndex:-1,onKeyDown:e,role:"presentation",...n}));return t.displayName="ItemListOuterElement",t});getInnerElement=ee(()=>{const e=E.forwardRef((t,n)=>c.jsx("div",{className:"item-list-inner-element",ref:n,...t}));return e.displayName="ItemListInnerElement",e});getItemData=ee((e,t,n)=>({items:e,selectedRanges:t,renderItem:n}));focus(){this.listContainer.current?.focus()}restoreScrollPosition(){const{scrollOffset:e}=this.state;e!=null&&this.listContainer.current?.scrollTo(0,e)}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,s=this.listContainer.current.querySelectorAll(t),i=e-n;return s[i]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const n=this.getElement(e);n instanceof HTMLElement&&n.focus()}scrollToItem(e){const t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:n}=this.state,i=le.isSelected(n,e)||K.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,i,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:n,onSelect:s}=this.props;n&&this.setState(({selectedRanges:i})=>({selectedRanges:le.selectRange(i,[e,e])}),()=>{s(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){nn.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){nn.debug2("item focus",e,t.target),this.setState(n=>{const{focusIndex:s}=n;return s!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:n,isMultiSelect:s,disableSelect:i}=this.props,{mouseDownIndex:o,selectedRanges:r,mouseX:l,mouseY:u}=this.state;if(o==null||i)return;const h=Math.abs(t.clientX-(l??0)),p=Math.abs(t.clientY-(u??0));h>sn&&p>sn&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),s?(!n&&!this.getItemSelected(e,r)&&!K.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,K.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:n,isDoubleClickSelect:s,onSelect:i}=this.props,{mouseDownIndex:o,isDragging:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!r){const l=t.shiftKey,u=K.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,n),!s&&!l&&!u&&i(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){const{isMultiSelect:t,itemCount:n,onSelect:s}=this.props,{focusIndex:i}=this.state;let o=i;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&s(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(i!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);const{selectedRanges:r}=this.state;if(e.shiftKey&&r.length>0){const l=r[r.length-1];this.selectRange([Math.min(o,l[0]),Math.max(o,l[1])])}else this.deselectAll(),o!==null?this.selectItem(o):this.listContainer.current?.focus();this.scrollIntoView(o)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(n=>{if(e)return{scrollOffset:t};const{isStickyBottom:s}=this.props,{height:i}=n;return{isStuckToBottom:s&&this.isListAtBottom({scrollOffset:t,height:i}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n,s=!0){const{isMultiSelect:i}=this.props,{selectedRanges:o}=this.state;if(i&&t&&o.length>0){const r=o[o.length-1];this.selectRange([Math.min(r[0],e),Math.max(e,r[1])])}else i&&o.length===1&&o[0][0]===e&&o[0][1]===e?s&&this.deselectItem(e):i&&n?this.getItemSelected(e,o)?s&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){le.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:le.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){le.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:le.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:n,rowHeight:s}=this.props,i=Math.floor(e/s),o=i+Math.ceil(t/s);n(i,o)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:n,rowHeight:s}=this.props;return e+t>=n*s}renderInnerElement({index:e,style:t}){const{items:n,offset:s,renderItem:i,disableSelect:o}=this.props,{focusIndex:r,selectedRanges:l}=this.state;if(e<s||e>=s+n.length)return null;const u=n[e-s];return this.getCachedItem(e,e,u,e===r&&!o,this.getItemSelected(e,l),i,t,o)}render(){const{items:e,itemCount:t,overscanCount:n,renderItem:s,rowHeight:i,"data-testid":o}=this.props,{selectedRanges:r,isStuckToBottom:l}=this.state;return c.jsx(Ls,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:u,height:h})=>c.jsx(js,{className:"item-list-scroll-pane",height:h,width:u,initialScrollOffset:l?t*i:0,itemCount:t,itemSize:i,itemData:this.getItemData(e,r,s),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})})}}class ge extends d.PureComponent{static DEFAULT_ROW_HEIGHT=30;static defaultProps={className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:ge.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:ge.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0};static renderHandle(){return c.jsxs("div",{children:[c.jsx(Nt,{children:"Drag to re-order"}),c.jsx(z,{icon:ni})]})}static renderBadge({text:e}){return e!=null&&e.length>0?c.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:n=""}){return c.jsxs("div",{className:x("item-list-item-content","draggable-item-list-item-content",n),children:[c.jsx("span",{className:"title",children:e}),ge.renderBadge({text:t}),ge.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:n}){const s=e!=null?e.displayValue??e.value??`${e}`:"",i=t!==void 0&&t?`${n}`:"",o=t!==void 0&&t?"item-list-item-clone":"";return ge.renderTextItem({text:s,badgeText:i,className:o})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}constructor(e){super(e),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=E.createRef(),this.state={selectedCount:0}}itemList;selectItem(e){this.itemList.current?.selectItem(e)}focusItem(e){this.itemList.current?.focusItem(e)}scrollToItem(e){this.itemList.current?.scrollToItem(e)}getCachedDraggableItem=ee((e,t,n,s,i,o,r,l)=>c.jsx($s,{draggableId:ge.getDraggableId(e,s),index:s,isDragDisabled:r,children:u=>c.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:u.innerRef,tabIndex:-1,...u.draggableProps,...u.dragHandleProps,children:t({item:n,itemIndex:s,isFocused:i,isSelected:o,style:l,isClone:!1})})},s),{max:ae.CACHE_SIZE});handleSelectionChange(e){this.setState({selectedCount:le.count(e)});const{onSelectionChange:t}=this.props;t(e)}getCachedRenderDraggableItem=ee((e,t,n)=>({item:s,itemIndex:i,isFocused:o,isSelected:r,style:l})=>this.getCachedDraggableItem(e,n,s,i,o,r,t,l),{max:1});getCachedRenderClone=ee((e,t,n,s)=>(i,o,r)=>{const{selectedCount:l}=this.state,{draggableProps:u,dragHandleProps:h,innerRef:p}=i,{index:m}=r.source,f=t[m-n];return c.jsx("div",{className:x("draggable-item-list-dragging-item-container",e),...u,...h,ref:p,children:c.jsx("div",{className:x("draggable-item-list-dragging-item",{"two-dragged":l===2},{"multiple-dragged":l>2}),children:s({item:f,itemIndex:m,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:l})})})},{max:1});render(){const{className:e,draggablePrefix:t,draggingItemClassName:n,droppableId:s,isDoubleClickSelect:i,isDragDisabled:o,isDropDisabled:r,isMultiSelect:l,isStickyBottom:u,itemCount:h,items:p,offset:m,onFocusChange:f,onSelect:v,onViewportChange:S,renderItem:C,rowHeight:w,selectedRanges:O,style:M,"data-testid":F}=this.props;return c.jsx(Vs,{isDropDisabled:r,droppableId:s,mode:"virtual",renderClone:this.getCachedRenderClone(n,p,m,C),"data-testid":F,children:(P,A)=>c.jsx("div",{role:"menu",className:x("draggable-item-list",e,{"is-drop-disabled":r,"is-drag-disabled":o,"is-dragging-from-this":A.draggingFromThisWith,"is-dragging-over":A.isDraggingOver,"is-dropping":A.draggingOverWith}),style:M,ref:P.innerRef,...P.droppableProps,children:c.jsx(ae,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:i,isDragSelect:!1,isMultiSelect:l,isStickyBottom:u,itemCount:h,items:p,onFocusChange:f,onSelect:v,onSelectionChange:this.handleSelectionChange,onViewportChange:S,offset:m,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,o,C),rowHeight:w,selectedRanges:O})})})}}const pa=ge;class Xe{static reorder(e,t,n,s){const i=e===n?Xe.adjustDestinationIndex(s,t):s,o=Xe.removeItems(e,t);return n.splice(i,0,...o),o}static removeItems(e,t){const n=[],s=t.map((i,o)=>({range:i,index:o})).sort((i,o)=>o.range[0]-i.range[0]);for(let i=0;i<s.length;i+=1){const{range:o,index:r}=s[i],[l,u]=o;n[r]=e.splice(l,u-l+1)}return Bs(n)}static adjustDestinationIndex(e,t){let n=e;for(let s=0;s<t.length;s+=1){const[i,o]=t[s];if(i>e)break;n-=Math.min(o,e-1)-i+1}return n}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const ma=Xe;function fa(a){const{isInvalid:e=!1,items:t,onAdd:n=()=>{},onDelete:s=()=>{},validate:i=()=>null}=a,[o,r]=d.useState(null),[l,u]=d.useState([]),[h,p]=d.useState(""),m=d.useCallback(M=>{u(M)},[]),f=d.useCallback(()=>{s(le.getItemsInRanges(t,l)),u([])},[t,l,s]),v=d.useCallback(()=>{if(h==="")return;const M=i(h);M==null?(n(h),p("")):r(M)},[h,n,i]),S=d.useCallback(M=>{const{value:F}=M.target;p(F),r(F===""?null:i(F))},[i]),C=d.useCallback(()=>{u([])},[]),w=d.useCallback(M=>{M.key==="Enter"&&v()},[v]),O=d.useMemo(()=>14+gt(t.length,1,6)*ae.DEFAULT_ROW_HEIGHT,[t.length]);return c.jsxs("div",{className:x("editable-item-list-container",{"is-invalid":e}),children:[c.jsx("div",{style:{height:O},children:c.jsx(ae,{itemCount:t.length,items:t.map((M,F)=>({value:M,isSelected:le.isSelected(l,F)})),offset:0,selectedRanges:l,onSelectionChange:m,isMultiSelect:!0})}),c.jsxs("div",{className:"d-flex flex-row pt-2",children:[c.jsx("div",{className:"d-flex flex-grow-1",children:c.jsx("input",{className:x("form-control",{"is-invalid":o!=null}),placeholder:"Enter value",type:"text",value:h,onChange:S,onFocus:C,onKeyDown:w})}),c.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[c.jsx(te,{kind:"ghost",onClick:v,disabled:o!=null||h==="",icon:si,tooltip:"Add new item","data-testid":"add-item-button"}),c.jsx(te,{kind:"ghost",onClick:f,disabled:l.length===0,icon:ii,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}class Fe extends d.Component{static defaultProps={className:"",icon:null,id:"","data-testid":void 0};static isParentSelected(e,t){const n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;const s=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return s&&i?null:s}constructor(e){super(e),this.toggleMenu=this.toggleMenu.bind(this),this.toggleValueFor=this.toggleValueFor.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.state={menuIsOpen:!1}}toggleMenu(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{const{menuIsOpen:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){const{valueMap:n,onUpdateValueMap:s}=this.props,i=new Map(n),o=i.get(e);if(o instanceof Map){const l=new Map(o);if(t!=null)l.set(t,o.get(t)===void 0);else{const u=Fe.isParentSelected(e,i),h=u==null||!u;o.forEach((p,m)=>l.set(m,h))}i.set(e,l)}else i.set(e,o==null||!o);const r=i.get(e);if(t===void 0&&r!==void 0&&typeof r!="boolean"){const l=Fe.isParentSelected(e,n);l!=null&&l?r.forEach((u,h)=>r.set(h,!1)):r.forEach((u,h)=>r.set(h,!0))}s(i)}setAllValues(e){const{valueMap:t,onUpdateValueMap:n}=this.props,s=new Map;t.forEach((i,o)=>{if(typeof i=="boolean")s.set(o,e);else{const r=new Map;i.forEach((l,u)=>r.set(u,e)),s.set(o,r)}}),n(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:e,"data-testid":t}=this.props;return c.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(([n,s])=>c.jsxs("div",{children:[c.jsx(ze,{className:"hcm-parent",checked:Fe.isParentSelected(n,e),onChange:()=>this.toggleValueFor(n),children:n}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([i,o])=>c.jsx(ze,{className:"hcm-child",checked:o,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),c.jsx(te,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?`${t}-btn-select-all`:void 0,children:"Select All"}),c.jsx(te,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?`${t}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:e,className:t,icon:n,id:s,"data-testid":i}=this.props,{menuIsOpen:o}=this.state;return c.jsxs("button",{type:"button",className:x("btn hcm-btn",t),onClick:this.toggleMenu,id:s,"data-testid":i,children:[c.jsxs("span",{children:[n&&c.jsx(z,{icon:n,className:"hcm-icon mr-1"}),e]}),c.jsx(z,{icon:Tn,className:"hcm-icon ml-1"}),c.jsx(De,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}const ga=Fe;function Un({on:a,id:e,className:t,isInvalid:n,disabled:s=!1,onClick:i,"data-testid":o}){return c.jsx("button",{type:"button",className:x("btn","btn-switch",t,{active:a},{"is-invalid":n}),id:e,onClick:i,disabled:s,"data-testid":o,children:c.jsx("div",{className:"handle"})})}function an(a){return a.isOn!==void 0}function Kn({item:a,onSelect:e=()=>{},"data-testid":t}){const{icon:n,subtitle:s,title:i}=a,o=d.useMemo(()=>an(a)?()=>{a.onChange(!a.isOn)}:e,[a,e]);return c.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:o,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&o()},tabIndex:0,role:"menuitem",children:[n!==void 0&&c.jsx("div",{className:"icon",children:c.jsx(z,{icon:n})}),c.jsx("div",{className:"title",children:i}),s!==void 0&&c.jsx("div",{className:"shortcut",children:s}),c.jsx("div",{className:"accessory","data-testid":t,children:an(a)?c.jsx(Un,{on:a.isOn,onClick:r=>{r.stopPropagation(),o()}}):c.jsx(z,{icon:yn})})]})}function ba({items:a,onSelect:e=()=>{},"data-testid":t}){return c.jsx("div",{className:"navigation-menu-view","data-testid":t,children:c.jsx("ul",{className:"navigation-menu-list",children:a.map((n,s)=>c.jsx("li",{children:c.jsx(Kn,{item:n,onSelect:()=>{e(s)}})},n.title))})})}function Ca({children:a,onBack:e,onClose:t,title:n,"data-testid":s}){return c.jsxs("div",{className:"navigation-page","data-testid":s,children:[c.jsxs("div",{className:"navigation-title-bar",children:[c.jsx("div",{className:"navigation-left-buttons",children:e!==void 0&&c.jsx(te,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:ai,children:"Back"})}),c.jsx("div",{className:"navigation-title",children:n}),c.jsx("div",{className:"navigation-right-buttons",children:t!==void 0&&c.jsx(te,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:t,icon:In,tooltip:"Close"})})]}),c.jsx("div",{className:"navigation-content",children:a})]})}function Sa({children:a,"data-testid":e}){const t=d.useMemo(()=>E.Children.toArray(a),[a]),n=wn(t),[s,i]=d.useState(t[t.length-1]),[o,r]=d.useState(null),[l,u]=d.useState(null);d.useEffect(function(){if(n===void 0||t===n)return;const f=t[t.length-1];t.length===n.length||n.length===0||o!==null||l!==null?o!==null&&f!==o?r(f):f!==l&&f!==s&&i(f):t.length>n.length?r(f):t.length<n.length&&(i(f),u(n[n.length-1]))},[t,n,o,l,s]);const h=d.useCallback(()=>{i(o),r(null)},[o]),p=d.useCallback(()=>{u(null)},[]);return c.jsxs("div",{className:"navigation-stack",children:[c.jsx("div",{className:"main-view","data-testid":e,children:s}),c.jsx(ye,{in:l!=null,timeout:ce.transitionMidMs,classNames:"slide-right",onEntered:p,children:c.jsx(c.Fragment,{children:l!=null&&c.jsx("div",{className:"popping-view",children:l})})}),c.jsx(ye,{in:o!=null,timeout:ce.transitionMidMs,classNames:"slide-left",onEntered:h,children:c.jsx(c.Fragment,{children:o!=null&&c.jsx("div",{className:"pushing-view",children:o})})})]})}function va({children:a,disabled:e,value:t,"data-testid":n}){return c.jsx("option",{value:t,disabled:e,"data-testid":n,children:a})}function Ma(a){const{children:e,disabled:t=!1,name:n,onChange:s,value:i="","data-testid":o}=a,[r]=d.useState(n??Te());return c.jsx(c.Fragment,{children:E.Children.map(e,l=>l?E.cloneElement(l,{name:r,onChange:l.props.onChange??s,checked:i===l.props.value,disabled:l.props.disabled??t,"data-testid":o}):null)})}const Vt=E.forwardRef((a,e)=>{const{checked:t,children:n,className:s="",disabled:i=!1,inputClassName:o="",isInvalid:r=!1,labelClassName:l="",name:u,onChange:h,value:p,"data-testid":m}=a,[f]=d.useState(Te());return c.jsxs("div",{className:x("custom-control custom-radio",s),children:[c.jsx("input",{type:"radio",id:f,"data-testid":m,name:u,ref:e,className:x("custom-control-input",o,{"is-invalid":r}),checked:t,disabled:i,value:p,onChange:h}),c.jsx("label",{className:x("custom-control-label",l),htmlFor:f,children:n})]})});Vt.displayName="RadioItem";Vt.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ya=Vt;const Ta=.025,Ia=.9,Ea=.1,xa=.618,ht=ce["primary-dark"],on=80,wa=ce["gray-800"],Na=ce["gray-900"],Se={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},pe=18,ka=250,Da=60*1e3,Oa=E.memo(()=>{const a=d.useRef(null),e=d.useRef(null),[t,n]=d.useState(!1),s=window.devicePixelRatio;let i,o,r,l,u,h=null,p=[];function m(){e.current!=null&&(r=e.current.offsetWidth,l=e.current.offsetHeight),a.current!=null&&(a.current.style.width=`${r}px`,a.current.style.height=`${l}px`,a.current.width=r*s,a.current.height=l*s),i?.scale(s,s)}function f(){const $=document.createElement("canvas");$.width=Se.SIZE,$.height=Se.SIZE;const j=$.getContext("2d");return j!=null&&(j.fillStyle=ht,j.fillRect(0,0,Se.DOT_SIZE,Se.DOT_SIZE),j.fillStyle=ht+Math.round(255*Se.FILL_OPACITY).toString(16).padStart(2,"0"),j.fillRect(0,0,Se.SIZE,Se.SIZE)),j?.createPattern($,"repeat")}function v($){const j=Math.random()-.5;let U=Ta*j;return $<Ea?U=Math.abs(U):$>Ia&&(U=-Math.abs(U)),$+U}function S(){const $=[];let j=xa;for(let U=0;U<r+pe;U+=1)j=v(j),$.push(j);return $}function C(){for(;p.length>=r+pe;)p.pop();for(;p.length<r+pe;)p.push(v(p[p.length-1]))}function w($,j){j.beginPath(),j.moveTo(-1,l+1),j.lineTo(-1,l*$[0]);for(let U=0;U<$.length;U+=1)j.lineTo(U,l*$[U]);j.lineTo(r+pe,l*$[$.length-1]),j.lineTo(r+pe,l+1),j.closePath()}function O($){$.beginPath();for(let j=1;j<r;j+=on)$.moveTo(j,0),$.lineTo(j,l);for(let j=1;j<l;j+=on)$.moveTo(0,j),$.lineTo(r,j)}function M($){h=h??$,yi(i),i.fillStyle=Na,i.fillRect(0,0,r,l),O(i),i.lineWidth=1,i.strokeStyle=wa,i.stroke();const j=((h??0)-($??0))/(1e3/pe);if(i.translate(j,0),w(p,i),i.lineWidth=2,i.strokeStyle=ht,i.stroke(),i.translate(-j,0),o!=null&&(i.fillStyle=o),i.fill(),i.setTransform(s,0,0,s,0,0),($??0)-(h??0)>1e3/pe){const U=Math.floor((($??0)-(h??0))/(1e3/pe));for(let k=0;k<U;k+=1)p.shift(),p.push(v(p[p.length-1]));h=$}u!=null&&cancelAnimationFrame(u),u=requestAnimationFrame(M)}const F=We(()=>{u=requestAnimationFrame($=>{m(),C(),n(!1),M($)})},ka,{leading:!0});function P(){n(!0),u!=null&&cancelAnimationFrame(u),u=null,h=null}const A=We(()=>{P()},Da);function L(){u==null&&(n(!1),m(),C(),u=requestAnimationFrame(M)),A()}function W(){document.hasFocus()&&L()}function oe(){u!=null&&cancelAnimationFrame(u),A(),F()}return d.useEffect(()=>(i=a.current?.getContext("2d",{alpha:!1}),m(),p=S(),o=f(),M(),A(),window.addEventListener("resize",oe),window.addEventListener("focus",L),window.addEventListener("blur",P),window.addEventListener("mousemove",W),window.addEventListener("keydown",W),()=>{u!=null&&cancelAnimationFrame(u),window.removeEventListener("resize",oe),window.removeEventListener("focus",L),window.removeEventListener("blur",P),window.removeEventListener("mousemove",W),window.removeEventListener("keydown",W),A.cancel(),F.cancel()}),[]),c.jsx("div",{className:"random-area-plot-animation-container",ref:e,children:c.jsx("canvas",{ref:a,className:t?"shade":""})})}),_n=Oa;function Aa({children:a,onBlur:e,onChange:t,className:n,defaultValue:s,name:i,value:o,disabled:r,"data-testid":l}){const u=d.useCallback(h=>{t(h.target.value)},[t]);return c.jsx("select",{className:x("custom-select",n),onBlur:e,onChange:u,defaultValue:s,value:o,name:i,disabled:r,"data-testid":l,children:a})}class Fa extends d.PureComponent{static defaultProps={disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0};constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=E.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}list;topRow;bottomRow;getCachedItem=ee((e,t,n,s,i,o,r)=>{const l={height:i},u=s??n;return c.jsx("li",{className:"value-list-item",style:l,tabIndex:-1,children:c.jsx(ze,{checked:o,disabled:r,onChange:()=>this.handleSelect(e),children:u})},t)},{max:1e3});getCachedItems=ee((e,t,n,s)=>{const i=[];for(let o=0;o<e.length;o+=1){const r=e[o],{value:l,displayValue:u,isSelected:h}=r,p=n+o,m=p,f=this.getCachedItem(p,m,l,u,t,h,s);i.push(f)}return i},{max:1});handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t?.(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:n,onSelect:s}=this.props,i=e-n;if(i>=0&&i<t.length){const o=t[i],{value:r}=o;s(e,r)}else s(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,n=this.list.current.scrollTop,s=n+this.list.current.clientHeight,i=Math.floor(n/t),o=Math.ceil(s/t);(this.topRow!==i||this.bottomRow!==o)&&(this.topRow=i,this.bottomRow=o,e(i,o))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){this.getElement(e)?.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:n,items:s,itemCount:i,offset:o,rowHeight:r,"data-testid":l}=this.props,u=this.getCachedItems(s,r,o,t);return c.jsx("div",{className:x("select-value-list-scroll-pane h-100 w-100",{"is-invalid":n},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":l,children:c.jsx("div",{className:"select-value-list",style:{height:i*r},children:c.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:s.length*r,top:o*r,left:0},children:u})})})}}const Wn=Fa,rn=B.module("Shortcut");var Y=(a=>(a.CTRL="MODIFIER_CTRL",a.CMD="MODIFIER_CMD",a.ALT="MODIFIER_ALT",a.OPTION="MODIFIER_OPTION",a.SHIFT="MODIFIER_SHIFT",a))(Y||{}),Z=(a=>(a.A="A",a.B="B",a.C="C",a.D="D",a.E="E",a.F="F",a.G="G",a.H="H",a.I="I",a.J="J",a.K="K",a.L="L",a.M="M",a.N="N",a.O="O",a.P="P",a.Q="Q",a.R="R",a.S="S",a.T="T",a.U="U",a.V="V",a.W="W",a.X="X",a.Y="Y",a.Z="Z",a.ZERO="0",a.ONE="1",a.TWO="2",a.THREE="3",a.FOUR="4",a.FIVE="5",a.SIX="6",a.SEVEN="7",a.EIGHT="8",a.NINE="9",a.BACKSPACE="Backspace",a.ESCAPE="Escape",a.ENTER="Enter",a.DELETE="Delete",a.SLASH="/",a.QUESTION_MARK="?",a.BACKSLASH="\\",a.PIPE="|",a.MINUS="-",a.UNDERSCORE="_",a.EQUALS="=",a.PLUS="+",a.BACKTICK="`",a.TILDE="~",a.COMMA=",",a.LEFT_CHEVRON="<",a.PERIOD=".",a.RIGHT_CHEVRON=">",a.SEMICOLON=";",a.COLON=":",a.SINGLE_QUOTE="'",a.DOUBLE_QUOTE='"',a.LEFT_BRACKET="[",a.RIGHT_BRACKET="]",a.LEFT_CURLY="{",a.RIGHT_CURLY="}",a.F1="F1",a.F2="F2",a.F3="F3",a.F4="F4",a.F5="F5",a.F6="F6",a.F7="F7",a.F8="F8",a.F9="F9",a.F10="F10",a.F11="F11",a.F12="F12",a))(Z||{});const Ra=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);class _ extends Sn{id;name;tooltip;isEditable;defaultKeyState;keyState;static NULL_KEY_STATE={metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null};static isAllowedKey(e){return Object.values(Z).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!_.isMacPlatform&&e.metaKey||!_.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Ra.has(t)}static isMacPlatform=K.isMacPlatform();static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case"MODIFIER_CTRL":t.ctrlKey=!0;break;case"MODIFIER_ALT":case"MODIFIER_OPTION":t.altKey=!0;break;case"MODIFIER_CMD":t.metaKey=!0;break;case"MODIFIER_SHIFT":t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){const{key:t,keyCode:n}=e;let s="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?s="":!_.isAllowedKey(t)&&_.isAllowedKey(String.fromCharCode(n))?s=String.fromCharCode(n):s=t,{keyValue:s,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){let t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue==="Escape"?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){let t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case"Enter":t+="⏎";break;case"Escape":t+="⎋";break;case"Backspace":t+="⌫";break;case"Delete":t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){return e.keyValue?.toUpperCase()===t.keyValue?.toUpperCase()&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":_.isMacPlatform?_.getMacDisplayText(e):_.getWindowsDisplayText(e)}constructor({id:e,shortcut:t,macShortcut:n,isEditable:s=!0,name:i,tooltip:o}){super(),this.id=e,this.name=i,this.tooltip=o,this.isEditable=s;const l=_.isMacPlatform?n:t;this.defaultKeyState=_.createKeyState(l),this.keyState=this.defaultKeyState}getDisplayText(){return _.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){_.isValidKeyState(e)?(rn.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Nn("onUpdate",{detail:this}))):rn.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return _.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(_.NULL_KEY_STATE)}isNull(){return _.doKeyStatesMatch(this.keyState,_.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return _.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(_.getKeyStateFromEvent(e))}}const ln=B.module("ShortcutRegistry");class Pa extends Sn{shortcutMap=new Map;shortcutsByCategory=new Map;createAndAdd(e){const t=new _(e);return this.add(t)}add(e){const t=this.shortcutMap.get(e.id);if(t)return ln.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;ln.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:s})=>this.dispatchEvent(new Nn("onUpdate",{detail:s})));const n=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)?this.shortcutsByCategory.get(n)?.push(e):this.shortcutsByCategory.set(n,[e]),e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}const La=Object.freeze(new Pa),ve=La,ja={COPY:ve.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[Y.CTRL,Z.C],macShortcut:[Y.CMD,Z.C],isEditable:!1}),PASTE:ve.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[Y.CTRL,Z.V],macShortcut:[Y.CMD,Z.V],isEditable:!1}),SAVE:ve.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[Y.CTRL,Z.S],macShortcut:[Y.CMD,Z.S],isEditable:!1}),SELECT_ALL:ve.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[Y.CTRL,Z.A],macShortcut:[Y.CMD,Z.A],isEditable:!1}),LINKER:ve.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[Y.CTRL,Z.L],macShortcut:[Y.CMD,Z.L]}),LINKER_CLOSE:ve.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[Z.ESCAPE],macShortcut:[Z.ESCAPE],isEditable:!1})},$a=ja;const Bt=E.forwardRef((a,e)=>{const{children:t,className:n,disabled:s,id:i,isLinked:o,isLinkedSource:r,isInvalid:l,onClick:u,onMouseEnter:h,onMouseLeave:p,style:m,"data-testid":f}=a;return c.jsxs("button",{ref:e,type:"button",className:x("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||r},{"btn-socketed-linked-source":r},{"is-invalid":l},n),id:i,onClick:u,onMouseEnter:h,onMouseLeave:p,style:m,disabled:s,"data-testid":f,children:[t,c.jsx(z,{icon:oi,className:"linked btn-socketed-icon",transform:"down-1"}),c.jsx(z,{icon:ri,className:"is-invalid btn-socketed-icon"})]})});Bt.displayName="SocketedButton";Bt.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 Va=Bt,Ba={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},Ha={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:Ua,light:Ka,dark:_a,medium:Wa,large:qa}=Hs,Ga={global:Ua,light:{...Ka,...Ha},dark:{..._a,...Ba},medium:Wa,large:qa},za="_track_535ju_30",Za="_handle_535ju_13",Xa="_ticks_535ju_98",qn={"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:za,"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:Za,ticks:Xa,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const Ue=parseInt(qn["handle-size"],10),cn=parseInt(qn["popover-width"],10),J=24*60*60-1,un=5*60;function Qa({startTime:a,endTime:e,onChange:t,isStartModified:n=!1,isEndModified:s=!1,"data-testid":i}){const[o,r]=d.useState(a),[l,u]=d.useState(e),h=d.useRef(null);d.useEffect(function(){r(a),u(e)},[a,e]);const p=d.useCallback((v,S)=>{let C=v,w=S;C===w&&(w<J?w+=1:C-=1),r(C),u(w),t({startTime:C,endTime:w})},[r,u,t]),m=d.useCallback(v=>{p(v,l)},[p,l]),f=d.useCallback(v=>{p(o,v)},[p,o]);return c.jsxs("div",{className:"time-slider","data-testid":i,children:[c.jsx(Ja,{startTime:o,endTime:l,onStartTimeChange:m,onEndTimeChange:f,isStartModified:n,isEndModified:s}),c.jsxs("div",{className:"track",ref:h,children:[c.jsx(Ya,{startTime:o,endTime:l}),c.jsx("div",{className:"ticks",children:Array(24).fill(null).map((v,S)=>c.jsx("div",{className:"tick"},S))}),c.jsx(dn,{track:h,time:o,setTime:m}),c.jsx(dn,{track:h,time:l,setTime:f})]}),c.jsxs("div",{className:"tick-labels",children:[c.jsx("div",{className:"tick-label",children:"0:00"}),c.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((v,S)=>c.jsx("div",{className:"tick-label",children:`${S+1}:00`},S))})]})]})}function Ja(a){const{startTime:e,endTime:t,onStartTimeChange:n,onEndTimeChange:s,isStartModified:i,isEndModified:o,"data-testid":r}=a,l=e>t,[u,h]=d.useState(l?t:e),[p,m]=d.useState(l?e:t),f=d.useRef(null),v=d.useRef(null),S=d.useRef(null),C=d.useRef(null);d.useEffect(function(){h(e>t?t:e),m(e>t?e:t)},[e,t]),d.useEffect(function(){S.current!==null&&v.current?.setSelection(S.current),C.current!==null&&f.current?.setSelection(C.current)},[l]);function w(P){e<=t?n(P):s(P)}function O(P){e<=t?s(P):n(P)}const M=d.useCallback(P=>{S.current=P,C.current=null},[]),F=d.useCallback(P=>{S.current=null,C.current=P},[]);return c.jsxs("div",{className:"time-slider-popovers",children:[c.jsx("div",{className:"flex",style:{flexBasis:`calc(${u/J*100}% - ${cn/2}px)`}}),c.jsxs("div",{className:"handle-popper",children:[c.jsx("label",{className:x({modified:l?o:i}),children:l?"End Time":"Start Time"}),c.jsx(Ze,{ref:f,allowValueWrapping:!1,value:u,onChange:w,onSelect:M,"data-testid":r!==void 0?`${r}-input-1`:void 0})]}),c.jsx("div",{className:"flex-spacer"}),c.jsxs("div",{className:"handle-popper",children:[c.jsx("label",{className:x({modified:l?i:o}),children:l?"Start Time":"End Time"}),c.jsx(Ze,{ref:v,allowValueWrapping:!1,value:p,onChange:O,onSelect:F,"data-testid":r!==void 0?`${r}-input-2`:void 0})]}),c.jsx("div",{className:"flex",style:{flexBasis:`calc(${(J-p)/J*100}% - ${cn/2}px)`}})]})}function Ya(a){const{startTime:e,endTime:t,"data-testid":n}=a;return c.jsxs("div",{className:"track-fills","data-testid":n,children:[e>t&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${t/J})`}}),c.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(J-e)/J})`}})]}),e<t&&c.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${e/J*100}%) scaleX(${(t-e)/J})`}})]})}function dn(a){const{track:e,time:t,setTime:n,"data-testid":s}=a,i=d.useMemo(()=>{let f=Ue/2;return t<3600?f=t/3600*(Ue/2):t>23*3600&&(f=Ue/2+1/(J-23*3600)*(t-23*3600)*(Ue/2)),`translateX(calc(${t/J*100}% - ${f}px))`},[t]),o=d.useCallback(m=>{if(!e.current)return 0;const f=e.current.getBoundingClientRect(),v=Math.max(m-f.left,0),S=J*Math.min(1,v/f.width),C=un*Math.round(S/un);return Math.min(J,C)},[e]),r=d.useCallback(({clientX:m})=>{n(o(m))},[n,o]),l=d.useCallback(({clientX:m})=>{n(o(m)),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[n,o,r]),u=d.useCallback(()=>{window.addEventListener("mousemove",r),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[r,l]),h=d.useCallback(()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[r,l]),p=d.useCallback(()=>{u()},[u]);return d.useEffect(function(){return()=>{h()}},[h]),c.jsx("div",{className:"handle-track",style:{transform:i},children:c.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:p,"data-testid":s})})}function Gn({buttons:a,isShown:e=!1,classNames:t,message:n,type:s,onClick:i,onDismiss:o,"data-testid":r}){const l=a&&a.length!==0;return c.jsx(ye,{in:e,timeout:ce.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:c.jsxs("div",{className:x("toast-notification",t,s),role:"presentation",onClick:i,onKeyPress:i,"data-testid":r,children:[c.jsx("div",{className:"message-container",children:c.jsx("span",{className:"message",children:n})}),c.jsx(ye,{in:l,timeout:ce.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:c.jsx("div",{className:"buttons-container",children:a})}),o&&c.jsx(te,{kind:"ghost",icon:In,tooltip:"Close notification",className:"my-2",onClick:o})]})})}Gn.TYPE=Object.freeze({ERROR:"error"});function eo(a){const{children:e,className:t,labelText:n,hintText:s,isModified:i,validationError:o,showValidationError:r=!0,"data-testid":l,id:u}=a,{current:h}=d.useRef(u??Te());return c.jsxs(c.Fragment,{children:[c.jsx("label",{className:x("validate-label",t,{modified:i}),htmlFor:h,"data-testid":l,children:n}),E.Children.toArray(e).map(p=>E.isValidElement(p)?E.cloneElement(p,{className:x(p.props.className,{"is-invalid":o})}):c.jsx("div",{className:x(t),children:p})),s!==void 0&&c.jsx("small",{className:"form-text text-muted",children:s}),o!==void 0&&r&&c.jsx("p",{className:"validate-label-error text-danger",children:o})]})}const to=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:pi,AutoResizeTextarea:kt,BasicModal:Ft,Button:te,ButtonGroup:je,ButtonOld:Di,CardFlip:Oi,Checkbox:ze,Collapse:Hi,ComboBox:Ki,ContextActionUtils:K,ContextActions:ji,ContextMenuItem:Pt,ContextMenuRoot:Bi,CopyButton:_i,CustomTimeSelect:Qi,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:st,DateInput:ca,DateTimeInput:ia,DebouncedModal:Ni,DebouncedSearchInput:da,DragUtils:ma,DraggableItemList:pa,DropdownMenu:jn,EditableItemList:fa,GLOBAL_SHORTCUTS:$a,HierarchicalCheckboxMenu:ga,InfoModal:ki,ItemList:ae,ItemListItem:Hn,KEY:Z,LoadingOverlay:Le,LoadingSpinner:wt,MODIFIER:Y,MaskedInput:it,Menu:ba,MenuItem:Kn,Modal:Et,ModalBody:xt,ModalFooter:An,ModalHeader:Mn,Option:va,Page:Ca,Popper:De,RadioGroup:Ma,RadioItem:ya,RandomAreaPlotAnimation:_n,SearchInput:nt,Select:Aa,SelectValueList:Wn,Shortcut:_,ShortcutRegistry:ve,SocketedButton:Va,Stack:Sa,ThemeExport:ce,TimeInput:Ze,TimeSlider:Qa,ToastNotification:Gn,Tooltip:Nt,UISwitch:Un,ValidateLabelInput:eo,fillToLength:Rn,themeDHDefault:Ga,trimTrailingMask:Ct},Symbol.toStringTag,{value:"Module"}));function Oe(){return $e(En,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function no(a,e){const t=Oe(),n=d.useMemo(()=>new t.CoreClient(a,e),[t,a,e]);return d.useEffect(()=>()=>{n.disconnect()},[n]),n}const Ht=d.createContext(null);function so({serverUrl:a,options:e,children:t}){const n=no(a,e);return c.jsx(Ht.Provider,{value:n,children:t})}function Ve(){return $e(Ht,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}const io=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:li,ApiContext:En,ClientBootstrap:so,ClientContext:Ht,useApi:Oe,useClient:Ve},Symbol.toStringTag,{value:"Module"})),{dh:ao}=globalThis,N=ao,zn=1e4;function oo(a,e,t=zn){return new Promise((n,s)=>{let i;const o=setTimeout(()=>{i?.(),s(new Ye(`Variable ${e} not found`))},t);function r(l){const u=l.created.find(h=>h.title===e);u!=null&&(clearTimeout(o),i?.(),n(u))}i=a.subscribeToFieldUpdates(r)})}class ro{static TYPE_GLOBAL="type-global";static TYPE_CONTEXT_PRESET="type-context-preset";static TYPE_CONTEXT_CUSTOM="type-context-custom";static isValid(e){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}const G=ro;class lo extends G{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Zn=lo;class co extends G{format(e){return String.fromCharCode(e)}}const Xn=co,hn=B.module("DateTimeColumnFormatter");class he extends G{static isValid(e){try{return N.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=G.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";static DEFAULT_TIME_ZONE_ID="America/New_York";static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(e,t){return[...he.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(e,t){return[...he.makeFormatStringMap(e,t).keys()]}dhTimeZone;defaultDateTimeFormatString;showTimeZone;showTSeparator;formatStringMap;constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=he.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const i=e||he.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=N.i18n.TimeZone.getTimeZone(i)}catch{hn.error("Unsupported time zone id",i),this.dhTimeZone=N.i18n.TimeZone.getTimeZone(he.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=he.makeFormatStringMap(t,n)}getEffectiveFormatString(e){return this.formatStringMap.get(e)??e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return N.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{hn.error("Invalid format arguments")}return""}}const uo=B.module("DecimalColumnFormatter");class Q extends G{static isValid(e){try{return N.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=G.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return Q.makeFormat(e,t,G.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return Q.makeFormat("Custom Format",e,G.TYPE_CONTEXT_CUSTOM,t)}static DEFAULT_FORMAT_STRING="###,##0.0000";static FORMAT_PERCENT=Q.makePresetFormat("Percent","##0.00%");static FORMAT_BASIS_POINTS=Q.makePresetFormat("Basis Points","###,##0 bp",1e4);static FORMAT_MILLIONS=Q.makePresetFormat("Millions","###,##0.000 mm",1e-6);static FORMAT_SCIENTIFIC_NOTATION=Q.makePresetFormat("Scientific Notation","0.0000E0");static FORMAT_ROUND=Q.makePresetFormat("Round","###,##0");static FORMAT_ROUND_TWO_DECIMALS=Q.makePresetFormat("0.00","###,##0.00");static FORMAT_ROUND_FOUR_DECIMALS=Q.makePresetFormat("0.0000","###,##0.0000");static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}defaultFormatString;constructor({defaultFormatString:e=Q.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return N.i18n.NumberFormat.format(n,s)}catch{uo.error("Invalid format arguments")}return""}}class ho extends G{format(e){return`${e}`}}const Qn=ho,po=B.module("IntegerColumnFormatter");class be extends G{static isValid(e){try{return N.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=G.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return be.makeFormat(e,t,G.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return be.makeFormat("Custom Format",e,G.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}static DEFAULT_FORMAT_STRING="###,##0";static FORMAT_MILLIONS=be.makePresetFormat("Millions","###,##0.000 mm",1e-6);static FORMAT_SCIENTIFIC_NOTATION=be.makePresetFormat("Scientific Notation","0.0000E0");defaultFormatString;constructor({defaultFormatString:e=be.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return N.i18n.NumberFormat.format(n,s)}catch{po.error("Invalid format arguments")}return""}}class Jn extends G{format(e){return e}}class q{static FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";static months=["january","february","march","april","may","june","july","august","september","october","november","december"];static makeDateWrapper(e,t,n=0,s=1,i=0,o=0,r=0,l=0){if(!e)throw new Error("No timezone provided");const u=`${t}`.padStart(4,"0"),h=`${n+1}`.padStart(2,"0"),p=`${s}`.padStart(2,"0"),m=`${i}`.padStart(2,"0"),f=`${o}`.padStart(2,"0"),v=`${r}`.padStart(2,"0"),S=`${l}`.padStart(9,"0"),C=`${u}-${h}-${p} ${m}:${f}:${v}.${S}`;return N.i18n.DateTimeFormat.parse(q.FULL_DATE_FORMAT,C,N.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n){let{year:s,month:i,date:o,hours:r,minutes:l,seconds:u,nanos:h}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;h=q.getNextNanos(e.nanos),h>999999999&&(u+=1,h=0)}else e.seconds!=null?u+=1:e.minutes!=null?l+=1:e.hours!=null?r+=1:e.date!=null?o+=1:e.month!=null?i+=1:s+=1;const p=new Date(s,i,o,r,l,u);return q.makeDateWrapper(n,p.getFullYear(),p.getMonth(),p.getDate(),p.getHours(),p.getMinutes(),p.getSeconds(),h)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<q.months.length;s+=1)if(q.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,i,o,r){const l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,h=n!=null?parseInt(n,10):1,p=s!=null?parseInt(s,10):0,m=i!=null?parseInt(i,10):0,f=o!=null?parseInt(o,10):0,v=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(h)||Number.isNaN(p)||Number.isNaN(m)||Number.isNaN(f)||Number.isNaN(v)?null:{year:l,month:u,date:h,hours:p,minutes:m,seconds:f,nanos:v}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,i,,o,,r,,l,,u,,h,p]=n;if(p!=null&&p.length>0)throw new Error(`Unexpected characters after date string '${e}': ${p}`);return{year:s,month:i,date:o,hours:r,minutes:l,seconds:u,nanos:h}}static parseDateRange(e,t){const n=e.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){const l=new Date(Date.now()),u=q.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()),h=q.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()+1);return[u,h]}if(n==="yesterday"){const l=new Date(Date.now()),u=q.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()-1),h=q.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate());return[u,h]}if(n==="now"){const l=new Date(Date.now());return[N.DateWrapper.ofJsDate(l),null]}const s=q.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const i=q.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(i==null)throw new Error(`Unable to extract date values from ${s}`);const o=q.makeDateWrapper(t,i.year,i.month,i.date,i.hours,i.minutes,i.seconds,i.nanos),r=q.getNextDate(s,i,t);return[o,r]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}class pn{static not="not";static and="and";static or="or"}function Sr(a){if(!(a==="not"||a==="and"||a==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class T{static eq="eq";static eqIgnoreCase="eqIgnoreCase";static notEq="notEq";static notEqIgnoreCase="notEqIgnoreCase";static greaterThan="greaterThan";static greaterThanOrEqualTo="greaterThanOrEqualTo";static lessThan="lessThan";static lessThanOrEqualTo="lessThanOrEqualTo";static in="in";static inIgnoreCase="inIgnoreCase";static notIn="notIn";static notInIgnoreCase="notInIgnoreCase";static isTrue="isTrue";static isFalse="isFalse";static isNull="isNull";static invoke="invoke";static contains="contains";static notContains="notContains";static startsWith="startsWith";static endsWith="endsWith";static containsAny="containsAny"}const ue=B.module("TableUtils");class b{static dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};static sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};static REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});static NUMBER_REGEX=/^-?\d+(\.\d+)?$/;static getSortIndex(e,t){for(let n=0;n<e.length;n+=1)if(e[n].column?.name===t)return n;return null}static getSortForColumn(e,t){const n=b.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return b.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:b.isCharType(e)||b.isNumberType(e)||b.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:b.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;const s=b.getSortForColumn(t,e[n].name);return s===null?e[n].sort().asc():s.direction===b.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(t<0||t>=e.length||n===b.sortDirection.none)return null;let i=e[t].sort();switch(n){case b.sortDirection.ascending:i=i.asc();break;case b.sortDirection.descending:i=i.desc();break}return s&&(i=i.abs()),i}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const i=b.getNextSort(t,e,n);return b.setSortForColumn(e,t[n].name,i,s)}static sortColumn(e,t,n,s,i,o){if(n<0||n>=t.length)return[];const r=b.makeColumnSort(t,n,s,i);return b.setSortForColumn(e,t[n].name,r,o)}static setSortForColumn(e,t,n,s=!1){const i=b.getSortIndex(e,t);let o=[];return s&&(o=o.concat(e.filter(({direction:r})=>r!==b.sortDirection.reverse)),i!==null&&o.splice(i,1)),n!==null&&o.push(n),o}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case b.dataType.BOOLEAN:return b.dataType.BOOLEAN;case"char":case"java.lang.Character":case b.dataType.CHAR:return b.dataType.CHAR;case"java.lang.String":case b.dataType.STRING:return b.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case b.dataType.DATETIME:return b.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case b.dataType.DECIMAL:return b.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case b.dataType.INT:return b.dataType.INT;default:return b.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return b.isIntegerType(e)||b.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return b.getNormalizedType(e)===b.getNormalizedType(t)}static makeQuickFilter(e,t,n){const s=t.split("||");let i=null;for(let o=0;o<s.length;o+=1){const l=s[o].split("&&");let u=null;for(let h=0;h<l.length;h+=1){const p=l[h].trim();if(p.length>0){const m=b.makeQuickFilterFromComponent(e,p,n);if(m)u?u=u.and(m):u=m;else throw new Error(`Unable to parse quick filter from text ${t}`)}}i&&u?i=i.or(u):i=u}return i}static makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return b.isNumberType(s)?this.makeQuickNumberFilter(e,t):b.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&b.isDateType(s)?this.makeQuickDateFilter(e,t,n):b.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){const n=e.filter();let s=null;const o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let r=null,l=null,u=null,h=null,p=null;if(o!==null&&o.length>3&&([,r,l,u,h,p]=o),p!=null&&p.trim().length>0)return null;if(r==null&&(r="="),h!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(h=h.trim().toLowerCase(),h){case"null":s=n.isNull();break;case"nan":s=N.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":l!=null?s=N.FilterCondition.invoke("isInf",n).and(n.lessThan(N.FilterValue.ofNumber(0))):s=N.FilterCondition.invoke("isInf",n).and(n.greaterThan(N.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(u==null)return null;if(u=b.removeCommas(u),b.isLongType(e.type))try{u=N.FilterValue.ofNumber(N.LongWrapper.ofString(`${l!=null?"-":""}${u}`))}catch(m){return ue.warn("Unable to create long filter",m),null}else{if(u=parseFloat(u),u==null||Number.isNaN(u))return null;u=N.FilterValue.ofNumber(l!=null?0-u:u)}return s=e.filter(),b.makeRangeFilterWithOperation(s,r,u)}static makeQuickTextFilter(e,t){const n=`${t}`.trim(),i=/^(!~|!=|~|=|!)?(.*)/.exec(n);let o=null,r=null;if(i!==null&&i.length>2&&([,o,r]=i,r!=null&&(r=r.trim())),r==null||r.length===0)return null;o==null&&(o="=");const l=e.filter();if(r.toLowerCase()==="null")switch(o){case"=":return l.isNull();case"!=":case"!":return l.isNull().not()}let u=null,h=null;switch(r.startsWith("*")?(u="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(h="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),o){case"~":return l.isNull().not().and(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return u==="*"?l.isNull().or(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):h==="*"?l.isNull().or(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(N.FilterValue.ofString(r.toLowerCase()));case"=":return u==="*"?l.isNull().not().and(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):h==="*"?l.isNull().not().and(l.invoke("matches",N.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(N.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,i,o]=s,r=i==="!"||i==="!=",l=o.trim().toLowerCase();let u=e.filter();try{const h=b.makeBooleanValue(l);return h!=null&&h?u=u.isTrue():h===null?u=u.isNull():u=u.isFalse(),r?u.not():u}catch{return null}}static makeQuickDateFilter(e,t,n){const s=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(o==null||o.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=o;let u=T.eq;switch(r){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return b.makeQuickDateFilterWithOperation(e,l,u,n)}static makeQuickDateFilterWithOperation(e,t,n,s){const[i,o]=q.parseDateRange(t,s),r=i!=null?N.FilterValue.ofNumber(i):null,l=o!=null?N.FilterValue.ofNumber(o):null,u=e.filter();if(r==null)return n===T.notEq?u.isNull().not():u.isNull();switch(n){case T.eq:{if(l!=null){const h=u.greaterThanOrEqualTo(r),p=u.lessThan(l);return h.and(p)}return u.eq(r)}case T.lessThan:return u.lessThan(r);case T.lessThanOrEqualTo:return l!=null?u.lessThan(l):u.lessThanOrEqualTo(r);case T.greaterThan:return l!=null?u.greaterThanOrEqualTo(l):u.greaterThan(r);case T.greaterThanOrEqualTo:return u.greaterThanOrEqualTo(r);case T.notEq:{if(l!=null){const h=u.lessThan(r),p=u.greaterThanOrEqualTo(l);return h.or(p)}return u.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){const n=`${t}`.trim(),i=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let o=null,r=null,l=null;if(i!==null&&i.length>3&&([,o,r,l]=i),l!=null&&l.trim().length>0||r==null||r.length===0)return null;o==null&&(o="=");const u=e.filter();if(r.toLowerCase()==="null")switch(o){case"=":return u.isNull();case"!=":case"!":return u.isNull().not();default:return null}const h=N.FilterValue.ofString(b.isRangeOperation(o)?b.quoteValue(r):r);return b.makeRangeFilterWithOperation(u,o,h)}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Pe.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let i,o,r=!0;const l=new Promise((u,h)=>{o=setTimeout(()=>{i(),r=!1,h(new Ye(`Event "${t}" timed out.`))},n),i=e.addEventListener(t,p=>{if(s!=null&&!s(p)){ue.debug2("Event triggered, but matcher returned false.");return}ue.debug2("Event triggered, resolving."),i(),clearTimeout(o),r=!1,u(p)})});return l.cancel=()=>{if(r){ue.debug2("Pending promise cleanup."),i(),clearTimeout(o),r=!1;return}ue.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:i,invertSelection:o,selectedValues:r}=t;let l=null;for(let h=0;h<s.length;h+=1){const p=s[h],{selectedType:m,value:f}=p;if(m!=null&&m.length>0&&f!=null&&f.length>0)try{const v=b.makeAdvancedValueFilter(e,m,f,n);if(v!=null){if(h===0)l=v;else if(l!==null&&h-1<i.length){const S=i[h-1];if(S===pn.and)l=l.and(v);else if(S===pn.or)l=l.or(v);else{ue.error("Unexpected filter operator",S,v),l=null;break}}}else ue.debug2("Empty filter ignored for",m,f)}catch(v){ue.error("Unable to create filter",v),l=null;break}}const u=b.makeSelectValueFilter(e,r,o);return u!=null&&(l!=null?l=l.and(u):l=u),l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const n=b.getBaseType(e);return b.isTextType(n)?N.FilterValue.ofString(t):b.isLongType(n)?N.FilterValue.ofNumber(N.LongWrapper.ofString(b.removeCommas(t))):N.FilterValue.ofNumber(b.removeCommas(t))}static makeFilterRawValue(e,t){return b.isTextType(e)?N.FilterValue.ofString(t):b.isBooleanType(e)?N.FilterValue.ofBoolean(t):N.FilterValue.ofNumber(t)}static makeValue(e,t,n){if(t==="null")return null;if(b.isTextType(e))return t;if(b.isLongType(e))return N.LongWrapper.ofString(b.removeCommas(t));if(b.isBooleanType(e))return b.makeBooleanValue(t,!0);if(b.isDateType(e)){const[s]=q.parseDateRange(t,n);return s}return b.isNumberType(e)?b.makeNumberValue(t):(ue.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${e}'`)}}static makeNumberValue(e){if(e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=b.removeCommas(t);if(b.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,n,s){if(b.isDateType(e.type))return b.makeQuickDateFilterWithOperation(e,n,t,s);if(b.isNumberType(e.type)||b.isCharType(e.type))return b.makeQuickFilter(e,`${b.getFilterOperatorString(t)}${n}`);const i=b.makeFilterValue(e.type,n),o=e.filter();switch(t){case T.eq:return o.eq(i);case T.eqIgnoreCase:return o.eqIgnoreCase(i);case T.notEq:return o.notEq(i);case T.notEqIgnoreCase:return o.notEqIgnoreCase(i);case T.greaterThan:return o.greaterThan(i);case T.greaterThanOrEqualTo:return o.greaterThanOrEqualTo(i);case T.lessThan:return o.lessThan(i);case T.lessThanOrEqualTo:return o.lessThanOrEqualTo(i);case T.isTrue:return o.isTrue();case T.isFalse:return o.isFalse();case T.isNull:return o.isNull();case T.contains:return o.isNull().not().and(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case T.notContains:return o.isNull().or(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case T.startsWith:return o.isNull().not().and(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case T.endsWith:return o.isNull().not().and(o.invoke("matches",N.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,n){if(t.length===0){if(n)return null;let o=null;b.isTextType(e.type)?o=N.FilterValue.ofString("a"):b.isBooleanType(e.type)?o=N.FilterValue.ofBoolean(!0):b.isDateType(e.type)?o=N.FilterValue.ofNumber(N.DateWrapper.ofJsDate(new Date)):o=N.FilterValue.ofNumber(0);const r=e.filter().eq(o),l=e.filter().notEq(o);return r.and(l)}const s=[];let i=!1;for(let o=0;o<t.length;o+=1){const r=t[o];r==null?i=!0:b.isTextType(e.type)?s.push(N.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):b.isBooleanType(e.type)?s.push(N.FilterValue.ofBoolean(Boolean(r))):s.push(N.FilterValue.ofNumber(r))}return i?s.length>0?n?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const i=n.name.toUpperCase(),o=s.name.toUpperCase();return Ii.sort(i,o,t)})}}class at{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{const s=b.getNormalizedType(n.columnType);return s===null||(t.has(s)||t.set(s,new Map),t.get(s)?.set(n.columnName,n.format)),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e=[],t,n,s,i=!1){this.defaultColumnFormatter=new Qn,this.typeFormatterMap=new Map([[b.dataType.BOOLEAN,new Zn],[b.dataType.CHAR,new Xn],[b.dataType.DATETIME,new he(t)],[b.dataType.DECIMAL,new Q(n)],[b.dataType.INT,new be(s)],[b.dataType.STRING,new Jn]]),this.columnFormatMap=at.makeColumnFormatMap(e),this.truncateNumbersWithPound=i}defaultColumnFormatter;typeFormatterMap;columnFormatMap;truncateNumbersWithPound;getColumnFormatMapForType(e,t=!1){const n=b.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){return this.getColumnFormatMapForType(e)?.get(t)??null}getColumnTypeFormatter(e){const t=b.getNormalizedType(e);let n=this.defaultColumnFormatter;return t&&(n=this.typeFormatterMap.get(t)??n),n}getFormattedString(e,t,n="",s){if(e==null)return"";const i=this.getColumnTypeFormatter(t),o=s||this.getColumnFormat(t,n);return i.format(e,o??void 0)}get timeZone(){return this.typeFormatterMap.get(b.dataType.DATETIME)?.dhTimeZone?.id}}function Yn(a){if(a&&a.formatter){const{formatter:e}=a;return e}}function es(a){return{timeZone:a?.timeZone,defaultDateTimeFormatString:a?.defaultDateTimeFormat,showTimeZone:a?.showTimeZone,showTSeparator:a?.showTSeparator}}function ts(a,e,t){const n=a.getColumnFormat(t,e);return n!=null&&(n.type===G.TYPE_CONTEXT_PRESET||n.type===G.TYPE_CONTEXT_CUSTOM)}const vt={getColumnFormats:Yn,getDateTimeFormatterOptions:es,isCustomColumnFormatDefined:ts},pt=B.module("MessageUtils"),ns="io.deephaven.message.LoginOptions.request",ss="io.deephaven.message.SessionDetails.request",is="io.deephaven.broadcast",as="io.deephaven.broadcast.Login",os="io.deephaven.broadcast.Logout";function ot(a){const e=a;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function rs(a){return ot(a)&&a.message===as}function ls(a){return ot(a)&&a.message===os}function cs(a){const e=a;return e!=null&&typeof e.id=="string"}function us(a,e=Te(),t){return{message:a,id:e,payload:t}}function mo(a,e){return{id:a,payload:e}}async function Ut(a,e=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((t,n)=>{let s;const i=Te(),o=r=>{const{data:l}=r;if(!cs(l)){pt.debug("Ignoring non-deephaven response",l);return}if(pt.debug("Received message",l),l?.id!==i){pt.debug("Ignore message, id doesn't match",l);return}window.clearTimeout(s),window.removeEventListener("message",o),t(l.payload)};window.addEventListener("message",o),s=window.setTimeout(()=>{window.removeEventListener("message",o),n(new Ye("Request timed out"))},e),window.opener.postMessage(us(a,i),"*")})}class ds extends Error{isNoConsolesError=!0}function hs(a){return a.isNoConsolesError}const we=B.module("SessionUtils");function fo(a){return we.info(`Starting connection to '${a}'...`),new dh.IdeConnection(a)}async function ps(a,e){we.info("Getting console types...");const t=await a.getConsoleTypes();if(t.length===0)throw new ds("No console types available");we.info("Available types:",t);const n=t[0];we.info("Starting session with type",n);const s=await a.startSession(n),i={type:n,id:Te.generate()};return we.info("Console session established",i),{session:s,config:i,connection:a,details:e}}function go(a,e){return we.info("createCoreClient",a),new dh.CoreClient(a,e)}function bo(a){return a!=null&&typeof a=="object"}async function Co(){const a=await Ut(ss);if(!bo(a))throw new Error(`Unexpected session details response: ${a}`);return a}async function So(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return Co()}return{}}async function vo(a,e){let t;try{t=await ps(a,e)}catch(n){if(!hs(n))throw n}return t}const Mo=B.module("ViewportDataUtils");function ms(a,e){return String(a.offsetInSnapshot+e)}function fs(a,e,t){return function(s){if(a==null)return;const{offset:i,rows:o}=s.detail;Mo.debug("table updated",s.detail),o.forEach(r=>{const l=t(r,a.columns),u={key:ms(r,i),item:l};e.getItem(u.key)!=null?e.update(u.key,u):e.append(u)})}}function gs(a,e){return e.reduce((t,n)=>(t[n.name]=a.get(n),t),{})}function*bs(a){for(let e=0;e<a;++e)yield{key:String(e)}}function rt(a){return a==null||Kt(a)?0:a.size}function Kt(a){return"isClosed"in a?a.isClosed:!1}function Cs(a,e,t,n){const s=a+e-1,[i,o]=[0,n-1],r=gt(a-t,i,o),l=gt(s+t,i,o);return[r,l]}const yo=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:is,BROADCAST_LOGIN_MESSAGE:as,BROADCAST_LOGOUT_MESSAGE:os,BooleanColumnFormatter:Zn,CharColumnFormatter:Xn,DateTimeColumnFormatter:he,DateUtils:q,DecimalColumnFormatter:Q,DefaultColumnFormatter:Qn,FETCH_TIMEOUT:zn,Formatter:at,FormatterUtils:vt,IntegerColumnFormatter:be,LOGIN_OPTIONS_REQUEST:ns,NoConsolesError:ds,SESSION_DETAILS_REQUEST:ss,StringColumnFormatter:Jn,TableColumnFormatter:G,TableUtils:b,createConnection:fo,createCoreClient:go,createKeyFromOffsetRow:ms,createOnTableUpdatedHandler:fs,createSessionWrapper:ps,defaultRowDeserializer:gs,fetchVariableDefinition:oo,generateEmptyKeyedItems:bs,getColumnFormats:Yn,getDateTimeFormatterOptions:es,getSessionDetails:So,getSize:rt,isBroadcastLoginMessage:rs,isBroadcastLogoutMessage:ls,isClosed:Kt,isCustomColumnFormatDefined:ts,isMessage:ot,isNoConsolesError:hs,isResponse:cs,loadSessionWrapper:vo,makeMessage:us,makeResponse:mo,padFirstAndLastRow:Cs,requestParentResponse:Ut},Symbol.toStringTag,{value:"Module"}));function Ss(a){if(a==null)return!1;const e=a;return e.Component!==void 0&&typeof e.isAvailable=="function"}const vs="io.deephaven.auth.AnonymousAuthenticationHandler",To="io.deephaven.authentication.psk.PskAuthenticationHandler";class Io extends Error{name="AuthenticationError";isAuthenticationError=!0}const Ms=Io,mn=B.module("AuthPluginBase");function _t({children:a,getLoginOptions:e}){const t=Ve(),[n,s]=d.useState(),[i,o]=d.useState(!1);return d.useEffect(()=>{let r=!1;function l(){if(r)throw new bt("Login canceled.")}async function u(){try{const h=await e();l(),mn.info("Logging in..."),await t.login(h),l(),o(!0)}catch(h){if(!r){mn.error("Unable to login:",h);const p=qe(h)??"Unable to login. Verify credentials.";s(new Ms(p)),o(!1)}}}return u(),()=>{r=!0}},[t,e]),i?c.jsx(c.Fragment,{children:a}):c.jsx(Le,{"data-testid":"auth-base-loading",isLoading:n==null,isLoaded:!1,errorMessage:qe(n)})}const Eo=d.createContext({}),Wt=d.createContext({}),xo={canLogout:!1};function wo({children:a}){const e=Oe(),t=d.useCallback(()=>({type:e.CoreClient.LOGIN_TYPE_ANONYMOUS}),[e]);return c.jsx(_t,{getLoginOptions:t,children:c.jsx(Wt.Provider,{value:xo,children:a})})}const No={Component:wo,isAvailable:a=>a.includes(vs)},ko=No,Do=B.module("AuthPluginParent"),Oo={canLogout:!1};function Ao(a){return a!=null&&typeof a.type=="string"}async function Fo(){Do.info("Logging in by delegating to parent window...");const a=await Ut(ns);if(!Ao(a))throw new Error(`Unexpected login options response: ${a}`);return a}function Ro(){return new URLSearchParams(window.location.search).get("authProvider")??""}function Po({children:a}){return c.jsx(_t,{getLoginOptions:Fo,children:c.jsx(Wt.Provider,{value:Oo,children:a})})}const Lo={Component:Po,isAvailable:()=>window.opener!=null&&Ro()==="parent"},jo=Lo,fn=B.module("useTableListener"),$o=(a,e,t)=>d.useEffect(function(){if(a==null){fn.debug2("Emitter undefined, skipping addEventListener",e);return}return fn.debug2("Adding listener",e),a.addEventListener(e,t)},[a,e,t]),Re=$o;class Vo extends Error{isColumnNameError=!0}const Bo=Vo;class Ho extends Error{isTableDisconnectError=!0}const Uo=Ho,Ke=B.module("useTable"),Ko=(a,e,t,n)=>{const s=Oe(),[i,o]=d.useState(void 0),[r,l]=d.useState([]),[u,h]=d.useState(null),[p,m]=d.useState(null);d.useEffect(()=>{if(n===void 0){o(a?.columns),h(null);return}try{o(a?.findColumns(n)),h(null)}catch(C){Ke.error("Column not found",C,n),h(new Bo("Invalid columnNames argument"))}},[a,n]),d.useEffect(()=>{if(!i||!a){Ke.debug2("Table or column not initialized, skip viewport update.");return}Ke.debug2("Setting viewport",e,t),a.setViewport(e,t,i)},[i,a,e,t]);const f=d.useCallback(({detail:C})=>{if(!i){Ke.error("Columns not initialized.");return}const w=i.map(O=>C.rows.map(M=>M.get(O)));l(w)},[i]),v=d.useCallback(()=>{m(new Uo("Table disconnected"))},[]),S=d.useCallback(()=>{m(null)},[]);return Re(a,s.Table.EVENT_UPDATED,f),Re(a,s.Table.EVENT_DISCONNECT,v),Re(a,s.Table.EVENT_RECONNECT,S),{columns:i,data:r,error:p??u}},ys=Ko,_o=(a,e,t,n)=>{const s=d.useMemo(()=>[n],[n]),{columns:i=[],data:o=[],error:r}=ys(a,e,t,s);return{column:i[0],data:o[0],error:r}},Ts=_o;const de=B.module("TableInput"),mt=250;function qt(a){const{className:e=void 0,columnName:t,settings:n,defaultValue:s=[],isInvalid:i=!1,onChange:o=()=>!1,onBlur:r=()=>!1,table:l}=a,u=d.useRef(null),h=d.useMemo(()=>{const R=vt.getColumnFormats(n),I=vt.getDateTimeFormatterOptions(n),{defaultDecimalFormatOptions:H={},defaultIntegerFormatOptions:ne={}}=n;return new at(R,I,H,ne)},[n]),[p,m]=d.useState(""),[f,v]=d.useState(new Set(s)),[S,C]=d.useState(),w=d.useRef(null),O=Math.min(S?.size??0,mt),{column:M,data:F,error:P}=Ts(S,0,mt-1,t),A=d.useCallback(R=>M?h.getFormattedString(R,M.type,M.name):`${R}`,[M,h]),[L,W]=d.useMemo(()=>{const R=new Set(f),I=[];if(F==null)return[I,null];if(F.forEach(H=>{const ne=`${H}`,se=f.has(ne);se&&R.delete(ne),I.push({value:ne,displayValue:A(H),isSelected:se})}),R.size>0){de.debug2("Selection has items that are missing from the viewport");const H=new Set(f);return Array.from(R).forEach(ne=>{H.delete(ne)}),[I,H]}return[I,null]},[F,f,A]);d.useEffect(()=>{W!==null&&(v(W),o(Array.from(W)))},[o,W]);const oe=d.useCallback(async R=>{try{const I=await R;de.debug("Table resolved",I),C(I)}catch(I){if(Pe.isCanceled(I))return;de.error(I)}},[]);d.useEffect(()=>{const R=Pe.makeCancelable(l);return oe(R),()=>{de.debug2("Cancel table promise"),R.cancel()}},[l,oe]);const $=d.useCallback(R=>{const{value:I}=R.target;m(I);const H=L.findIndex(ne=>ne.displayValue.includes(I));H>-1?(de.debug2(`Found ${I} at index ${H}`),w.current?.scrollIntoView(H)):de.debug2(`${I} not found`)},[L,w]),j=d.useCallback(R=>{if(de.debug("handleSelect",R),R>=L.length){de.error("Invalid index",R);return}const I=L[R].value,H=new Set(f);L[R].isSelected?H.delete(I):H.add(I),v(H),o(Array.from(H))},[o,L,f]),U=d.useCallback(()=>{const R=L.map(H=>H.value),I=new Set(R);v(I),o(R)},[L,o]),k=d.useCallback(()=>{v(new Set),o([])},[o]),D=d.useCallback(()=>{},[]),y=d.useCallback(R=>{const{relatedTarget:I}=R;de.debug("handleChildBlur",I,I instanceof HTMLElement,u.current,u.current?.contains(I)),(!I||u.current&&I instanceof HTMLElement&&!u.current.contains(I))&&r()},[r]),V=L.length===0;return c.jsxs("div",{ref:u,className:x("table-input-container d-flex flex-column position-relative",e),children:[c.jsx(nt,{disabled:!!P||V,value:p,placeholder:"Search",onChange:$,className:"mb-2 d-flex",onBlur:y}),c.jsx(Wn,{className:"table-input-list",disabled:S===void 0||V,isInvalid:i,items:V?[{value:"Empty",isSelected:!1}]:L,itemCount:O,offset:0,onSelect:j,onViewportChange:D,ref:w,onBlur:y}),S&&c.jsxs("div",{className:"meta-row",children:[c.jsx("div",{className:"d-flex align-items-center text-muted small",children:S!=null&&S.size>O&&c.jsxs(c.Fragment,{children:["Table is too large, showing the first ",mt," items."]})}),c.jsxs("div",{children:[c.jsx("button",{type:"button",className:"btn btn-link",onBlur:y,onClick:U,children:"Select All"}),c.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:y,onClick:k,children:"Clear"})]})]}),S==null||P&&c.jsx("div",{className:"h-100 w-100 position-absolute",children:c.jsx(Le,{isLoaded:S!=null,isLoading:S==null&&P==null,errorMessage:P?.message??null})})]})}qt.displayName="TableInput";qt.defaultProps={isInvalid:!1,className:void 0};const gn=B.module("useBroadcastChannel");function Is(a=Ci,e=is){const t=d.useMemo(()=>new BroadcastChannel(e),[e]);return d.useEffect(()=>()=>{t.close()},[t]),d.useEffect(()=>{function n(s){const{data:i}=s;if(!ot(i)){gn.debug("Ignoring non-deephaven message",i);return}gn.debug("event received",i),a(s)}return t.addEventListener("message",n),()=>{t.removeEventListener("message",n)}},[t,a]),t}function Gt(a,e){const t=d.useCallback(n=>{rs(n.data)?a?.(n.data):ls(n.data)&&e?.(n.data)},[a,e]);Is(t)}const Qe="io.deephaven.web.client.auth.refreshToken",Es=d.createContext(null),Wo=B.module("RefreshTokenUtils");function Mt(){const a=ke.get(Qe);try{if(a!=null)return JSON.parse(a)}catch(e){Wo.error("Error parsing refresh token",a,e)}return null}function yt(a){if(a==null){ke.remove(Qe);return}const e=JSON.stringify({bytes:a.bytes,expiry:a.expiry}),t=new Date(a.expiry);ke.set(Qe,e,{secure:!0,sameSite:"strict",expires:t})}function qo({children:a}){const e=Oe(),t=Ve(),[n,s]=d.useState(Mt());d.useEffect(function(){return t.addEventListener(e.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,u=>{const{detail:h}=u;yt(h),s(h)})},[e,t,n]);const i=d.useCallback(()=>{s(Mt())},[]),o=d.useCallback(()=>{yt(null),s(null)},[]);return Gt(i,o),c.jsx(Es.Provider,{value:n,children:a})}function xs(a){const e=Us({});return d.useEffect(()=>{a&&(e.items.length&&e.remove(...e.items.map(({key:t})=>t)),e.insert(0,...bs(rt(a))))},[a]),e}function Go(a,...e){const t=d.useCallback(async()=>a?.selectDistinct(a.findColumns(e))??null,[a,...e]),{data:n,error:s,isError:i,isLoading:o}=Dn(t,[]);return d.useEffect(()=>()=>{n?.close()},[n]),{distinctTable:n,error:s,isError:i,isLoading:o}}function ws(a,e,t){return d.useCallback(function(s){const[i,o]=Cs(s,e,t,rt(a));a?.setViewport(i,o)},[a,t,e])}function zo({table:a,viewportSize:e=10,viewportPadding:t=50,deserializeRow:n=gs}){const s=xs(a),i=ws(a,e,t);return Re(a,dh.Table.EVENT_UPDATED,fs(a,s,n)),d.useEffect(()=>{a&&!Kt(a)&&i(0)},[a,i]),{viewportData:s,size:rt(a),setViewport:i}}const Zo=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:Qe,RefreshTokenBootstrap:qo,RefreshTokenContext:Es,TableInput:qt,readRefreshToken:Mt,storeRefreshToken:yt,useBroadcastChannel:Is,useBroadcastLoginListener:Gt,useInitializeViewportData:xs,useSelectDistinctTable:Go,useSetPaddedViewportCallback:ws,useTable:ys,useTableColumn:Ts,useTableListener:Re,useViewportData:zo},Symbol.toStringTag,{value:"Module"}));function Ns({children:a,errorMessage:e,isLoggingIn:t=!1,onSubmit:n}){return c.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),n?.(s)},children:[c.jsx("div",{className:"flex-spacer"}),c.jsxs("div",{className:"flex-wrapper",children:[c.jsx("fieldset",{disabled:t,className:"container-fluid",children:a}),c.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:c.jsxs("button",{type:"submit",className:x("btn btn-primary",{"btn-spinner":t},{"btn-cancelable":t}),"data-testid":"btn-login",children:[t&&c.jsxs("span",{children:[c.jsx(wt,{}),c.jsx("span",{className:"btn-normal-content",children:"Logging in"}),c.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Login"]})})]}),c.jsx("div",{className:"flex-spacer",children:e!=null&&c.jsx("p",{className:"error-message mb-0",role:"alert",children:`${e}`})})]})}function ks({children:a,logoPath:e="./logo.png"}){return c.jsxs("div",{className:"login-container",children:[c.jsx(_n,{}),c.jsxs("div",{className:"login-box",children:[c.jsx("div",{className:"logo",children:c.jsx("img",{src:e,alt:"Deephaven Data Labs"})}),a,c.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const Tt="io.deephaven.authentication.psk.PskAuthenticationHandler",Ds="psk",It="io.deephaven.web.client.auth.psk.token",Ne=B.module("AuthPluginPsk");function Xo(){return new URLSearchParams(window.location.search).get(Ds)}function Qo(){Ne.debug2("clearWindowToken");const a=new URL(window.location.href);a.searchParams.delete(Ds),window.history.replaceState(null,"",a.href)}function bn(){return ke.get(It)??null}function ft(a){Ne.debug2("Storing token in cookie",a),a!=null?ke.set(It,a,{secure:!0,sameSite:"strict"}):ke.remove(It)}function Jo({children:a,logoPath:e}){const t=Ve(),n=d.useRef(null),s=d.useRef(null),[i,o]=d.useState(),[r,l]=d.useState(!1),[u,h]=d.useState(!1),[p,m]=d.useState(!1),[f,v]=d.useState(""),S=d.useCallback(async(F,P=!0)=>{Ne.info("Logging in..."),m(!0);let A=null;try{if(A=t.login({type:Tt,token:F}),s.current=A,await A,Ne.info("Logged in successfully"),s.current!==A)return;ft(F),h(!0)}catch(L){if(s.current!==A)return;if(l(!0),P){Ne.error("Unable to login",L);const W=qe(L)??"Unable to login: Verify credentials.";o(new Ms(W))}}m(!1)},[t]),C=d.useCallback(()=>{s.current=null,m(!1)},[]),w=d.useCallback(async()=>{Ne.debug("onLogin");const F=bn();u||p||F==null||S(F,!1)},[u,p,S]),O=d.useCallback(()=>{ft(null)},[]);Gt(w,O),d.useEffect(()=>{let F=!1;async function P(){const A=Xo()??bn();if(Qo(),A==null){l(!0);return}m(!0);try{await t.login({type:Tt,token:A}),F||(ft(A),h(!0),m(!1))}catch{F||(l(!0),m(!1))}}return P(),()=>{F=!0}},[t]);const M=d.useCallback(()=>{p?C():S(f)},[C,p,S,f]);return d.useEffect(function(){n.current?.focus()},[n,r]),c.jsxs(c.Fragment,{children:[u&&a,r&&c.jsx(ye,{in:!u,timeout:ce.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:c.jsx(ks,{logoPath:e,children:c.jsx(Ns,{errorMessage:qe(i),isLoggingIn:p,onSubmit:M,children:c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),c.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:n,value:f,onChange:F=>{o(void 0),v(F.target.value)}})]})})})}),c.jsx(Le,{"data-testid":"auth-psk-loading",isLoaded:u||r,isLoading:!u&&!r})]})}const Yo={Component:Jo,isAvailable:a=>a.includes(Tt)},er=Yo,tr=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:vs,AUTH_HANDLER_TYPE_PSK:To,AuthPluginAnonymous:ko,AuthPluginBase:_t,AuthPluginParent:jo,AuthPluginPsk:er,Login:ks,LoginForm:Ns,UserOverrideContext:Eo,UserPermissionsOverrideContext:Wt,isAuthPlugin:Ss},Symbol.toStringTag,{value:"Module"})),Os={react:E,"react-dom":Cn,redux:Ks,"react-redux":_s,"@deephaven/auth-plugins":tr,"@deephaven/components":to,"@deephaven/jsapi-bootstrap":io,"@deephaven/jsapi-components":Zo,"@deephaven/jsapi-utils":yo,"@deephaven/log":ui,"@deephaven/react-hooks":wi},nr=vn.createRequires(()=>Os),sr=vn.createRemoteComponent({requires:nr}),ir=sr,ar=Ws.createRequires(Os),or=qs({requires:ar}),rr=or,Ce=B.module("@deephaven/app-utils.PluginUtils");function vr(a,e){const t=new URL(`${e}.js`,a),n=E.forwardRef((s,i)=>c.jsx(ir,{url:t.href,render:({err:o,Component:r})=>{if(o!=null&&o!==""){const l=`Error loading plugin ${e} from ${t} due to ${o}`;return Ce.error(l),c.jsx("div",{className:"error-message",children:`${l}`})}return c.jsx(r,{ref:i,...s})}}));return n.pluginName=e,n.displayName="Plugin",n}async function lr(a){return await rr(a)}async function cr(a){const e=await fetch(a);if(!e.ok)throw new Error(e.statusText);try{return await e.json()}catch{throw new Error("Could not be parsed as JSON")}}async function ur(a){Ce.debug("Loading plugins...");try{const e=await cr(`${a}/manifest.json`);if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");Ce.debug("Plugin manifest loaded:",e);const t=[];for(let i=0;i<e.plugins.length;i+=1){const{name:o,main:r}=e.plugins[i],l=`${a}/${o}/${r}`;t.push(lr(l))}const n=await Promise.allSettled(t),s=new Map;for(let i=0;i<n.length;i+=1){const o=n[i],{name:r}=e.plugins[i];o.status==="fulfilled"?s.set(r,o.value):Ce.error(`Unable to load plugin ${r}`,o.reason)}return Ce.info("Plugins loaded:",s),s}catch(e){return Ce.error("Unable to load plugins:",e),new Map}}function dr(a){return a.get("AuthHandlers")?.split(",")??[]}function Mr(a,e,t){const n=dr(e),s=[...a.entries()].filter(([,l])=>Ss(l.AuthPlugin)).map(([l,u])=>[l,u.AuthPlugin]);s.push(...t??[]);const i=s.filter(([l,u])=>u.isAvailable(n,e));if(i.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${n}`);i.length>1&&Ce.warn("More than one login plugin available, will use the first one: ",i.map(([l])=>l).join(", "));const[o,r]=i[0];return Ce.info("Using LoginPlugin",o),r.Component}const As=d.createContext(null);function yr({pluginsUrl:a,children:e}){const[t,n]=d.useState(null);return d.useEffect(function(){let i=!1;async function o(){const r=await ur(a);i||n(r)}return o(),()=>{i=!0}},[a]),c.jsx(As.Provider,{value:t,children:e})}const hr=B.module("@deephaven/jsapi-components.ConnectionBootstrap"),Fs=d.createContext(null);function Tr({children:a}){const e=Oe(),t=Ve(),[n,s]=d.useState(),[i,o]=d.useState();return d.useEffect(function(){let l=!1;async function u(){try{const h=await t.getAsIdeConnection();if(l)return;o(h)}catch(h){if(l)return;s(h)}}return u(),()=>{l=!0}},[e,t]),d.useEffect(function(){if(i==null)return;function l(h){const{detail:p}=h;hr.info("Shutdown",`${JSON.stringify(p)}`),s(`Server shutdown: ${p??"Unknown reason"}`)}return i.addEventListener(e.IdeConnection.EVENT_SHUTDOWN,l)},[e,i]),i==null||n!=null?c.jsx(Le,{"data-testid":"connection-bootstrap-loading",isLoading:i==null,errorMessage:n!=null?`${n}`:void 0}):c.jsx(Fs.Provider,{value:i,children:a})}function Ir(){return $e(As,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}function Er(){return $e(Fs,"No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?")}export{le as $,va as A,te as B,ji as C,jn as D,fr as E,vt as F,$a as G,ya as H,ae as I,De as J,Z as K,ba as L,Y as M,Ki as N,pn as O,Pe as P,ia as Q,Ma as R,ve as S,Ae as T,Un as U,Sa as V,Ca as W,Nn as X,Di as Y,Va as Z,Oi as _,yi as a,Ft as a0,An as a1,da as a2,Bi as a3,Hi as a4,_ as a5,is as a6,us as a7,os as a8,Ni as a9,ur as aA,dr as aB,ki as aa,Ve as ab,Er as ac,Ir as ad,Eo as ae,Wt as af,So as ag,vo as ah,Is as ai,as as aj,As as ak,Mr as al,qe as am,er as an,jo as ao,ko as ap,Gt as aq,yr as ar,so as as,qo as at,Tr as au,Fs as av,ir as aw,vr as ax,lr as ay,cr as az,Ii as b,ze as c,nt as d,bt as e,Nt as f,vi as g,T as h,b as i,q as j,at as k,br as l,gr as m,K as n,G as o,he as p,Q as q,be as r,N as s,_i as t,wn as u,Wn as v,Sr as w,ma as x,pa as y,Aa as z};
5
+ //# sourceMappingURL=useConnection-dbff5b5b.js.map