@deephaven/embed-grid 0.60.0 → 0.60.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{App-7325f3c2.js → App-15b782bc.js} +2 -2
- package/build/assets/{App-7325f3c2.js.map → App-15b782bc.js.map} +1 -1
- package/build/assets/index-2a61ac6c.js +4 -0
- package/build/assets/index-2a61ac6c.js.map +1 -0
- package/build/assets/{index-3ceb39a9.js → index-688389f2.js} +2 -2
- package/build/assets/{index-3ceb39a9.js.map → index-688389f2.js.map} +1 -1
- package/build/assets/{useUser-e3418c5c.js → useUser-85db11d2.js} +2 -2
- package/build/assets/{useUser-e3418c5c.js.map → useUser-85db11d2.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +14 -14
- package/build/assets/index-0da08abc.js +0 -4
- package/build/assets/index-0da08abc.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{C as h,$ as Il,H as ka,I as ar,F as pe,J as $a,r as c,K as Ze,L as Le,M as xl,N as Ba,O as Al,P as Wa,Q as Ml,S as Nl,T as ri,U as ot,G as q,E as X,V as E,W as Ll,D as Kt,X as Ua,Y as jl,Z as Fl,_ as Rl,a0 as kl,a1 as Va,a2 as $l,a3 as Bl,a4 as mt,a5 as Ha,a6 as ze,a7 as An,a8 as L,R as za,a9 as ii,aa as Wl,ab as or,ac as Ga,ad as sr,ae as Ul,af as Vl,ag as Hl,ah as zl,ai as Gl,aj as Ka}from"./vendor-55c836cf.js";import{L as H,i as Kl,v as Xa,M as lr,b as ur,c as Ya,d as Xl,e as Yl,a as Ee,f as qa,g as ql,h as Zl,r as dr,j as Ae,k as Jl,l as Ql,m as eu,T as Xt,C as tu,D as nu,n as ru,o as iu,p as au,q as Za,N as ou,S as su,s as lu,t as uu,W as du,u as cu,w as hu,x as fu,y as vu,z as pu,A as mu,B as Ja,E as Qa,F as gu,G as bu,H as yu,I as _u,J as wu,K as Su,O as Cu,P as Eu,Q as on,R as Pu,U as Tu,V as ai,X as Ou,Y as Du,Z as Iu,_ as xu}from"./index-688389f2.js";import{T as sn,g as Au,c as bt,d as Mu,e as Nu,h as eo,P as ln,B as _e,i as zt,M as cr,D as to,j as no,k as Lu,S as hr,R as oi,l as Mn,m as Nn,n as ro,o as Ln,p as It,q as ju,r as Fu,s as Ru,C as ku,t as io,v as $u,w as Bu,G as Wu,x as Uu,K as Vu,y as Hu,z as zu,A as Gu,O as Ku,E as Xu,F as Yu,H as qu,J as Zu,L as ao,N as Ju,Q as Qu,U as ed,V as td,W as oo,X as nd,Y as rd,Z as id,_ as ad,$ as Te,a0 as od,a1 as sd,a2 as ld,a3 as ud,a4 as so,a5 as dd,a6 as cd,a7 as hd,a8 as un,a9 as ct,aa as fd,ab as vd,ac as pd,ad as Et,ae as md,af as fr,ag as gd,ah as lo,ai as uo,aj as vr,ak as pr,al as co,am as ho,an as fo,f as bd,ao as vo,ap as yd,aq as _d,ar as mr,as as Yt,at as wd,au as po,av as si,aw as Sd,ax as Cd,ay as mo,az as Ed,u as Pd,aA as Td,aB as dn,aC as go,aD as bo,aE as Od,aF as Dd,aG as Id,I as li,aH as xd,aI as Ad,aJ as Md,aK as Nd,aL as Ld,aM as jd,aN as Fd,aO as Rd,aP as kd,aQ as $d,aR as Bd,aS as Wd,aT as Ud,aU as Vd,aV as Hd,aW as zd,b as Gd,aX as Kd,aY as Xd,aZ as Yd,a_ as qd,a$ as Zd,b0 as yo,b1 as Jd,b2 as Qd,b3 as ec,b4 as tc,b5 as nc,b6 as rc,b7 as ic,b8 as ac,b9 as oc,ba as sc,bb as lc,bc as uc,bd as dc,be as cc,bf as hc,bg as fc,bh as vc}from"./useUser-85db11d2.js";import{a as My}from"./useUser-85db11d2.js";import{c as _n,P as gr,b as pc,h as mc,p as gc,o as bc,s as yc,t as _c}from"./plotly-8efd3cf5.js";import"./helpers-de833af9.js";import"./monaco-b1c26518.js";function gt(n){var e=n;n instanceof CustomEvent&&(e=n.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}var _o=24,wc=32,Sc=33,Cc=150,wo=200,So=500,Co=250,Ec={spellCheck:!1},Pc=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange","tooltip"];function ui(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function di(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ui(Object(t),!0).forEach(function(r){Tc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ui(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Tc(n,e,t){return e=Oc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Oc(n){var e=Dc(n,"string");return typeof e=="symbol"?e:String(e)}function Dc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ic(n,e){if(n==null)return{};var t=xc(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function xc(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Eo(n){var{ariaLabel:e,icon:t,isQuiet:r,labelText:i,children:a,onOpenChange:o,tooltip:s}=n,l=Ic(n,Pc),u=i==null&&s!=null?"action-button-icon-with-tooltip":void 0;return h.jsxs(Il,{type:"popover",onOpenChange:o,children:[h.jsxs(ka,di(di({},l),{},{"aria-label":e??i,isQuiet:r,children:[h.jsx(ar,{UNSAFE_className:u,children:h.jsx(pe,{icon:t})}),i==null?null:h.jsx($a,{children:i}),s==null?null:h.jsx(sn,{children:s})]})),a]})}function Ac(n,e){return n===0?0:e==="all"||n===e.size?"all":e.size}function Po(n,e){return n===e?!0:n==="all"||e==="all"||n.size!==e.size?!1:[...n.keys()].every(t=>e.has(t))}function To(n,e){return n.isInverted===e.isInverted&&Po(n.selection,e.selection)}function Oo(n,e,t){if(n==="all")return"all";var r=[...n.keys()];return new Set(r.map(i=>t(e(i))))}function Do(n,e){var t=n==="all"||n.size>e/2,r=n;return t&&(r=n==="all"?new Set:new Set([...Au(0,e-1)].filter(i=>!n.has(String(i))).map(i=>String(i)))),{selection:r,isInverted:t}}function Mc(n,e){return n?{}:{errorMessage:e,validationState:"invalid"}}function Io(n){var e;return(e=n==null?void 0:n.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function Nc(n){var e=n==null?void 0:n.UNSAFE_getDOMNode().lastElementChild;return xo(e)}function Lc(n){var e=n==null?void 0:n.UNSAFE_getDOMNode(),t=e==null?void 0:e.querySelector("input"),r=t==null?void 0:t.getAttribute("aria-controls"),i=r==null?null:document.getElementById(r);return i}function xo(n){return n instanceof HTMLElement?n:null}function Ao(){var n=c.useRef(!1);return c.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function ci(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function jc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ci(a,r,i,o,s,"next",l)}function s(l){ci(a,r,i,o,s,"throw",l)}o(void 0)})}}var Fc=H.module("useAsyncInterval");function Rc(n,e){var t=Ao(),r=c.useRef(0),i=c.useRef(0),a=c.useRef(null),o=c.useCallback(jc(function*(){var s=Date.now();i.current+=1;var l=a.current==null?e:s-a.current;a.current=s;try{yield n()}catch(f){Fc.error("A tick error occurred:",f)}if(t.current){l+=Date.now()-a.current;var u=Math.max(0,l-e),d=Math.max(0,e-u);r.current=window.setTimeout(o,d)}}),[n,t,e]);c.useEffect(()=>(a.current=null,o(),()=>{window.clearTimeout(r.current)}),[e,o])}function kc(n,e){return c.useCallback(function(){var t=n(...arguments);return e(),t},[e,n])}function qt(n,e){var t=c.useMemo(()=>Ze(n,e),[n,e]);return c.useEffect(()=>()=>t.cancel(),[t]),t}function $c(n){var[e,t]=c.useState(n);return c.useEffect(()=>{t(n)},[n]),[e,t]}function Bc(n,e,t,r){var i=c.useRef(0);c.useEffect(()=>{i.current>=t||r&&(i.current+=1,n())},[t,r,...e])}function Mo(n,e){var t=c.useRef(n),r=e(t.current,n)?t.current:n;return t.current=r,r}function Wc(n){n.preventDefault()}function No(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=c.useMemo(()=>"useSubmitButtonRef-".concat(Le()),[]),t=c.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),r=c.useMemo(()=>({id:e,onSubmit:n?void 0:Wc}),[e,n]),i=c.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:r,submitButtonProps:i}}function Lo(n,e){return c.useCallback(t=>{typeof n=="function"?n(e(t)):n.current=e(t)},[e,n])}function jo(n,e){var{getItem:t,selectedKeys:r,items:i}=n;return c.useMemo(()=>{var{selection:a,isInverted:o}=Do(r,i.length);return{selection:Oo(a,t,e),isInverted:o}},[r,i.length,t,e])}function Uc(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Kl,t=c.useRef();return c.useEffect(()=>()=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t)},[]),c.useCallback(r=>{var i;(i=t.current)===null||i===void 0||i.call(t);var a=e(r);a&&(a.addEventListener("scroll",n),t.current=()=>{a.removeEventListener("scroll",n),t.current=void 0})},[e,n])}function hi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Vc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){hi(a,r,i,o,s,"next",l)}function s(l){hi(a,r,i,o,s,"throw",l)}o(void 0)})}}function Hc(n,e,t){var r=c.useRef(null),[i,a]=c.useState(null),o=c.useCallback(Vc(function*(){if(!(i==null||t==null)){var l=yield t();i.scroll(0,l)}}),[t,i]);c.useEffect(()=>(i==null||i.addEventListener("scroll",e),o(),()=>{i==null||i.removeEventListener("scroll",e)}),[e,i,o]);var s=c.useCallback(l=>{l&&setTimeout(()=>{a(n(r.current))},0)},[n]);return{ref:r,onOpenChange:s}}function fi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function zc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){fi(a,r,i,o,s,"next",l)}function s(l){fi(a,r,i,o,s,"throw",l)}o(void 0)})}}function Pt(n,e){var{autoLoad:t=!0}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},[r,i]=c.useState(null),[a,o]=c.useState(null),[s,l]=c.useState(!1),u=c.useCallback(zc(function*(){l(!0);try{var d=yield n(...e);i(d),o(null)}catch(f){i(null),o(f)}finally{l(!1)}}),[n,...e]);return c.useEffect(()=>{t&&u()},[t,u]),{data:r,error:a,isError:a!=null,isLoading:s,reload:u}}function vi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vi(Object(t),!0).forEach(function(r){Gc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Gc(n,e,t){return e=Kc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kc(n){var e=Xc(n,"string");return typeof e=="symbol"?e:String(e)}function Xc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Yc(n,e,t,r){var i=arguments.length===4;return c.useCallback(a=>{var o=i?a??r:a;t(pi(pi({},n),{},{[e]:o}))},[t,n,e,i,r])}function Fo(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=c.useRef(),i=c.useRef(0);return c.useCallback(a=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{var o=Math.floor(a.target.scrollTop/n);i.current!==o&&(i.current=o,e(o))},t)},[t,n,e])}function cn(n,e){var[t,r]=c.useState(n);return c.useEffect(()=>{var i=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(i)}},[n,e]),t}function Ro(n,e){return c.useCallback(t=>{if(t!=null){var r=e==null?[t]:t.querySelectorAll(e);r.forEach(i=>{Object.entries(n).forEach(a=>{var[o,s]=a;i.setAttribute(o,s)})})}},[n,e])}function qc(n){var e=Ro(Ec,n);return Lo(e,Io)}function ko(){var{getKey:n=$o}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=c.useState([]),[r,i]=c.useState(()=>new Set),a=c.useCallback(m=>g=>n(g)===m,[n]),o=c.useCallback(m=>{var g;return(g=e.find(a(m)))!==null&&g!==void 0?g:null},[e,a]),s=c.useCallback(m=>{var g=o(m);if(g==null)throw new Error("No item found matching key: ".concat(m));return g},[o]),l=c.useCallback(m=>{t(g=>[...g,...m])},[]),u=c.useCallback((m,g)=>{t(b=>[...b.slice(0,m),...g,...b.slice(m)])},[]),d=c.useCallback(m=>{var g=new Set(m);t(b=>b.filter(_=>!g.has(n(_))))},[n]),f=c.useCallback((m,g)=>{var b=e.findIndex(a(m));b!==-1&&t(_=>[..._.slice(0,b),g,..._.slice(b+1)])},[e,a]),v=c.useCallback(m=>{if(m.size!==0){var g=[],b=new Map;for(var _ of m.keys()){var S=e.findIndex(a(_));g.push(S),b.set(S,_)}g.sort((T,y)=>T-y);var w=[];e.forEach((T,y)=>{if(g[0]===y){var O=b.get(g.shift()),M=m.get(O);w.push(M)}else w.push(T)}),t(w)}},[e,a]),p=c.useMemo(()=>({items:e,selectedKeys:r,append:l,bulkUpdate:v,findItem:o,getItem:s,insert:u,remove:d,setItems:t,setSelectedKeys:i,update:f}),[l,v,o,s,u,e,d,t,r,f]);return p}function $o(n){var e=n!=null&&typeof n=="object"&&"key"in n;if(!e)throw new Error("Item does not have a `key` prop.");return n.key}function br(n,e){c.useEffect(()=>{if(n!=null){var t=new window.ResizeObserver(e);return t.observe(n),()=>{n!=null&&t.unobserve(n)}}},[n,e])}const Zc=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:Mc,defaultGetKey:$o,extractSpectrumHTMLElement:Io,extractSpectrumLastChildHTMLElement:Nc,findSpectrumComboBoxScrollArea:Lc,getSelectedItemCountOrAll:Ac,identityExtractHTMLElement:xo,isSelectionEqual:Po,isSelectionMaybeInvertedEqual:To,mapSelection:Oo,optimizeSelection:Do,useAsyncInterval:Rc,useCallbackWithAction:kc,useContextOrThrow:bt,useCopyToClipboard:Mu,useDebouncedCallback:qt,useDebouncedValue:cn,useDependentState:$c,useEffectNTimesWhen:Bc,useFormWithDetachedSubmitButton:No,useForwardedRef:Nu,useIsEqualMemo:Mo,useIsMountedRef:Ao,useMappedRef:Lo,useMappedSelection:jo,useOnScrollOffsetChangeCallback:Fo,useOnScrollRef:Uc,usePopoverOnScrollRef:Hc,usePrevious:eo,usePromiseFactory:Pt,usePropChangeCallback:Yc,useResizeObserver:br,useSetAttributesCallback:Ro,useSpectrumDisableSpellcheckRef:qc,useWindowedListData:ko},Symbol.toStringTag,{value:"Module"})),Jc="_spectrumActionBar_tmmkp_5",Qc="_spectrumDialogComponentHeading_tmmkp_9",eh="_spectrumEllipsis_tmmkp_14",yr={spectrumActionBar:Jc,spectrumDialogComponentHeading:Qc,spectrumEllipsis:eh};function mi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ft(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mi(Object(t),!0).forEach(function(r){th(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function th(n,e,t){return e=nh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nh(n){var e=rh(n,"string");return typeof e=="symbol"?e:String(e)}function rh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Bo(n){var{heading:e,confirmationButtonLabel:t,children:r,onCancel:i,onConfirm:a}=n,{formProps:o,submitButtonProps:s}=No();return h.jsxs(xl,{children:[h.jsx(Ba,{level:3,UNSAFE_className:yr.spectrumDialogComponentHeading,children:e}),h.jsx(Al,{}),h.jsx(Wa,{children:h.jsx(Ml,Ft(Ft({},o),{},{children:r}))}),h.jsxs(Nl,{children:[h.jsx(ri,{variant:"secondary",onPress:i,children:"Cancel"}),h.jsx(ri,Ft(Ft({},s),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function ih(n){var{ariaLabel:e,heading:t,confirmationButtonLabel:r,isHidden:i,children:a,tooltip:o,onConfirm:s}=n,l=c.useCallback(u=>h.jsx(Bo,{heading:t,confirmationButtonLabel:r,onCancel:u,onConfirm:()=>{u(),s()},children:a}),[a,r,t,s]);return h.jsx(Eo,{ariaLabel:e,icon:Xa,isHidden:i,isQuiet:!0,height:_o,tooltip:o,children:l})}var ah=["icon","label","tooltip"];function gi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gi(Object(t),!0).forEach(function(r){oh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function oh(n,e,t){return e=sh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sh(n){var e=lh(n,"string");return typeof e=="symbol"?e:String(e)}function lh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function uh(n,e){if(n==null)return{};var t=dh(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function dh(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Wo(n){var{icon:e,label:t,tooltip:r}=n,i=uh(n,ah);return h.jsxs(ka,bi(bi({},i),{},{"aria-label":t,isQuiet:!0,height:_o,children:[h.jsx(ar,{UNSAFE_className:r==null?void 0:"action-button-icon-with-tooltip",children:h.jsx(pe,{icon:e})}),r==null?null:h.jsx(sn,{children:r})]}))}Wo.displayName="IconActionButton";function yi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ch(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yi(Object(t),!0).forEach(function(r){Me(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):yi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Me(n,e,t){return e=hh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hh(n){var e=fh(n,"string");return typeof e=="symbol"?e:String(e)}function fh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vh=100,jn;(function(n){n.UP="UP",n.DOWN="DOWN"})(jn||(jn={}));class Se extends c.Component{constructor(e){super(e),Me(this,"popper",void 0),Me(this,"cbContainer",void 0),Me(this,"menuContainer",void 0),Me(this,"input",void 0),Me(this,"getCachedFilteredOptions",ot((r,i)=>r.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=ch({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=Ze(this.updateInputValue,vh),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=q.createRef(),this.cbContainer=q.createRef(),this.menuContainer=q.createRef(),this.input=q.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};var{options:t}=this.props,r=t.filter(i=>i.title.toLowerCase()===e.toLowerCase());return r.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:r[0].value,isValid:!0})}updateInputValue(e){var{menuIsOpen:t}=this.state,{value:r,isValid:i}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(r,i)}fireOnChange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{onChange:r}=this.props;r(e,t)}processFilterChange(e){var t,{options:r}=this.props,{menuIsOpen:i}=this.state,a=e?this.getCachedFilteredOptions(r,e):r,o=a.length===1&&a[0].title===e;if(this.setState({filteredOptions:a,keyboardOptionIndex:0}),o&&i){this.closeMenu();return}(t=this.popper.current)===null||t===void 0||t.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var t,{filteredOptions:r,keyboardOptionIndex:i}=this.state,a=r[i];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),a!=null&&(this.setState({title:a.title,invalid:!1}),this.fireOnChange(a.value)),this.closeMenu(),(t=this.input.current)===null||t===void 0||t.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(Se.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(Se.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(Se.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(Se.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){var{filteredOptions:t,keyboardOptionIndex:r}=this.state,i=r;e===Se.MENU_NAVIGATION_DIRECTION.UP?r>0?(i=(i-1)%t.length,this.setState({keyboardOptionIndex:i})):r===0&&(i=t.length-1,this.setState({keyboardOptionIndex:i})):e===Se.MENU_NAVIGATION_DIRECTION.DOWN&&r<t.length&&(i=(i+1)%t.length,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i)}handleInputKeyDown(e){var{onEnter:t}=this.props,{menuIsOpen:r}=this.state;r?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){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)===null||t===void 0||t.focus()}handelInputFocus(){var{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){var{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){var{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(){var e;(e=this.input.current)===null||e===void 0||e.focus()}handleMenuExited(){var{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){var{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)===null||t===void 0||t.show()})}closeMenu(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),t){var r;(r=this.input.current)===null||r===void 0||r.focus()}(e=this.popper.current)===null||e===void 0||e.hide()}scrollOptionIntoView(e){if(this.menuContainer.current){var t;(t=this.menuContainer.current.children.item(e))===null||t===void 0||t.scrollIntoView({behavior:"smooth",block:"nearest"})}}renderMenuElement(){var{inputWidth:e}=this.state;return h.jsx("div",{className:X("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){var{noMatchText:e}=this.props,{title:t,filteredOptions:r}=this.state;return t&&r.length===0?h.jsx("div",{className:"no-match",children:e}):r.map((i,a)=>this.renderOption(i,a))}renderOption(e,t){var{keyboardOptionIndex:r}=this.state,i="option-".concat(t,"-").concat(e.value);return h.jsx("button",{type:"button",className:X("aci-option-btn",{"keyboard-active":r===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},i)}render(){var{options:e,inputPlaceholder:t,disabled:r,className:i,defaultTitle:a,spellCheck:o,"data-testid":s}=this.props,{title:l,menuIsOpen:u,popperOptions:d,invalid:f}=this.state;return h.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[h.jsx("input",{value:l||a,className:X("form-control",i,"aci-input",{"is-invalid":f&&!u}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:r,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":s}),h.jsx(ln,{ref:this.popper,options:d,className:X("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}Me(Se,"propTypes",{options:E.arrayOf(E.shape({title:E.string.isRequired,value:E.string.isRequired})).isRequired,popperOptions:E.shape({}),onChange:E.func,inputPlaceholder:E.string,disabled:E.bool,className:E.string,defaultTitle:E.string,spellCheck:E.bool,onEnter:E.func,noMatchText:E.string,"data-testid":E.string});Me(Se,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});Me(Se,"MENU_NAVIGATION_DIRECTION",jn);const ph=Se;function _r(n){var{className:e="",value:t,onChange:r,spellCheck:i=!1,placeholder:a="",disabled:o=!1,delimiter:s="",id:l="","data-testid":u}=n,[d,f]=c.useState(t),[v,p]=c.useState(!1),m=c.useRef(null);c.useEffect(function(){f(t)},[t]);function g(M){return M.trim().split(s).filter(A=>A).join(`
|
|
2
|
+
`.concat(s.trim()))}function b(M){return M.split(`
|
|
3
|
+
`).map(A=>A.trim()).join(" ")}function _(){if(m.current){m.current.style.height="0";var M=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);M>0&&(m.current.style.height="".concat(M,"px"))}}function S(M){var A=M.target.value;v&&(s&&(A=g(A)),p(!1)),f(A),r(A)}function w(){m.current&&(s&&(f(g(d)),_()),m.current.scrollLeft=0)}function T(){m.current&&document.activeElement!==m.current&&m.current.focus()}function y(){s&&(f(b(d)),r(b(d)))}function O(){p(!0)}return c.useEffect(function(){_()},[d]),h.jsx("textarea",{ref:m,id:l,className:X(e,"auto-resize-textarea form-control"),placeholder:a,value:d,rows:1,onChange:S,onFocus:w,onMouseDown:T,onBlur:y,onPaste:O,spellCheck:i,disabled:o,"data-testid":u})}_r.propTypes={value:E.string.isRequired,onChange:E.func.isRequired,className:E.string,placeholder:E.string,spellCheck:E.bool,disabled:E.bool,delimiter:E.string,id:E.string,"data-testid":E.string};_r.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function xt(n){var{children:e,className:t,style:r,"data-testid":i}=n;return h.jsx("div",{className:X("btn-group",t),style:r,role:"group","data-testid":i,children:e})}xt.displayName="ButtonGroup";xt.propTypes={children:E.node.isRequired,className:E.string,style:E.object,"data-testid":E.string};xt.defaultProps={className:null,style:{},"data-testid":void 0};function mh(n){var{blockInteraction:e=!0,children:t,debounceMs:r,isOpen:i=!1}=n,a=cn(i,r);return h.jsxs(h.Fragment,{children:[e&&i&&h.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),q.cloneElement(t,{isOpen:i&&a})]})}function gh(n){var{className:e,icon:t,isOpen:r=!1,subtitle:i,title:a}=n;return h.jsx(lr,{isOpen:r,className:e,children:h.jsx(ur,{children:h.jsxs("div",{className:"info-modal",children:[t!=null&&h.jsx("div",{className:"message-icon",children:h.jsx(pe,{icon:t})}),h.jsx("div",{className:"message-header",children:a}),i!=null&&h.jsx("div",{className:"message-content",children:i})]})})})}function Uo(n){var{className:e="modal-footer",children:t,"data-testid":r}=n;return h.jsx("div",{className:e,"data-testid":r,children:t})}function wr(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:a,onDiscard:o,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:d="Discard",isConfirmDanger:f=!1,children:v,"data-testid":p}=n,m=c.useRef(null),g=c.useRef(null),b=c.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),a()},[a,s]),_=c.useCallback(()=>{var w;(w=m.current)===null||w===void 0||w.focus()},[]),S="";return e&&(S=typeof r=="function"?r():r),h.jsxs(lr,{isOpen:e,onOpened:_,children:[h.jsx(Ya,{closeButton:!1,children:t}),h.jsx(ur,{children:S}),h.jsxs(Uo,{children:[s&&h.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[h.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),h.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&h.jsx(_e,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:d}),i&&h.jsx(_e,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),h.jsxs(xt,{children:[h.jsx(_e,{kind:f?"danger":"primary",onClick:b,ref:m,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:u}),v]})]})]})}wr.propTypes={isOpen:E.bool.isRequired,headerText:E.string.isRequired,bodyText:E.oneOfType([E.string,E.func]).isRequired,onCancel:E.func,onConfirm:E.func.isRequired,onDiscard:E.func,onModalDisable:E.func,cancelButtonText:E.string,confirmButtonText:E.string,discardButtonText:E.string,children:E.node,"data-testid":E.string};wr.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var hn=q.forwardRef((n,e)=>{var{children:t,className:r,disabled:i,onClick:a,style:o,id:s}=n;return h.jsx("button",{ref:e,type:"button",className:X("btn",r),onClick:a,style:o,disabled:i,id:s,children:t})});hn.displayName="Button";hn.propTypes={children:E.node,className:E.string,disabled:E.bool,onClick:E.func,style:E.shape({}),id:E.string};hn.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const bh=hn;function _i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_i(Object(t),!0).forEach(function(r){yh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_i(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yh(n,e,t){return e=_h(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _h(n){var e=wh(n,"string");return typeof e=="symbol"?e:String(e)}function wh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Sh(n){var{styleProps:e,selectedItemCount:t,onClearSelection:r}=n;return h.jsx(Ll,wi(wi({UNSAFE_className:yr.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:r}))}function Ch(n){var{className:e,isFlipped:t,children:r,"data-testid":i}=n,a=u=>{if(r.length!==2)throw new Error("CardFlip requires 2 children to function");return r[u]},o=c.useRef(null),s=c.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=c.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return c.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",s);var d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",s)}},[s]),h.jsxs("div",{className:X(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[h.jsx("div",{className:"card-flip--back",children:a(0)}),h.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}function Vo(n,e,t){return e=Eh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Eh(n){var e=Ph(n,"string");return typeof e=="symbol"?e:String(e)}function Ph(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Pe extends c.Component{static handleEnter(e){var t=e;t.style.height="0"}static handleEntering(e){var t=e;t.style.height="".concat(Pe.getHeight(t),"px")}static handleExiting(e){var t=e;t.style.height="0"}static handleExit(e){var t=e;t.style.height="".concat(Pe.getHeight(t),"px")}static getHeight(e){var t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){var t=e;t.style.height="";var{autoFocusOnShow:r}=this.props;if(r!==void 0&&r){var i=t.querySelector("input, select, textarea");i!=null&&i.focus()}}render(){var{children:e,className:t,in:r,"data-testid":i}=this.props;return h.jsx(Kt,{in:r,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Pe.handleEnter,onEntering:Pe.handleEntering,onEntered:this.handleEntered,onExit:Pe.handleExit,onExiting:Pe.handleExiting,timeout:350,children:a=>h.jsx("div",{className:X({collapse:a==="exited"},t),"data-testid":i,children:e})})}}Vo(Pe,"propTypes",{className:E.string,in:E.bool.isRequired,children:E.node.isRequired,autoFocusOnShow:E.bool,"data-testid":E.string});Vo(Pe,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const Th=Pe;var Oh=H.module("TimeInput"),Dh="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",Ih=["00:00:00","12:34:56","23:59:59"];function Si(n){return n!=null?"".concat(n.substring(0,8).replace(/\u2007/g,"0")).concat("00:00:00".substring(n.length)):n}var Ho=q.forwardRef((n,e)=>{var{allowValueWrapping:t=!0,className:r="",onChange:i=()=>!1,value:a=0,onFocus:o=()=>!1,onBlur:s=()=>!1,onSelect:l=()=>!1,"data-testid":u}=n,[d,f]=c.useState(zt.formatTime(a)),v=c.useRef(a),[p,m]=c.useState(),g=c.useRef(null);c.useImperativeHandle(e,()=>({focus:()=>{var y;(y=g.current)===null||y===void 0||y.focus()},setSelection:y=>{var O;(O=g.current)===null||O===void 0||O.focus(),m(y)}}),[]),c.useEffect(function(){v.current!==a&&(f(zt.formatTime(a)),v.current=a)},[v,a]);function b(y,O,M){var A=y.selectionStart===0?24:60,j=parseInt(M,10)-O;return Number.isNaN(j)?j=0:t?j=(j%A+A)%A:j=Math.min(Math.max(0,j),A-1),"".concat(j).padStart(2,"0")}function _(y,O,M,A,j){return A===0&&j===2&&O===1&&parseInt(M,10)>1?"0".concat(M).concat(y.substring(2)):to(y,O,M)}var S=c.useCallback(y=>{Oh.debug("handleChange",y),f(y),v.current=zt.parseTime(Si(y)),i(v.current)},[i]),w=c.useCallback(()=>{var y=Si(d);y!==d&&f(y),s()},[d,s]),T=c.useCallback(y=>{m(y),l(y)},[l]);return h.jsx(cr,{ref:g,className:r,example:Ih,getNextSegmentValue:b,getPreferredReplacementString:_,onChange:S,onSelect:T,pattern:Dh,selection:p,value:d,onFocus:o,onBlur:w,"data-testid":u})});Ho.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Zt=Ho;function Ci(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ci(Object(t),!0).forEach(function(r){Ke(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ci(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ke(n,e,t){return e=Ah(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ah(n){var e=Mh(n,"string");return typeof e=="symbol"?e:String(e)}function Mh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ei=-1,Fn;(function(n){n.UP="UP",n.DOWN="DOWN"})(Fn||(Fn={}));class fe extends c.Component{constructor(e){super(e),Ke(this,"csContainer",void 0),Ke(this,"menuContainer",void 0),Ke(this,"button",void 0),Ke(this,"input",void 0);var{value:t,valueToTime:r}=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=q.createRef(),this.menuContainer=q.createRef(),this.button=q.createRef(),this.input=q.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:r(t),inputFocused:!1}}getSelectedText(){var{options:e,value:t,placeholder:r}=this.props,{customTime:i}=this.state;if(t===null)return r;for(var a=0;a<e.length;a+=1){var o=e[a];if(o.value===t)return o.title}return zt.formatTime(i)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)===null||e===void 0||e.focus()}updateInputValue(e){var{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var t,{keyboardOptionIndex:r,inputFocused:i}=this.state,{options:a}=this.props;switch(e.key){case"Enter":case" ":i?this.updateFromCustom():this.updateInputValue(a[r].value),this.closeMenu(),(t=this.button.current)===null||t===void 0||t.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){var{keyboardOptionIndex:t,inputFocused:r}=this.state,{options:i}=this.props,a=i.length,o=t;switch(e){case fe.MENU_NAVIGATION_DIRECTION.UP:if(!r&&t===0){this.focusInput();break}else r&&this.focusOption(t);t>0&&!r?(o=(o-1)%a,this.setState({keyboardOptionIndex:o})):t===0&&(o=a-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case fe.MENU_NAVIGATION_DIRECTION.DOWN:if(!r&&t===a-1){this.focusInput();break}else r&&this.focusOption(t);t<a&&!(r&&t===0)&&(o=(o+1)%a,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(e){var t=Number(e.currentTarget.value),{options:r,timeToValue:i}=this.props,{customTime:a}=this.state;if(t===Ei){var o=i(a);this.updateAndClose(o)}else this.updateAndClose(r[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)===null||t===void 0||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var e,{options:t,value:r}=this.props,{keyboardOptionIndex:i}=this.state;this.scrollOptionIntoView(i);var a=(e=this.menuContainer.current)===null||e===void 0?void 0:e.querySelector(".cs-option-btn.keyboard-active");if(a instanceof HTMLElement&&a.focus(),r!==null){var o=t.map(s=>s.value).indexOf(r);o<0&&this.focusInput()}}focusInput(){var e;(e=this.input.current)===null||e===void 0||e.focus()}focusOption(e){var t,r=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(r&&r.children!=null){var i=r.children.item(e);i instanceof HTMLElement&&i.focus()}}handleMenuExited(){var{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){var{timeToValue:t}=this.props,r=t(e);this.updateInputValue(r),this.setState({customTime:e})}updateFromCustom(){var{timeToValue:e}=this.props,{customTime:t}=this.state,r=e(t);this.updateInputValue(r)}toggleMenu(e){var{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(this.setState({menuIsOpen:!1}),e){var t;(t=this.button.current)===null||t===void 0||t.focus()}}updateKeyboardIndex(){var{options:e,value:t}=this.props;if(t!==null){var r=e.map(i=>i.value).indexOf(t);r>0&&this.setState({keyboardOptionIndex:r})}}scrollOptionIntoView(e){var t,r=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(r&&r.children!=null){var i=r.children.item(e);i instanceof HTMLElement&&i.offsetTop>fe.DROP_DOWN_MENU_HEIGHT?r.scrollTop=i.offsetTop-fe.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(r.scrollTop=0)}}renderMenuElement(){var{inputWidth:e}=this.state;return h.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:h.jsx("div",{className:"cs-options-container",children:h.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){for(var{options:e,value:t,icon:r,customText:i}=this.props,{keyboardOptionIndex:a,customTime:o,inputFocused:s}=this.state,l=!1,u=[],d=0;d<e.length;d+=1){var f=e[d],v="option-".concat(d,"-").concat(f.value);l=l||f.value===t,u.push(h.jsxs("button",{type:"button",value:d,className:X("cs-option-btn",{"keyboard-active":a===d&&!s}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[f.value===t&&h.jsx(pe,{icon:r,className:"mr-2"}),f.value!==t&&h.jsx("span",{className:"mr-4"}),f.title]},v))}return u.push(h.jsx("hr",{className:"cs-divider"},"option-divider")),u.push(h.jsxs("button",{type:"button",value:Ei,className:X("cs-option-btn",{"keyboard-active":s}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?h.jsx(pe,{icon:r,className:"mr-2"}):h.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),u.push(h.jsxs("div",{className:"cs-custom-container",children:[h.jsx("span",{className:"mr-2"}),h.jsx(Zt,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),h.jsx("span",{className:"ml-2"})]},"cs-custom-container")),u.push(h.jsx("hr",{className:"mb-2"},"option-end")),u}render(){var{disabled:e,invalid:t,value:r,"data-testid":i}=this.props,{menuIsOpen:a}=this.state,{popperOptions:o}=this.props;return o=xh({placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}}},o),h.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:h.jsx("div",{className:X("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:h.jsxs("button",{type:"button",className:X("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[h.jsx("span",{className:X({"text-muted":r===null}),children:this.getSelectedText()}),h.jsx("span",{className:"cs-caret"}),h.jsx(no,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}Ke(fe,"MENU_NAVIGATION_DIRECTION",Fn);Ke(fe,"DROP_DOWN_MENU_HEIGHT",125);Ke(fe,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:Xl,customText:"Custom",placeholder:"Select a time",valueToTime:n=>n===null?0:Math.round(n/1e3),timeToValue:n=>n*1e3,invalid:!1,"data-testid":void 0});const Nh=fe;var Lh=H.module("DateInput"),jh="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Fh=["2000-01-01","2022-12-31"],Rh="YYYY-MM-DD",zo=q.forwardRef((n,e)=>{var{className:t="",onChange:r=()=>{},defaultValue:i="",onFocus:a=()=>{},onBlur:o=()=>{},"data-testid":s}=n,[l,u]=c.useState(i),[d,f]=c.useState(),v=c.useCallback(p=>{Lh.debug("handleChange",p),u(p),r(p)},[r]);return h.jsx("div",{className:"d-flex flex-row align-items-center",children:h.jsx(cr,{ref:e,className:X(t),example:Fh,getNextSegmentValue:Lu,onChange:v,onSelect:f,pattern:jh,placeholder:Rh,selection:d,value:l,onFocus:a,onBlur:o,"data-testid":s})})});zo.displayName="DateInput";const kh=zo;function Go(n,e,t){return e=$h(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $h(n){var e=Bh(n,"string");return typeof e=="symbol"?e:String(e)}function Bh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ko extends c.PureComponent{constructor(e){super(e),Go(this,"searchInput",void 0),this.searchInput=q.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Ze(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":a}=this.props,{value:o}=this.state;return h.jsx(hr,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":a})}}Go(Ko,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Wh=Ko;function Uh(n){var{isInvalid:e=!1,items:t,onAdd:r=()=>{},onDelete:i=()=>{},validate:a=()=>null}=n,[o,s]=c.useState(null),[l,u]=c.useState([]),[d,f]=c.useState(""),v=c.useCallback(w=>{u(w)},[]),p=c.useCallback(()=>{i(oi.getItemsInRanges(t,l)),u([])},[t,l,i]),m=c.useCallback(()=>{if(d!==""){var w=a(d);w==null?(r(d),f("")):s(w)}},[d,r,a]),g=c.useCallback(w=>{var{value:T}=w.target;f(T),s(T===""?null:a(T))},[a]),b=c.useCallback(()=>{u([])},[]),_=c.useCallback(w=>{w.key==="Enter"&&m()},[m]),S=c.useMemo(()=>14+Ua(t.length,1,6)*Mn.DEFAULT_ROW_HEIGHT,[t.length]);return h.jsxs("div",{className:X("editable-item-list-container",{"is-invalid":e}),children:[h.jsx("div",{style:{height:S},children:h.jsx(Mn,{itemCount:t.length,items:t.map((w,T)=>({value:w,isSelected:oi.isSelected(l,T)})),offset:0,selectedRanges:l,onSelectionChange:v,isMultiSelect:!0})}),h.jsxs("div",{className:"d-flex flex-row pt-2",children:[h.jsx("div",{className:"d-flex flex-grow-1",children:h.jsx("input",{className:X("form-control",{"is-invalid":o!=null}),placeholder:"Enter value",type:"text",value:d,onChange:g,onFocus:b,onKeyDown:_})}),h.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[h.jsx(_e,{kind:"ghost",onClick:m,disabled:o!=null||d==="",icon:Yl,tooltip:"Add new item","data-testid":"add-item-button"}),h.jsx(_e,{kind:"ghost",onClick:p,disabled:l.length===0,icon:Xa,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}var Vh=H.module("ErrorBoundary");class Hh extends c.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;Vh.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??h.jsx("div",{className:t,children:h.jsx(Ee,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function zh(n,e,t){return e=Gh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gh(n){var e=Kh(n,"string");return typeof e=="symbol"?e:String(e)}function Kh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ht extends c.Component{static isParentSelected(e,t){var r=t.get(e);if(r===void 0)return!1;if(typeof r=="boolean")return r;var i=Array.from(r.values()).includes(!0),a=Array.from(r.values()).includes(!1);return i&&a?null:i}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=>{var{menuIsOpen:r}=t;return{menuIsOpen:!r}})}toggleValueFor(e,t){var{valueMap:r,onUpdateValueMap:i}=this.props,a=new Map(r),o=a.get(e);if(o instanceof Map){var s=new Map(o);if(t!=null)s.set(t,o.get(t)===void 0);else{var l=ht.isParentSelected(e,a),u=l==null||!l;o.forEach((v,p)=>s.set(p,u))}a.set(e,s)}else a.set(e,o==null||!o);var d=a.get(e);if(t===void 0&&d!==void 0&&typeof d!="boolean"){var f=ht.isParentSelected(e,r);f!=null&&f?d.forEach((v,p)=>d.set(p,!1)):d.forEach((v,p)=>d.set(p,!0))}i(a)}setAllValues(e){var{valueMap:t,onUpdateValueMap:r}=this.props,i=new Map;t.forEach((a,o)=>{if(typeof a=="boolean")i.set(o,e);else{var s=new Map;a.forEach((l,u)=>s.set(u,e)),i.set(o,s)}}),r(i)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){var{valueMap:e,"data-testid":t}=this.props;return h.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(r=>{var[i,a]=r;return h.jsxs("div",{children:[h.jsx(Nn,{className:"hcm-parent",checked:ht.isParentSelected(i,e),onChange:()=>this.toggleValueFor(i),children:i}),a!==void 0&&typeof a!="boolean"&&Array.from(a.entries()).map(o=>{var[s,l]=o;return h.jsx(Nn,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(i,s),children:s},s)})]},i)}),h.jsx(_e,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?"".concat(t,"-btn-select-all"):void 0,children:"Select All"}),h.jsx(_e,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?"".concat(t,"-btn-clear"):void 0,children:"Clear"})]})}render(){var{menuText:e,className:t,icon:r,id:i,"data-testid":a}=this.props,{menuIsOpen:o}=this.state;return h.jsxs("button",{type:"button",className:X("btn hcm-btn",t),onClick:this.toggleMenu,id:i,"data-testid":a,children:[h.jsxs("span",{children:[r&&h.jsx(pe,{icon:r,className:"hcm-icon mr-1"}),e]}),h.jsx("span",{className:"cs-caret"}),h.jsx(ln,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}zh(ht,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const Xh=ht;function Pi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pi(Object(t),!0).forEach(function(r){Yh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yh(n,e,t){return e=qh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qh(n){var e=Zh(n,"string");return typeof e=="symbol"?e:String(e)}function Zh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Xo=c.memo(n=>{var{tab:e,onClose:t,onSelect:r,isActive:i,activeRef:a,index:o,isDraggable:s,contextActions:l}=n,{key:u,isClosable:d=t!=null,title:f}=e;return h.jsx(jl,{draggableId:u,index:o,isDragDisabled:!s,children:(v,p)=>h.jsxs("div",{className:"context-menu-wrapper",ref:i?a:null,children:[h.jsxs("div",wn(wn(wn({ref:v.innerRef},v.draggableProps),v.dragHandleProps),{},{className:X("btn btn-link btn-nav-tab",{active:i},{dragging:p.isDragging}),"data-testid":"btn-nav-tab-".concat(f),role:"tab",tabIndex:0,onClick:m=>{m.target.focus(),r(u)},onKeyPress:m=>{m.key==="Enter"&&r(u)},children:[f,d&&h.jsx(_e,{kind:"ghost",className:"btn-nav-tab-close",onClick:m=>{t==null||t(u),m.stopPropagation(),m.preventDefault()},icon:qa,tooltip:"Close"})]})),h.jsx(ro,{actions:l})]})},u)});Xo.displayName="NavTab";const Jh=Xo;function Ti(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ti(Object(t),!0).forEach(function(r){Qh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ti(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qh(n,e,t){return e=ef(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ef(n){var e=tf(n,"string");return typeof e=="symbol"?e:String(e)}function tf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nf=500,rf=.01,af=5e-4;function Di(n){return n.scrollLeft===0}function Ii(n){return n.scrollLeft+n.clientWidth===n.scrollWidth||n.scrollWidth===0}function of(n,e,t){var{isClosable:r=!1,key:i}=n,a=[];if(r&&t!=null){a.push({title:"Close",order:10,group:20,action:()=>{t(i)}});for(var o=!0,s=e.length-1;s>0&&e[s].key!==n.key;s-=1)if(e[s].isClosable===!0){o=!1;break}a.push({title:"Close to the Right",order:20,group:20,action:()=>{for(var l=e.length-1;l>0&&e[l].key!==i;l-=1)e[l].isClosable===!0&&t(e[l].key)},disabled:o}),a.push({title:"Close All",order:30,group:20,action:()=>{e.forEach(l=>{l.isClosable===!0&&t(l.key)})}})}return a}function sf(n){var{activeKey:e,tabs:t,onSelect:r,onReorder:i,onClose:a,makeContextActions:o}=n,s=c.useRef(),[l,u]=c.useState(!0),[d,f]=c.useState(!0),[v,p]=c.useState(!0),m=c.useCallback(()=>{s.current!=null&&(s.current.clientWidth<s.current.scrollWidth&&t.length>0?u(!0):u(!1),f(Di(s.current)),p(Ii(s.current)))},[t]);br(s.current,m);var g=c.useCallback(C=>{Ln.stopDragging(),C.destination&&(i==null||i(C.source.index,C.destination.index))},[i]),b=c.useCallback(()=>{if(s.current!=null){var C=Di(s.current);C!==d&&f(C);var P=Ii(s.current);P!==v&&p(P)}},[d,v]),_=c.useRef({cancelClick:!1}),S=c.useCallback(()=>{if(!(s.current==null||_.current.cancelClick))for(var{children:C}=s.current,P=C.length-1;P>=0;P-=1){var x=C[P];if(x.offsetLeft<s.current.scrollLeft-5){x.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"});return}}},[]),w=c.useCallback(()=>{if(!(s.current==null||_.current.cancelClick))for(var{children:C}=s.current,P=0;P<C.length;P+=1){var x=C[P];if(x.offsetLeft+5>s.current.scrollLeft+s.current.offsetWidth){x.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"});return}}},[]),T=c.useCallback(function(C,P){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,R=arguments.length>3?arguments[3]:void 0,B=s.current;B!=null&&(_.current.cancelClick=!0,C==="left"?B.scrollLeft=P-x:C==="right"&&(B.scrollLeft=P+x),_.current.rAF=requestAnimationFrame(Y=>{var Q=R??Y,$=Y-Q,W=rf*$+.5*af*$**2;W=Math.min(W,B.scrollWidth),T(C,P,W,Q)}))},[]),y=c.useCallback(()=>{var{holdTimer:C,rAF:P}=_.current;C!=null&&(clearTimeout(C),_.current.holdTimer=void 0),P!=null&&(cancelAnimationFrame(P),_.current.rAF=void 0),window.removeEventListener("mouseup",y)},[]);c.useEffect(()=>()=>window.removeEventListener("mouseup",y),[y]);var O=c.useCallback(C=>{s.current!=null&&(_.current.holdTimer=window.setTimeout(T,nf,C,s.current.scrollLeft)),_.current.cancelClick=!1,window.addEventListener("mouseup",y)},[y,T]),M=c.useCallback(()=>{O("left")},[O]),A=c.useCallback(()=>{O("right")},[O]);c.useEffect(function(){var P,x=R=>{R.stopPropagation(),R.preventDefault();var B=R.currentTarget,Y=Math.abs(R.deltaY)>Math.abs(R.deltaX)?R.deltaY:R.deltaX;B.scrollLeft+=Ua(Y,-30,30)};return(P=s.current)===null||P===void 0||P.addEventListener("wheel",x),()=>{var R;(R=s.current)===null||R===void 0||R.removeEventListener("wheel",x)}},[]);var j=c.useMemo(()=>{var C=new Map;return t.forEach(P=>{var{key:x}=P,R=[()=>of(P,t,a),()=>{var B;return(B=o==null?void 0:o(P))!==null&&B!==void 0?B:[]}];C.set(x,R)}),C},[o,t,a]),F=c.useRef(null),V=t.find(C=>C.key===e),I=t.map((C,P)=>{var{key:x}=C,R=C===V;return h.jsx(Jh,{tab:C,index:P,isActive:R,activeRef:F,onSelect:r,onClose:a,isDraggable:i!=null,contextActions:j.get(x)},x)});return c.useEffect(function(){F.current!=null&&F.current.scrollIntoView({block:"nearest",inline:"nearest"})},[e]),h.jsxs("nav",{className:"nav-container",children:[l&&h.jsx(_e,{kind:"ghost",icon:h.jsx(pe,{icon:ql,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-left",tooltip:"Scroll left",onClick:S,onMouseDown:M,disabled:d}),h.jsx(Fl,{onDragStart:Ln.startDragging,onDragEnd:g,children:h.jsx(Rl,{droppableId:"droppable-tab-navigation",direction:"horizontal",children:(C,P)=>h.jsxs("div",Oi(Oi({ref:x=>{x!=null&&(s.current=x,C.innerRef(x))}},C.droppableProps),{},{className:X("nav nav-tabs",{dragging:P.draggingFromThisWith}),role:"tablist",onScroll:b,children:[I,C.placeholder]}))})}),l&&h.jsx(_e,{kind:"ghost",icon:h.jsx(pe,{icon:Zl,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-right",tooltip:"Scroll right",onClick:w,onMouseDown:A,disabled:v})]})}function lf(){var{selectedThemeKey:n,setSelectedThemeKey:e,themes:t}=It(),r=c.useCallback(i=>{e(i)},[e]);return h.jsx(kl,{label:"Pick a color scheme",items:t,selectedKey:n,onSelectionChange:r,children:i=>h.jsx(Va,{children:i.name},i.themeKey)})}function uf(n){var{className:e,style:t}=n;return h.jsx("div",{className:X("dh-logo",e),style:t})}var df=.025,cf=.9,hf=.1,ff=.618,xi=80,nt={SIZE:8,DOT_SIZE:2},ke=18,vf=250,pf=60*1e3,mf={background:"var(--dh-color-random-area-plot-animation-bg)",foregroundFill:"var(--dh-color-random-area-plot-animation-fg-fill)",foregroundStroke:"var(--dh-color-random-area-plot-animation-fg-stroke)",gridColor:"var(--dh-color-random-area-plot-animation-grid)"};function gf(){return dr(mf)}var bf=q.memo(()=>{var{activeThemes:n}=It(),e=c.useMemo(gf,[n]),t=c.useRef(null),r=c.useRef(null),[i,a]=c.useState(!1),o=window.devicePixelRatio,s,l,u,d,f,v=null,p=[];function m(){var I;r.current!=null&&(u=r.current.offsetWidth,d=r.current.offsetHeight),t.current!=null&&(t.current.style.width="".concat(u,"px"),t.current.style.height="".concat(d,"px"),t.current.width=u*o,t.current.height=d*o),(I=s)===null||I===void 0||I.scale(o,o)}function g(){var{foregroundFill:I,foregroundStroke:C}=e,P=document.createElement("canvas");P.width=nt.SIZE,P.height=nt.SIZE;var x=P.getContext("2d");return x!=null&&(x.fillStyle=C,x.fillRect(0,0,nt.DOT_SIZE,nt.DOT_SIZE),x.fillStyle=I,x.fillRect(0,0,nt.SIZE,nt.SIZE)),x==null?void 0:x.createPattern(P,"repeat")}function b(I){var C=Math.random()-.5,P=df*C;return I<hf?P=Math.abs(P):I>cf&&(P=-Math.abs(P)),I+P}function _(){for(var I=[],C=ff,P=0;P<u+ke;P+=1)C=b(C),I.push(C);return I}function S(){for(;p.length>=u+ke;)p.pop();for(;p.length<u+ke;)p.push(b(p[p.length-1]))}function w(I,C){C.beginPath(),C.moveTo(-1,d+1),C.lineTo(-1,d*I[0]);for(var P=0;P<I.length;P+=1)C.lineTo(P,d*I[P]);C.lineTo(u+ke,d*I[I.length-1]),C.lineTo(u+ke,d+1),C.closePath()}function T(I){I.beginPath();for(var C=1;C<u;C+=xi)I.moveTo(C,0),I.lineTo(C,d);for(var P=1;P<d;P+=xi)I.moveTo(0,P),I.lineTo(u,P)}function y(I){var C,P,x;v=(C=v)!==null&&C!==void 0?C:I;var{background:R,foregroundStroke:B,gridColor:Y}=e;Ae(s),s.fillStyle=R,s.fillRect(0,0,u,d),T(s),s.lineWidth=1,s.strokeStyle=Y,s.stroke();var Q=(((P=v)!==null&&P!==void 0?P:0)-(I??0))/(1e3/ke);if(s.translate(Q,0),w(p,s),s.lineWidth=2,s.strokeStyle=B,s.stroke(),s.translate(-Q,0),l!=null&&(s.fillStyle=l),s.fill(),s.setTransform(o,0,0,o,0,0),(I??0)-((x=v)!==null&&x!==void 0?x:0)>1e3/ke){for(var $,W=Math.floor(((I??0)-(($=v)!==null&&$!==void 0?$:0))/(1e3/ke)),N=0;N<W;N+=1)p.shift(),p.push(b(p[p.length-1]));v=I}f!=null&&cancelAnimationFrame(f),f=requestAnimationFrame(y)}var O=Ze(()=>{f=requestAnimationFrame(I=>{m(),S(),a(!1),y(I)})},vf,{leading:!0});function M(){a(!0),f!=null&&cancelAnimationFrame(f),f=null,v=null}var A=Ze(()=>{M()},pf);function j(){f==null&&(a(!1),m(),S(),f=requestAnimationFrame(y)),A()}function F(){document.hasFocus()&&j()}function V(){f!=null&&cancelAnimationFrame(f),A(),O()}return c.useEffect(()=>{var I;return s=(I=t.current)===null||I===void 0?void 0:I.getContext("2d",{alpha:!1}),m(),p=_(),l=g(),y(),A(),window.addEventListener("resize",V),window.addEventListener("focus",j),window.addEventListener("blur",M),window.addEventListener("mousemove",F),window.addEventListener("keydown",F),()=>{f!=null&&cancelAnimationFrame(f),window.removeEventListener("resize",V),window.removeEventListener("focus",j),window.removeEventListener("blur",M),window.removeEventListener("mousemove",F),window.removeEventListener("keydown",F),A.cancel(),O.cancel()}},[e]),h.jsx("div",{className:"random-area-plot-animation-container",ref:r,children:h.jsx("canvas",{ref:t,className:i?"shade":""})})});const Yo=bf;function qo(n){var{text:e,placement:t="top-start"}=n,r=c.useMemo(()=>({placement:t}),[t]);return h.jsxs(h.Fragment,{children:[h.jsx($a,{UNSAFE_className:yr.spectrumEllipsis,children:e??h.jsx(h.Fragment,{children:" "})}),e==null||e===""?null:h.jsx(sn,{options:r,children:e})]})}var yf=["scrollRef","getItemDisplayText","getKey"];function Ai(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Mi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ai(Object(t),!0).forEach(function(r){_f(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ai(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _f(n,e,t){return e=wf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wf(n){var e=Sf(n,"string");return typeof e=="symbol"?e:String(e)}function Sf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Cf(n,e){if(n==null)return{};var t=Ef(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Ef(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Pf(n){var{scrollRef:e,getItemDisplayText:t,getKey:r}=n,i=Cf(n,yf),a=c.useCallback(o=>{var s=r(o),l=t(o);return h.jsx(Va,{textValue:l??String(s),children:h.jsx(qo,{text:l})},s)},[t,r]);return h.jsx($l,Mi(Mi({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var Sr=q.forwardRef((n,e)=>{var{children:t,className:r,disabled:i,id:a,isLinked:o,isLinkedSource:s,isInvalid:l,onClick:u,onMouseEnter:d,onMouseLeave:f,style:v,"data-testid":p}=n;return h.jsxs("button",{ref:e,type:"button",className:X("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||s},{"btn-socketed-linked-source":s},{"is-invalid":l},r),id:a,onClick:u,onMouseEnter:d,onMouseLeave:f,style:v,disabled:i,"data-testid":p,children:[t,h.jsx(pe,{icon:Jl,className:"linked btn-socketed-icon",transform:"down-1"}),h.jsx(pe,{icon:Ql,className:"is-invalid btn-socketed-icon"})]})});Sr.displayName="SocketedButton";Sr.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 Tf=Sr;var Of=500;function Df(n){var{heading:e,content:t,delayMs:r=Of}=n,[i,a]=c.useState(!1);return c.useEffect(()=>{window.setTimeout(()=>{a(!0)},r)},[r]),i?h.jsxs(Bl,{children:[h.jsx(ar,{size:"XXL",children:h.jsx(pe,{icon:eu})}),h.jsx(Ba,{children:e}),t==null?null:h.jsx(Wa,{children:t})]}):null}const If="_modified_10irp_24",xf="_track_10irp_35",Af="_handle_10irp_15",Mf="_ticks_10irp_103",Zo={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_10irp_5","time-slider-popovers":"_time-slider-popovers_10irp_10","handle-popper":"_handle-popper_10irp_15",modified:If,"flex-spacer":"_flex-spacer_10irp_31",track:xf,"track-fills":"_track-fills_10irp_42","track-fill":"_track-fill_10irp_42","track-fill-start":"_track-fill-start_10irp_60","track-fill-middle":"_track-fill-middle_10irp_61","track-fill-end":"_track-fill-end_10irp_64","handle-track":"_handle-track_10irp_67",handle:Af,ticks:Mf,"tick-labels":"_tick-labels_10irp_121","tick-label":"_tick-label_10irp_121","tick-label-wrapper":"_tick-label-wrapper_10irp_137"};var Rt=parseInt(Zo["handle-size"],10),Ni=parseInt(Zo["popover-width"],10),ve=24*60*60-1,Li=5*60;function Nf(n){var{startTime:e,endTime:t,onChange:r,isStartModified:i=!1,isEndModified:a=!1,"data-testid":o}=n,[s,l]=c.useState(e),[u,d]=c.useState(t),f=c.useRef(null);c.useEffect(function(){l(e),d(t)},[e,t]);var v=c.useCallback((g,b)=>{var _=g,S=b;_===S&&(S<ve?S+=1:_-=1),l(_),d(S),r({startTime:_,endTime:S})},[l,d,r]),p=c.useCallback(g=>{v(g,u)},[v,u]),m=c.useCallback(g=>{v(s,g)},[v,s]);return h.jsxs("div",{className:"time-slider","data-testid":o,children:[h.jsx(Lf,{startTime:s,endTime:u,onStartTimeChange:p,onEndTimeChange:m,isStartModified:i,isEndModified:a}),h.jsxs("div",{className:"track",ref:f,children:[h.jsx(jf,{startTime:s,endTime:u}),h.jsx("div",{className:"ticks",children:Array(24).fill(null).map((g,b)=>h.jsx("div",{className:"tick"},b))}),h.jsx(ji,{track:f,time:s,setTime:p}),h.jsx(ji,{track:f,time:u,setTime:m})]}),h.jsxs("div",{className:"tick-labels",children:[h.jsx("div",{className:"tick-label",children:"0:00"}),h.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((g,b)=>h.jsx("div",{className:"tick-label",children:"".concat(b+1,":00")},b))})]})]})}function Lf(n){var{startTime:e,endTime:t,onStartTimeChange:r,onEndTimeChange:i,isStartModified:a,isEndModified:o,"data-testid":s}=n,l=e>t,[u,d]=c.useState(l?t:e),[f,v]=c.useState(l?e:t),p=c.useRef(null),m=c.useRef(null),g=c.useRef(null),b=c.useRef(null);c.useEffect(function(){d(e>t?t:e),v(e>t?e:t)},[e,t]),c.useEffect(function(){if(g.current!==null){var O;(O=m.current)===null||O===void 0||O.setSelection(g.current)}if(b.current!==null){var M;(M=p.current)===null||M===void 0||M.setSelection(b.current)}},[l]);function _(y){e<=t?r(y):i(y)}function S(y){e<=t?i(y):r(y)}var w=c.useCallback(y=>{g.current=y,b.current=null},[]),T=c.useCallback(y=>{g.current=null,b.current=y},[]);return h.jsxs("div",{className:"time-slider-popovers",children:[h.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(u/ve*100,"% - ").concat(Ni/2,"px)")}}),h.jsxs("div",{className:"handle-popper",children:[h.jsx("label",{className:X({modified:l?o:a}),children:l?"End Time":"Start Time"}),h.jsx(Zt,{ref:p,allowValueWrapping:!1,value:u,onChange:_,onSelect:w,"data-testid":s!==void 0?"".concat(s,"-input-1"):void 0})]}),h.jsx("div",{className:"flex-spacer"}),h.jsxs("div",{className:"handle-popper",children:[h.jsx("label",{className:X({modified:l?a:o}),children:l?"Start Time":"End Time"}),h.jsx(Zt,{ref:m,allowValueWrapping:!1,value:f,onChange:S,onSelect:T,"data-testid":s!==void 0?"".concat(s,"-input-2"):void 0})]}),h.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat((ve-f)/ve*100,"% - ").concat(Ni/2,"px)")}})]})}function jf(n){var{startTime:e,endTime:t,"data-testid":r}=n;return h.jsxs("div",{className:"track-fills","data-testid":r,children:[e>t&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"track-fill track-fill-start",style:{transform:"scaleX(".concat(t/ve,")")}}),h.jsx("div",{className:"track-fill track-fill-end",style:{transform:"scaleX(".concat((ve-e)/ve,")")}})]}),e<t&&h.jsx("div",{className:"track-fill track-fill-middle",style:{transform:"translateX(".concat(e/ve*100,"%) scaleX(").concat((t-e)/ve,")")}})]})}function ji(n){var{track:e,time:t,setTime:r,"data-testid":i}=n,a=c.useMemo(()=>{var v=3600,p=Rt/2;return t<v?p=t/v*(Rt/2):t>23*v&&(p=Rt/2+1/(ve-23*v)*(t-23*v)*(Rt/2)),"translateX(calc(".concat(t/ve*100,"% - ").concat(p,"px))")},[t]),o=c.useCallback(v=>{if(!e.current)return 0;var p=e.current.getBoundingClientRect(),m=Math.max(v-p.left,0),g=ve*Math.min(1,m/p.width),b=Li*Math.round(g/Li),_=Math.min(ve,b);return _},[e]),s=c.useCallback(v=>{var{clientX:p}=v;r(o(p))},[r,o]),l=c.useCallback(v=>{var{clientX:p}=v;r(o(p)),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[r,o,s]),u=c.useCallback(()=>{window.addEventListener("mousemove",s),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[s,l]),d=c.useCallback(()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[s,l]),f=c.useCallback(()=>{u()},[u]);return c.useEffect(function(){return()=>{d()}},[d]),h.jsx("div",{className:"handle-track",style:{transform:a},children:h.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:f,"data-testid":i})})}function Jo(n){var{buttons:e,isShown:t=!1,classNames:r,message:i,type:a,onClick:o,onDismiss:s,"data-testid":l}=n,u=e&&e.length!==0;return h.jsx(Kt,{in:t,timeout:Xt.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:h.jsxs("div",{className:X("toast-notification",r,a),role:"presentation",onClick:o,onKeyPress:o,"data-testid":l,children:[h.jsx("div",{className:"message-container",children:h.jsx("span",{className:"message",children:i})}),h.jsx(Kt,{in:u,timeout:Xt.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx("div",{className:"buttons-container",children:e})}),s&&h.jsx(_e,{kind:"ghost",icon:qa,tooltip:"Close notification",className:"my-2",onClick:s})]})})}Jo.TYPE=Object.freeze({ERROR:"error"});function Ff(n){var{children:e,className:t,labelText:r,hintText:i,isModified:a,validationError:o,showValidationError:s=!0,"data-testid":l,id:u}=n,{current:d}=c.useRef(u??Le());return h.jsxs(h.Fragment,{children:[h.jsx("label",{className:X("validate-label",t,{modified:a}),htmlFor:d,"data-testid":l,children:r}),q.Children.toArray(e).map(f=>q.isValidElement(f)?q.cloneElement(f,{className:X(f.props.className,{"is-invalid":o})}):h.jsx("div",{className:X(t),children:f})),i!==void 0&&h.jsx("small",{className:"form-text text-muted",children:i}),o!==void 0&&s&&h.jsx("p",{className:"validate-label-error text-danger",children:o})]})}const Rf=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:Eo,AutoCompleteInput:ph,AutoResizeTextarea:_r,BasicModal:wr,BulkActionBar:Sh,Button:_e,ButtonGroup:xt,ButtonOld:bh,CSS_VAR_EXPRESSION_PREFIX:tu,CardFlip:Ch,Checkbox:Nn,Collapse:Th,ComboBox:ju,ConfirmActionButton:ih,ConfirmationDialog:Bo,ContextActionUtils:Fu,ContextActions:ro,ContextMenuItem:Ru,ContextMenuRoot:ku,CopyButton:io,CustomTimeSelect:Nh,DEFAULT_DARK_THEME_KEY:nu,DEFAULT_DARK_THEME_PALETTE:ru,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:to,DEFAULT_LIGHT_THEME_KEY:iu,DEFAULT_PRELOAD_DATA_VARIABLES:au,DateInput:kh,DateTimeInput:$u,DebouncedModal:mh,DebouncedSearchInput:Wh,DragUtils:Ln,DraggableItemList:Bu,DropdownMenu:no,EditableItemList:Uh,ErrorBoundary:Hh,GLOBAL_SHORTCUTS:Wu,HierarchicalCheckboxMenu:Xh,IconActionButton:Wo,InfoModal:gh,ItemList:Mn,ItemListItem:Uu,get KEY(){return Vu},LoadingOverlay:Ee,LoadingSpinner:Za,Logo:uf,get MODIFIER(){return Hu},MaskedInput:cr,Menu:zu,MenuItem:Gu,Modal:lr,ModalBody:ur,ModalFooter:Uo,ModalHeader:Ya,NON_WHITESPACE_REGEX:ou,NavTabList:sf,Option:Ku,Page:Xu,Popper:ln,RadioGroup:Yu,RadioItem:qu,RandomAreaPlotAnimation:Yo,SVG_ICON_MANUAL_COLOR_MAP:su,SearchInput:hr,SearchableCombobox:Pf,Select:Zu,SelectValueList:ao,Shortcut:Ju,ShortcutRegistry:Qu,SocketedButton:Tf,Stack:ed,THEME_CACHE_LOCAL_STORAGE_KEY:lu,TMP_CSS_PROP_PREFIX:uu,TableViewEmptyState:Df,TextWithTooltip:qo,ThemeContext:td,ThemeExport:Xt,ThemePicker:lf,ThemeProvider:oo,TimeInput:Zt,TimeSlider:Nf,ToastNotification:Jo,Tooltip:sn,UISwitch:nd,ValidateLabelInput:Ff,WHITESPACE_REGEX:du,calculatePreloadStyleContent:cu,createCssVariableResolver:hu,createPreloadStyleElement:fu,extractDistinctCssVariableExpressions:vu,fillToLength:rd,getActiveThemes:pu,getDefaultBaseThemes:mu,getExpressionRanges:Ja,getThemeKey:Qa,getThemePreloadData:gu,overrideSVGFillColors:bu,preloadTheme:yu,replaceSVGFillColor:_u,resolveCssVariablesInRecord:dr,resolveCssVariablesInString:wu,setThemePreloadData:Su,themeDHDefault:id,themeDark:Cu,themeLight:Eu,trimTrailingMask:ad,useTheme:It},Symbol.toStringTag,{value:"Module"}));function kf(n,e){var t=Te(),r=c.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return c.useEffect(()=>()=>{r.disconnect()},[r]),r}var Cr=c.createContext(null);function Qo(n){var{serverUrl:e,options:t,children:r}=n,i=kf(e,t);return h.jsx(Cr.Provider,{value:i,children:r})}function Fi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function $f(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Fi(a,r,i,o,s,"next",l)}function s(l){Fi(a,r,i,o,s,"throw",l)}o(void 0)})}}var es=c.createContext(null);function ts(n){var[e,t]=c.useState(null),[r,i]=c.useState(null),a=c.useContext(es),o=c.useContext(on);return c.useEffect(()=>{if(a==null){if(o!=null){t(o),i(null);return}t(null),i(new Error("No API available in useDeferredApi. Was code wrapped in ApiBootstrap or DeferredApiContext.Provider?"));return}var s=!1;function l(){return u.apply(this,arguments)}function u(){return u=$f(function*(){if(typeof a=="function")try{var d=yield a(n);s||(t(d),i(null))}catch(f){s||(t(null),i(f))}else t(a)}),u.apply(this,arguments)}return l(),()=>{s=!0}},[o,a,n]),[e,r]}var ns=q.memo(n=>{var{children:e,onError:t,descriptor:r}=n,[i,a]=ts(r);return a!=null?(t==null||t(a),null):i==null?null:h.jsx(on.Provider,{value:i,children:e})});ns.displayName="DeferredApiBootstrap";function Je(){return bt(Cr,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}function rs(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Er(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function Bf(n){return rs(n)||Er(n)}var Pr=c.createContext(null);function Wf(n){if(Er(n))return{id:n.id,type:n.type};if(n.title!=null||n.name!=null){var e,t;return{name:(e=(t=n.title)!==null&&t!==void 0?t:n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Can't get a descriptor for definition: ".concat(n))}function Uf(){return bt(Pr,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}const Vf=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Pu,ApiContext:on,ClientBootstrap:Qo,ClientContext:Cr,DeferredApiBootstrap:ns,DeferredApiContext:es,ObjectFetcherContext:Pr,getVariableDescriptor:Wf,isIdVariableDescriptor:Er,isNameVariableDescriptor:rs,isVariableDescriptor:Bf,useApi:Te,useClient:Je,useDeferredApi:ts,useObjectFetcher:Uf},Symbol.toStringTag,{value:"Module"}));function Hf(n){return function(t){var{children:r}=t;return h.jsx(on.Provider,{value:n,children:r})}}function Ri(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function zf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ri(a,r,i,o,s,"next",l)}function s(l){Ri(a,r,i,o,s,"throw",l)}o(void 0)})}}var Sn=H.module("MessageUtils"),is="io.deephaven.message.LoginOptions.request",as="io.deephaven.message.SessionDetails.request",os="io.deephaven.broadcast",Tr="io.deephaven.broadcast.Login",ss="io.deephaven.broadcast.Logout";function fn(n){var e=n;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function ls(n){return fn(n)&&n.message===Tr}function us(n){return fn(n)&&n.message===ss}function ds(n){var e=n;return e!=null&&typeof e.id=="string"}function Or(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Le(),t=arguments.length>2?arguments[2]:void 0;return{message:n,id:e,payload:t}}function Gf(n,e){return{id:n,payload:e}}function Dr(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function Ir(n){return Rn.apply(this,arguments)}function Rn(){return Rn=zf(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=Dr();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=Le(),s=l=>{var{data:u}=l;if(!ds(u)){Sn.debug("Ignoring non-deephaven response",u);return}if(Sn.debug("Received message",u),(u==null?void 0:u.id)!==o){Sn.debug("Ignore message, id doesn't match",u);return}window.clearTimeout(a),window.removeEventListener("message",s),r(u.payload)};window.addEventListener("message",s),a=window.setTimeout(()=>{window.removeEventListener("message",s),i(new od("Request timed out"))},e),t.postMessage(Or(n,o),"*")})}),Rn.apply(this,arguments)}function Kf(n,e,t){return e=Xf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xf(n){var e=Yf(n,"string");return typeof e=="symbol"?e:String(e)}function Yf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cs extends Error{constructor(){super(...arguments),Kf(this,"isNoConsolesError",!0)}}function hs(n){return n.isNoConsolesError}function ki(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function vn(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ki(a,r,i,o,s,"next",l)}function s(l){ki(a,r,i,o,s,"throw",l)}o(void 0)})}}var st=H.module("SessionUtils");function qf(n,e){return st.info("Starting connection to '".concat(e,"'...")),new n.IdeConnection(e)}function fs(n,e,t){return kn.apply(this,arguments)}function kn(){return kn=vn(function*(n,e,t){st.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new cs("No console types available");st.info("Available types:",r);var i=r[0];st.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:Le.generate()};return st.info("Console session established",o),{session:a,config:o,connection:e,details:t,dh:n}}),kn.apply(this,arguments)}function Zf(n,e,t){return st.info("createCoreClient",e),new n.CoreClient(e,t)}function Jf(n){return n!=null&&typeof n=="object"}function Qf(){return $n.apply(this,arguments)}function $n(){return $n=vn(function*(){var n=yield Ir(as);if(!Jf(n))throw new Error("Unexpected session details response: ".concat(n));return n}),$n.apply(this,arguments)}function ev(){return Bn.apply(this,arguments)}function Bn(){return Bn=vn(function*(){var n=new URLSearchParams(window.location.search);switch(n.get("authProvider")){case"parent":return Qf()}return{}}),Bn.apply(this,arguments)}function tv(n,e,t){return Wn.apply(this,arguments)}function Wn(){return Wn=vn(function*(n,e,t){var r;try{r=yield fs(n,e,t)}catch(i){if(!hs(i))throw i}return r}),Wn.apply(this,arguments)}const nv=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:os,BROADCAST_LOGIN_MESSAGE:Tr,BROADCAST_LOGOUT_MESSAGE:ss,BooleanColumnFormatter:sd,CharColumnFormatter:ld,DateTimeColumnFormatter:ud,DateUtils:so,DecimalColumnFormatter:dd,DefaultColumnFormatter:cd,FETCH_TIMEOUT:hd,Formatter:un,FormatterUtils:ct,IntegerColumnFormatter:fd,LOGIN_OPTIONS_REQUEST:is,NoConsolesError:cs,SESSION_DETAILS_REQUEST:as,StringColumnFormatter:vd,TableColumnFormatter:pd,TableUtils:Et,createComboboxFilterArgs:md,createConnection:qf,createCoreClient:Zf,createFilterConditionFactory:fr,createKeyFromOffsetRow:gd,createNotNullOrEmptyFilterCondition:lo,createOnTableUpdatedHandler:uo,createSearchTextFilter:vr,createSelectedValuesFilter:pr,createSessionWrapper:fs,createShowOnlyEmptyFilterCondition:co,createValueFilter:ho,defaultRowDeserializer:fo,fetchVariableDefinition:bd,generateEmptyKeyedItems:vo,getColumnFormats:yd,getDateTimeFormatterOptions:_d,getSessionDetails:ev,getSize:mr,getWindowParent:Dr,isBroadcastLoginMessage:ls,isBroadcastLogoutMessage:us,isClosed:Yt,isCustomColumnFormatDefined:wd,isMessage:fn,isNoConsolesError:hs,isResponse:ds,loadSessionWrapper:tv,makeMessage:Or,makeResponse:Gf,padFirstAndLastRow:po,requestParentResponse:Ir},Symbol.toStringTag,{value:"Module"}));var $i=H.module("useTableListener"),rv=(n,e,t)=>c.useEffect(function(){if(n==null){$i.debug2("Emitter undefined, skipping addEventListener",e);return}return $i.debug2("Adding listener",e),n.addEventListener(e,t)},[n,e,t]);const ft=rv;function iv(n,e,t){return e=av(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function av(n){var e=ov(n,"string");return typeof e=="symbol"?e:String(e)}function ov(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sv extends Error{constructor(){super(...arguments),iv(this,"isColumnNameError",!0)}}const lv=sv;function uv(n,e,t){return e=dv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dv(n){var e=cv(n,"string");return typeof e=="symbol"?e:String(e)}function cv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class hv extends Error{constructor(){super(...arguments),uv(this,"isTableDisconnectError",!0)}}const fv=hv;var kt=H.module("useTable"),vv=(n,e,t,r)=>{var i=Te(),[a,o]=c.useState(void 0),[s,l]=c.useState([]),[u,d]=c.useState(null),[f,v]=c.useState(null);c.useEffect(()=>{if(r===void 0){o(n==null?void 0:n.columns),d(null);return}try{o(n==null?void 0:n.findColumns(r)),d(null)}catch(b){kt.error("Column not found",b,r),d(new lv("Invalid columnNames argument"))}},[n,r]),c.useEffect(()=>{if(!a||!n){kt.debug2("Table or column not initialized, skip viewport update.");return}kt.debug2("Setting viewport",e,t),n.setViewport(e,t,a)},[a,n,e,t]);var p=c.useCallback(b=>{var{detail:_}=b;if(!a){kt.error("Columns not initialized.");return}var S=a.map(w=>_.rows.map(T=>T.get(w)));l(S)},[a]),m=c.useCallback(()=>{v(new fv("Table disconnected"))},[]),g=c.useCallback(()=>{v(null)},[]);return ft(n,i.Table.EVENT_UPDATED,p),ft(n,i.Table.EVENT_DISCONNECT,m),ft(n,i.Table.EVENT_RECONNECT,g),{columns:a,data:s,error:f??u}};const vs=vv;var pv=(n,e,t,r)=>{var i=c.useMemo(()=>[r],[r]),{columns:a=[],data:o=[],error:s}=vs(n,e,t,i);return{column:a[0],data:o[0],error:s}};const ps=pv;function Bi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function mv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Bi(a,r,i,o,s,"next",l)}function s(l){Bi(a,r,i,o,s,"throw",l)}o(void 0)})}}var Oe=H.module("TableInput"),Cn=250;function xr(n){var e,t,{className:r=void 0,columnName:i,settings:a,defaultValue:o=[],isInvalid:s=!1,onChange:l=()=>!1,onBlur:u=()=>!1,table:d}=n,f=c.useRef(null),v=Te(),p=c.useMemo(()=>{var $=ct.getColumnFormats(a),W=ct.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:N={},defaultIntegerFormatOptions:U={}}=a;return new un(v,$,W,N,U)},[v,a]),[m,g]=c.useState(""),[b,_]=c.useState(new Set(o)),[S,w]=c.useState(),T=c.useRef(null),y=Math.min((e=S==null?void 0:S.size)!==null&&e!==void 0?e:0,Cn),{column:O,data:M,error:A}=ps(S,0,Cn-1,i),j=c.useCallback($=>O?p.getFormattedString($,O.type,O.name):"".concat($),[O,p]),[F,V]=c.useMemo(()=>{var $=new Set(b),W=[];if(M==null)return[W,null];if(M.forEach(U=>{var G="".concat(U),Re=b.has(G);Re&&$.delete(G),W.push({value:G,displayValue:j(U),isSelected:Re})}),$.size>0){Oe.debug2("Selection has items that are missing from the viewport");var N=new Set(b);return Array.from($).forEach(U=>{N.delete(U)}),[W,N]}return[W,null]},[M,b,j]);c.useEffect(()=>{V!==null&&(_(V),l(Array.from(V)))},[l,V]);var I=c.useCallback(function(){var $=mv(function*(W){try{var N=yield W;Oe.debug("Table resolved",N),w(N)}catch(U){if(si.isCanceled(U))return;Oe.error(U)}});return function(W){return $.apply(this,arguments)}}(),[]);c.useEffect(()=>{var $=si.makeCancelable(d);return I($),()=>{Oe.debug2("Cancel table promise"),$.cancel()}},[d,I]);var C=c.useCallback($=>{var{value:W}=$.target;g(W);var N=F.findIndex(G=>G.displayValue.includes(W));if(N>-1){var U;Oe.debug2("Found ".concat(W," at index ").concat(N)),(U=T.current)===null||U===void 0||U.scrollIntoView(N)}else Oe.debug2("".concat(W," not found"))},[F,T]),P=c.useCallback($=>{if(Oe.debug("handleSelect",$),$>=F.length){Oe.error("Invalid index",$);return}var W=F[$].value,N=new Set(b);F[$].isSelected?N.delete(W):N.add(W),_(N),l(Array.from(N))},[l,F,b]),x=c.useCallback(()=>{var $=F.map(N=>N.value),W=new Set($);_(W),l($)},[F,l]),R=c.useCallback(()=>{_(new Set),l([])},[l]),B=c.useCallback(()=>{},[]),Y=c.useCallback($=>{var W,{relatedTarget:N}=$;Oe.debug("handleChildBlur",N,N instanceof HTMLElement,f.current,(W=f.current)===null||W===void 0?void 0:W.contains(N)),(!N||f.current&&N instanceof HTMLElement&&!f.current.contains(N))&&u()},[u]),Q=F.length===0;return h.jsxs("div",{ref:f,className:X("table-input-container d-flex flex-column position-relative",r),children:[h.jsx(hr,{disabled:!!A||Q,value:m,placeholder:"Search",onChange:C,className:"mb-2 d-flex",onBlur:Y}),h.jsx(ao,{className:"table-input-list",disabled:S===void 0||Q,isInvalid:s,items:Q?[{value:"Empty",isSelected:!1}]:F,itemCount:y,offset:0,onSelect:P,onViewportChange:B,ref:T,onBlur:Y}),S&&h.jsxs("div",{className:"meta-row",children:[h.jsx("div",{className:"d-flex align-items-center text-muted small",children:S!=null&&S.size>y&&h.jsxs(h.Fragment,{children:["Table is too large, showing the first ",Cn," items."]})}),h.jsxs("div",{children:[h.jsx("button",{type:"button",className:"btn btn-link",onBlur:Y,onClick:x,children:"Select All"}),h.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:Y,onClick:R,children:"Clear"})]})]}),S==null||A&&h.jsx("div",{className:"h-100 w-100 position-absolute",children:h.jsx(Ee,{isLoaded:S!=null,isLoading:S==null&&A==null,errorMessage:(t=A==null?void 0:A.message)!==null&&t!==void 0?t:null})})]})}xr.displayName="TableInput";xr.defaultProps={isInvalid:!1,className:void 0};var Wi=H.module("useBroadcastChannel");function Ar(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sd,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:os,t=c.useMemo(()=>new BroadcastChannel(e),[e]);return c.useEffect(()=>()=>{t.close()},[t]),c.useEffect(()=>{function r(i){var{data:a}=i;if(!fn(a)){Wi.debug("Ignoring non-deephaven message",a);return}Wi.debug("event received",a),n(i)}return t.addEventListener("message",r),()=>{t.removeEventListener("message",r)}},[t,n]),t}function pn(n,e){var t=c.useCallback(r=>{ls(r.data)?n==null||n(r.data):us(r.data)&&(e==null||e(r.data))},[n,e]);Ar(t)}var Jt="io.deephaven.web.client.auth.refreshToken",ms=c.createContext(null),gv=H.module("RefreshTokenUtils");function Un(){var n=mt.get(Jt);try{if(n!=null)return JSON.parse(n)}catch(e){gv.error("Error parsing refresh token",n,e)}return null}function Vn(n){if(n==null){mt.remove(Jt);return}var e=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),t=new Date(n.expiry);mt.set(Jt,e,{secure:!0,sameSite:"strict",expires:t})}function gs(n){var{children:e}=n,t=Te(),r=Je(),[i,a]=c.useState(Un());c.useEffect(function(){var u=r.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{var{detail:f}=d;Vn(f),a(f)});return u},[t,r,i]);var o=c.useCallback(()=>{a(Un())},[]),s=c.useCallback(()=>{Vn(null),a(null)},[]);return pn(o,s),h.jsx(ms.Provider,{value:i,children:e})}function Fe(){var n=Te();return c.useMemo(()=>new Et(n),[n])}function bv(n,e,t,r){var i=Fe(),[a,o]=c.useState(""),s=cn(a,t),l=c.useCallback(v=>{o(v.trim())},[]),{data:u,isLoading:d}=Pt(i.doesColumnValueExist,[n,e,s,r]),f=d||a!==s?null:u;return{valueTrimmed:a,valueTrimmedDebounced:s,valueExists:f,trimAndUpdateValue:l}}var Ui=H.module("useDebouncedViewportSearch"),yv=200;function _v(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yv,r=Fe(),{table:i,applyFiltersAndRefresh:a}=n,o=c.useMemo(()=>Ze(s=>{if(Ui.debug("Applying debounced searchText '".concat(s,"'")),i!=null){var l=s.trim();if(l===""){a([]);return}var u=i.findColumn(e),d=r.makeFilterValue(u.type,l),f=[u.filter().contains(d)];a(f)}},t),[a,e,t,i,r]);return c.useEffect(()=>()=>{Ui.debug("Cancelling debounced search function"),o.cancel()},[o]),o}var bs=300;function wv(n){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:r,mapItemToValue:i}=n,a=Fe(),o=jo(e,i),s=cn(o,bs),l=Mo(s,To);return c.useMemo(()=>pr(a,t,l.selection,r,l.isInverted),[t,l,r,a])}function Mr(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return c.useMemo(()=>Cd(...t.map(i=>i(n))),[n,...t])}function Sv(n,e,t,r){var i=c.useRef("");return i.current=t,c.useMemo(()=>{var a=n.length>0&&n[0].item==null;return!a&&r!=null&&(i.current===""||r.toLowerCase().includes(i.current.toLowerCase()))?[{key:r,item:{[e]:r}},...n]:n},[r,e,n])}function Vi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Cv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Vi(a,r,i,o,s,"next",l)}function s(l){Vi(a,r,i,o,s,"throw",l)}o(void 0)})}}function Ev(n){var{table:e,columnName:t,defaultValue:r,itemHeight:i,topOffset:a=0,value:o}=n;return c.useCallback(Cv(function*(){if(e==null||o===""||o===r)return a;var s=e.findColumn(t),l=yield e.seekRow(0,s,"String",o),u=r==null?0:1;return(l+u)*i+a}),[t,r,i,e,a,o])}function Nr(n){var[,e]=c.useState(0),t=Te();return ft(n,t.Table.EVENT_SIZECHANGED,()=>{e(r=>r+1)}),mr(n)}var Pv=H.module("useInitializeViewportData");function ys(n){var e=ko({}),t=Math.max(0,Nr(n));return c.useEffect(()=>{var r=e.items.length;t!==r&&(Pv.debug("size changed:",{currentSize:r,targetSize:t}),e.setItems(Array.from(vo(0,t-1))))},[t,n]),e}function _s(n,e,t){return c.useCallback(function(i){var[a,o]=po(i,e,t,mr(n));n==null||n.setViewport(a,o)},[n,t,e])}var Hi=H.module("useViewportData");function Lr(n){var{table:e,itemHeight:t=1,scrollDebounce:r=Cc,viewportSize:i=10,viewportPadding:a=50,deserializeRow:o=fo}=n,s=ys(e),l=_s(e,i,a),u=c.useCallback(g=>{e&&!Yt(e)?l(g):Hi.debug("setViewport called on closed table.",e)},[e,l]),d=c.useCallback(g=>{e&&!Yt(e)?(e.applyFilter(g),u(0)):Hi.debug("applyFiltersAndRefresh called on closed table.",e)},[u,e]),f=Te(),v=c.useMemo(()=>uo(s,o),[o,s]);ft(e,f.Table.EVENT_UPDATED,v);var p=Nr(e);c.useEffect(()=>{u(0)},[e,u,p]);var m=Fo(t,u,r);return c.useMemo(()=>({viewportData:s,size:p,table:e,applyFiltersAndRefresh:d,setViewport:u,onScroll:m}),[d,m,u,p,e,s])}function jr(n,e){var{applyFiltersAndRefresh:t}=n;c.useEffect(()=>{t(e)},[t,e])}function Tv(n,e){for(var t=Fe(),[r,i]=c.useState(""),a=c.useMemo(()=>vr(t,e,r),[e,r,t]),o=qt(i,wo),s=Lr({table:n,itemHeight:Sc,viewportSize:So,viewportPadding:Co}),l=arguments.length,u=new Array(l>2?l-2:0),d=2;d<l;d++)u[d-2]=arguments[d];var f=Mr(s.table,a,...u);return jr(s,f),{list:s,onSearchTextChange:o}}function Ov(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=Fe(),r=c.useMemo(()=>lo(t),[t]);return c.useMemo(()=>fr(n,r,e),[n,e,r])}function ws(n){c.useEffect(()=>()=>{n!=null&&(Yt(n)||n.close())},[n])}function Dv(n,e,t){for(var r=Fe(),[i,a]=c.useState(""),[o,s]=c.useState(""),[l,u]=c.useState(null),[d,f]=c.useState(()=>new Map),{data:v,isLoading:p}=Pt(r.doesColumnValueExist,[n,e,o,!1]),m=p||o!==i?null:v,g=c.useMemo(()=>vr(r,e,o),[e,o,r]),b=c.useMemo(()=>pr(r,e,new Set(d.keys()),!1,!0),[e,d,r]),_=arguments.length,S=new Array(_>3?_-3:0),w=3;w<_;w++)S[w-3]=arguments[w];var{data:T}=Pt(r.createDistinctSortedColumnTable,[n,e,"asc",...S]);ws(T);var y=Lr({table:T,itemHeight:wc,viewportSize:So,viewportPadding:Co}),O=i.length>0&&y.size===0,M=d.has(i),A=qt(s,wo),j=c.useCallback(x=>{a(x),A(x)},[A]),F=qt(u,0),V=c.useCallback(x=>{if(a(""),s(""),u(x),F(null),x!=null){var R=y.viewportData.findItem(x);if(R!=null){var B=t(R);f(Y=>{var Q=new Map(Y);return Q.set(B,{value:B}),Q})}}},[F,y.viewportData,t]),I=c.useCallback(x=>{f(R=>{if(x.size===0)return R;var B=new Map(R);for(var Y of x)B.set(Y,{value:Y});return B})},[]),C=c.useCallback(x=>{f(R=>{if(x==="all")return new Map;var B=new Map(R);for(var Y of x)B.delete(Y);return B})},[]),P=Mr(y.table,g,b);return jr(y,P),c.useMemo(()=>({list:y,hasSearchTextWithZeroResults:O,searchText:i,searchTextExists:m,searchTextIsInSelectedValues:M,selectedKey:l,selectedValueMap:d,onSearchTextChange:j,onSelectKey:V,onAddValues:I,onRemoveValues:C}),[O,y,I,C,j,V,i,m,M,l,d])}function zi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Iv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){zi(a,r,i,o,s,"next",l)}function s(l){zi(a,r,i,o,s,"throw",l)}o(void 0)})}}function xv(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];var i=c.useCallback(Iv(function*(){var u;return(u=n==null?void 0:n.selectDistinct(n.findColumns(t)))!==null&&u!==void 0?u:null}),[n,...t]),{data:a,error:o,isError:s,isLoading:l}=Pt(i,[]);return c.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:o,isError:s,isLoading:l}}function Av(n,e){var t=Fe(),r=c.useMemo(()=>co(t,n),[n,t]);return c.useMemo(()=>fr(e,r),[e,r])}function Mv(n,e,t){var r=Fe();return c.useMemo(()=>ho(r,n,e,t),[n,t,r,e])}const Nv=Object.freeze(Object.defineProperty({__proto__:null,ConnectionContext:mo,DEBOUNCE_MS:bs,REFRESH_TOKEN_KEY:Jt,RefreshTokenBootstrap:gs,RefreshTokenContext:ms,TableDropdown:Ed,TableInput:xr,makeApiContextWrapper:Hf,readRefreshToken:Un,storeRefreshToken:Vn,useBroadcastChannel:Ar,useBroadcastLoginListener:pn,useCheckIfExistsValue:bv,useConnection:Pd,useDebouncedViewportSearch:_v,useDebouncedViewportSelectionFilter:wv,useFilterConditionFactories:Mr,useFilteredItemsWithDefaultValue:Sv,useGetItemPosition:Ev,useInitializeViewportData:ys,useNotNullOrEmptyFilter:Ov,usePickerWithSelectedValues:Dv,useSearchableViewportData:Tv,useSelectDistinctTable:xv,useSetPaddedViewportCallback:_s,useShowOnlyEmptyFilter:Av,useTable:vs,useTableClose:ws,useTableColumn:ps,useTableListener:ft,useTableSize:Nr,useTableUtils:Fe,useValueFilter:Mv,useViewportData:Lr,useViewportFilter:jr},Symbol.toStringTag,{value:"Module"}));var Ss=c.createContext(!1);function Lv(n){var{fontClassNames:e=["fira-sans-regular","fira-sans-semibold","fira-mono"],children:t}=n,[r,i]=c.useState(!1);return c.useEffect(function(){document.fonts.ready.then(()=>{i(!0)})},[]),h.jsxs(h.Fragment,{children:[h.jsx(Ss.Provider,{value:r,children:t}),h.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:e.map(a=>h.jsx("p",{className:a,children:"preload"},a))})]})}var At=c.createContext(null),Qe=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function Cs(n){return"DashboardPlugin"in n}function Qt(n){return"AuthPlugin"in n}function Es(n){return"TablePlugin"in n}function Ps(n){return Cs(n)||Qt(n)||Es(n)}function jv(n){return"type"in n&&n.type===Qe.DASHBOARD_PLUGIN}function mn(n){return"type"in n&&n.type===Qe.WIDGET_PLUGIN}function Fv(n){return"type"in n&&n.type===Qe.TABLE_PLUGIN}function Ts(n){return"type"in n&&n.type===Qe.AUTH_PLUGIN}function Os(n){return"type"in n&&n.type===Qe.THEME_PLUGIN}var Rv=H.module("@deephaven/plugin.PluginUtils");function kv(n,e){return n==null||!mn(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function $v(n){var e=h.jsx(pe,{icon:Tu});if(!mn(n))return e;var{icon:t}=n;return t==null?e:c.isValidElement(t)?t:h.jsx(pe,{icon:t})}function Ds(n){var e=[...n.entries()].filter(t=>Os(t[1]));return Rv.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,a=Array.isArray(i.themes)?i.themes:[i.themes];return a.map(o=>{var{name:s,baseTheme:l,styleContent:u}=o;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Qa(r,s),name:s,styleContent:u}})}).flat()}function Is(){return bt(At,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function Bv(n){var{fetch:e,type:t}=n,r=Is(),i=c.useMemo(()=>[...r.values()].filter(mn).find(o=>[o.supportedTypes].flat().includes(t)),[r,t]);if(i!=null){var a=i.component;return h.jsx(a,{fetch:e})}throw new Error("Unknown widget type '".concat(t,"'"))}const Wv=Object.freeze(Object.defineProperty({__proto__:null,PluginType:Qe,PluginsContext:At,WidgetView:Bv,getIconForPlugin:$v,getThemeDataFromPlugins:Ds,isAuthPlugin:Ts,isDashboardPlugin:jv,isLegacyAuthPlugin:Qt,isLegacyDashboardPlugin:Cs,isLegacyPlugin:Ps,isLegacyTablePlugin:Es,isTablePlugin:Fv,isThemePlugin:Os,isWidgetPlugin:mn,pluginSupportsType:kv,usePlugins:Is},Symbol.toStringTag,{value:"Module"}));function Uv(n){if(n==null)return!1;var e=n;return e.Component!==void 0&&typeof e.isAvailable=="function"}var xs="io.deephaven.auth.AnonymousAuthenticationHandler",Vv="io.deephaven.authentication.psk.PskAuthenticationHandler";function Gi(n,e,t){return e=Hv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hv(n){var e=zv(n,"string");return typeof e=="symbol"?e:String(e)}function zv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gv extends Error{constructor(){super(...arguments),Gi(this,"name","AuthenticationError"),Gi(this,"isAuthenticationError",!0)}}const As=Gv;function Ki(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Kv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ki(a,r,i,o,s,"next",l)}function s(l){Ki(a,r,i,o,s,"throw",l)}o(void 0)})}}var Xi=H.module("AuthPluginBase");function Fr(n){var{children:e,getLoginOptions:t}=n,r=Je(),[i,a]=c.useState(),[o,s]=c.useState(!1);return c.useEffect(()=>{var l=!1;function u(){if(l)throw new Td("Login canceled.")}function d(){return f.apply(this,arguments)}function f(){return f=Kv(function*(){try{var v=yield t();u(),Xi.info("Logging in..."),yield r.login(v),u(),s(!0)}catch(g){if(!l){var p;Xi.error("Unable to login:",g);var m=(p=gt(g))!==null&&p!==void 0?p:"Unable to login. Verify credentials.";a(new As(m)),s(!1)}}}),f.apply(this,arguments)}return d(),()=>{l=!0}},[r,t]),o?h.jsx(h.Fragment,{children:e}):h.jsx(Ee,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:gt(i)})}var Xv={canLogout:!1};function Yv(n){var{children:e}=n,t=Te(),r=c.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return h.jsx(Fr,{getLoginOptions:r,children:h.jsx(dn.Provider,{value:Xv,children:e})})}var qv={Component:Yv,isAvailable:n=>n.includes(xs)};const Ms=qv;function Yi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Zv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Yi(a,r,i,o,s,"next",l)}function s(l){Yi(a,r,i,o,s,"throw",l)}o(void 0)})}}var Jv=H.module("AuthPluginParent"),Qv={canLogout:!1};function ep(n){return n!=null&&typeof n.type=="string"}function tp(){return Hn.apply(this,arguments)}function Hn(){return Hn=Zv(function*(){Jv.info("Logging in by delegating to parent window...");var n=yield Ir(is);if(!ep(n))throw new Error("Unexpected login options response: ".concat(n));return n}),Hn.apply(this,arguments)}function np(){var n;return(n=new URLSearchParams(window.location.search).get("authProvider"))!==null&&n!==void 0?n:""}function rp(n){var{children:e}=n;return h.jsx(Fr,{getLoginOptions:tp,children:h.jsx(dn.Provider,{value:Qv,children:e})})}var ip={Component:rp,isAvailable:()=>Dr()!=null&&np()==="parent"};const Ns=ip;function Ls(n){var{children:e,errorMessage:t,isLoggingIn:r=!1,onSubmit:i}=n;return h.jsxs("form",{className:"login-form",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),i==null||i(a)},children:[h.jsx("div",{className:"flex-spacer"}),h.jsxs("div",{className:"flex-wrapper",children:[h.jsx("fieldset",{disabled:r,className:"container-fluid",children:e}),h.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:h.jsxs("button",{type:"submit",className:X("btn btn-primary",{"btn-spinner":r},{"btn-cancelable":r}),"data-testid":"btn-login",children:[r&&h.jsxs("span",{children:[h.jsx(Za,{className:"mr-2 loading-spinner-vertical-align"}),h.jsx("span",{className:"btn-normal-content",children:"Logging in"}),h.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Login"]})})]}),h.jsx("div",{className:"flex-spacer",children:t!=null&&h.jsx("p",{className:"error-message mb-0",role:"alert",children:"".concat(t)})})]})}function js(n){var{children:e,logoPath:t="./logo.png"}=n;return h.jsxs("div",{className:"login-container",children:[h.jsx(Yo,{}),h.jsxs("div",{className:"login-box",children:[h.jsx("div",{className:"logo",children:h.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),e,h.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}function qi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function En(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){qi(a,r,i,o,s,"next",l)}function s(l){qi(a,r,i,o,s,"throw",l)}o(void 0)})}}var zn="io.deephaven.authentication.psk.PskAuthenticationHandler",Fs="psk",Gn="io.deephaven.web.client.auth.psk.token",lt=H.module("AuthPluginPsk");function ap(){return new URLSearchParams(window.location.search).get(Fs)}function op(){lt.debug2("clearWindowToken");var n=new URL(window.location.href);n.searchParams.delete(Fs),window.history.replaceState(null,"",n.href)}function Zi(){var n;return(n=mt.get(Gn))!==null&&n!==void 0?n:null}function Pn(n){lt.debug2("Storing token in cookie",n),n!=null?mt.set(Gn,n,{secure:!0,sameSite:"strict"}):mt.remove(Gn)}function sp(n){var{children:e,logoPath:t}=n,r=Je(),i=c.useRef(null),a=c.useRef(null),[o,s]=c.useState(),[l,u]=c.useState(!1),[d,f]=c.useState(!1),[v,p]=c.useState(!1),[m,g]=c.useState(""),b=c.useCallback(function(){var y=En(function*(O){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;lt.info("Logging in..."),p(!0);var A=null;try{if(A=r.login({type:zn,token:O}),a.current=A,yield A,lt.info("Logged in successfully"),a.current!==A)return;Pn(O),f(!0)}catch(V){if(a.current!==A)return;if(u(!0),M){var j;lt.error("Unable to login",V);var F=(j=gt(V))!==null&&j!==void 0?j:"Unable to login: Verify credentials.";s(new As(F))}}p(!1)});return function(O){return y.apply(this,arguments)}}(),[r]),_=c.useCallback(()=>{a.current=null,p(!1)},[]),S=c.useCallback(En(function*(){lt.debug("onLogin");var y=Zi();d||v||y==null||b(y,!1)}),[d,v,b]),w=c.useCallback(()=>{Pn(null)},[]);pn(S,w),c.useEffect(()=>{var y=!1;function O(){return M.apply(this,arguments)}function M(){return M=En(function*(){var A,j=(A=ap())!==null&&A!==void 0?A:Zi();if(op(),j==null){u(!0);return}p(!0);try{yield r.login({type:zn,token:j}),y||(Pn(j),f(!0),p(!1))}catch{y||(u(!0),p(!1))}}),M.apply(this,arguments)}return O(),()=>{y=!0}},[r]);var T=c.useCallback(()=>{v?_():b(m)},[_,v,b,m]);return c.useEffect(function(){var O;(O=i.current)===null||O===void 0||O.focus()},[i,l]),h.jsxs(h.Fragment,{children:[d&&e,l&&h.jsx(Kt,{in:!d,timeout:Xt.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(js,{logoPath:t,children:h.jsx(Ls,{errorMessage:gt(o),isLoggingIn:v,onSubmit:T,children:h.jsxs("div",{className:"form-group",children:[h.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),h.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:i,value:m,onChange:y=>{s(void 0),g(y.target.value)}})]})})})}),h.jsx(Ee,{"data-testid":"auth-psk-loading",isLoaded:d||l,isLoading:!d&&!l})]})}var lp={Component:sp,isAvailable:n=>n.includes(zn)};const Rs=lp;function Ji(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ji(Object(t),!0).forEach(function(r){up(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ji(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function up(n,e,t){return e=dp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dp(n){var e=cp(n,"string");return typeof e=="symbol"?e:String(e)}function cp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var hp=H.module("UserUtils");function ks(n,e){return n.get("internal.webClient.appInit.".concat(e))}function $s(n){var e,t,r,i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};function s(b){return ks(n,b)}function l(b,_){var S=s(b);return S==="true"?!0:S==="false"?!1:(S!==void 0&&hp.warn("Unexpected value for ".concat(b,": ").concat(S)),_)}var u=(e=s("name"))!==null&&e!==void 0?e:"",d=(t=s("operateAs"))!==null&&t!==void 0?t:u,f=(r=(i=s("groups"))===null||i===void 0?void 0:i.split(","))!==null&&r!==void 0?r:[],v=l("canCopy",!0),p=l("canDownloadCsv",!0),m=l("canUsePanels",!0),g=l("canLogout",!0);return Tn(Tn({name:u,operateAs:d,groups:f},a),{},{permissions:Tn({canUsePanels:m,canCopy:v,canDownloadCsv:p,canLogout:g},o)})}const fp=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:xs,AUTH_HANDLER_TYPE_PSK:Vv,AuthPluginAnonymous:Ms,AuthPluginBase:Fr,AuthPluginParent:Ns,AuthPluginPsk:Rs,Login:js,LoginForm:Ls,UserContext:go,UserOverrideContext:bo,UserPermissionsOverrideContext:dn,getAppInitValue:ks,getUserFromConfig:$s,isAuthPlugin:Uv},Symbol.toStringTag,{value:"Module"})),Bs=typeof _n=="function"?_n:_n.default;gr.register([pc,mc,gc,bc,yc,_c]);function ue(n,e,t){return e=vp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vp(n){var e=pp(n,"string");return typeof e=="symbol"?e:String(e)}function pp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class te{constructor(e){ue(this,"dh",void 0),ue(this,"listeners",void 0),ue(this,"formatter",void 0),ue(this,"rect",void 0),ue(this,"isDownsamplingDisabled",void 0),ue(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(te.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(te.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(te.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(te.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(te.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(te.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(te.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(te.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(te.EVENT_ERROR,{detail:e}))}}ue(te,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");ue(te,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");ue(te,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");ue(te,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");ue(te,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");ue(te,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");ue(te,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");ue(te,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");ue(te,"EVENT_ERROR","ChartModel.EVENT_ERROR");const be=te;function Qi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $t(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qi(Object(t),!0).forEach(function(r){oe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function oe(n,e,t){return e=mp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mp(n){var e=gp(n,"string");return typeof e=="symbol"?e:String(e)}function gp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var yt=H.module("ChartUtils"),ea="io.deephaven.time.DateTime",bp=36e5,yp=1e6;function _p(n){return n.asDate!==void 0}function wp(n){return n.asNumber!==void 0}function ta(n){return n.dhTimeZone!==void 0}function Sp(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class D{static getPlotlyErrorBars(e,t,r,i){var a=r.map((s,l)=>s-e[l]),o=t.map((s,l)=>e[l]-s);return{type:"data",symmetric:!1,array:a,arrayminus:o,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);Ae(a);var[,o,s,l,,u,d,f,v,p]=a,m=l.replace(",","").length,g=s.indexOf(",")>=0||l.indexOf(",")>=0,b=g?",":"",_=f!=null&&f!==""?"e":"f",S=v!==""?v:_,w=u.length+d.length,T="",y="0".concat(m).concat(b,".").concat(w).concat(T).concat(S),O=D.convertNumberPrefix(o),M=D.convertNumberPrefix(p);return{tickformat:y,tickprefix:O,ticksuffix:M,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},o=i;return r&&(o=i/yp),t.log&&(o=Math.log(o)),a.tickmode="linear",a.dtick=o,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var o=i.sources[a];if(o.axis===t)return o}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:D.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getAxisTypeMap(e){var t=D.getAllAxes(e);return D.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],o=0;o<a.series.length;o+=1)if(t===a.series[o])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],o=e[a];Sp(o)&&(t[a]=[...o.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,o=i[t],s=(a=r.get(o))!==null&&a!==void 0?a:[];return s.push(i),r.set(o,s),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):yt.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){oe(this,"dh",void 0),oe(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},o=D.getAllAxes(e),s=D.groupArray(o,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var d=l[u],f=0;f<d.series.length;f+=1)for(var v=d.series[f],{sources:p}=v,m=p.filter(S=>S.axis),g=function(){var w=m[b],{axis:T}=w,{type:y}=T,O=s.get(y);Ae(O);var M=O.indexOf(T),A=r.getAxisPropertyName(y);if(A!=null){var j=D.getAxisLayoutProperty(A,M);if(i.has(j))yt.debug("".concat(j," already added."));else{yt.debug("Adding ".concat(j," to axisFormats."));var F=r.getPlotlyAxisFormat(w,t);if(F===null)i.set(j,a);else{i.set(j,F);var{businessCalendar:V}=T;if(V!=null){var I=[],{businessPeriods:C,businessDays:P,holidays:x,timeZone:R}=V,B=t==null?void 0:t.getColumnTypeFormatter(ea),Y;ta(B)&&(Y=B.dhTimeZone);var Q=Y?(R.standardOffset-Y.standardOffset)/60:0;x.length>0&&I.push(...r.createRangeBreakValuesFromHolidays(x,R,Y)),C.forEach($=>I.push({pattern:"hour",bounds:[D.periodToDecimal($.close)+Q,D.periodToDecimal($.open)+Q]})),P.length<r.daysOfWeek.length&&r.createBoundsFromDays(P).forEach($=>I.push({pattern:"day of week",bounds:$})),F.rangebreaks=I}if(i.size===d.axes.length)return{v:i}}}}},b=0;b<m.length;b+=1){var _=g();if(typeof _=="object")return _.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(D.MODE_LINES),(r??!0)&&a.add(D.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(D.MODE_LINES),(r??!1)&&a.add(D.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?D.ORIENTATION.HORIZONTAL:D.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:o,isLinesVisible:s,isShapesVisible:l,plotStyle:u,lineColor:d,shapeColor:f,sources:v,shape:p,shapeSize:m}=e,g=v.some(T=>{var y;return(y=T.axis)===null||y===void 0?void 0:y.businessCalendar}),b=this.getChartType(u,g),_=this.getPlotlyChartMode(u,s??void 0,l??void 0),S=this.getPlotlySeriesOrientation(e),w=D.makeSeriesData(b,_,o,a,S);return this.addSourcesToSeriesData(w,u,v,t),this.addStylingToSeriesData(w,u,i,d,f,p,m,r),w}addSourcesToSeriesData(e,t,r,i){for(var a=e,o=0;o<r.length;o+=1){var s=r[o],{axis:l,type:u}=s,d=this.getPlotlyProperty(t,u);Ha(a,d,[]);var f=l!=null?this.getAxisPropertyName(l.type):null;if(f!=null){var v=i.get(l.type);if(v){var p=v.indexOf(l),m=p>0?"".concat(p+1):"";a["".concat(f,"axis")]="".concat(f).concat(m)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===u.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(d.width=[],d.marker.line!==void 0&&Object.assign(d.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(d.increasing={line:{color:r.ohlc_increasing}},d.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(d.textinfo="label+percent",d.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center",d.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?d.marker.color=i:d.line.color=i),a!=null&&(d.marker.color=a),o!=null&&o.length>0)try{d.marker.symbol=D.getMarkerSymbol(o)}catch(f){yt.warn("Unable to handle shape",o,":",f)}s!=null&&(d.marker.size=s*D.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(d.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=e,l=D.getAllAxes(t),u=0;u<t.charts.length;u+=1){var d=t.charts[u],f=i==null?void 0:i(d),v=this.getChartBounds(t,d,a,o);this.updateLayoutAxes(s,d.axes,l,r,a,o,v,f)}this.removeStaleAxes(s,l)}getChartBounds(e,t,r,i){var a,{dh:o}=this,{cols:s,rows:l}=e,{column:u,colspan:d,row:f,rowspan:v}=t,p=u+d,m=f+v,g=1/s,b=1/l,_=D.AXIS_SIZE_PX/r,S=D.AXIS_SIZE_PX/i,w={bottom:(l-m)*b+(m<l?S/2:0),top:(l-f)*b-(f>0?S/2:0),left:u*g+(u>0?_/2:0),right:p*g-(p<s?_/2:0)},T=D.groupArray(t.axes,"position"),y=(a=T.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return y.length>0&&(r>0?w.right-=(w.right-w.left)*Math.max(0,Math.min(D.LEGEND_WIDTH_PX/r,D.MAX_LEGEND_SIZE)):w.right-=(w.right-w.left)*D.DEFAULT_AXIS_SIZE),w}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z",""),o,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&ta(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(o=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:o,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:o}=i,s=null;return Et.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,o),s=D.addTickSpacing(s,i,!0)):Et.isNumberType(a)&&(s=D.getPlotlyNumberFormat(t,a,o),s=D.addTickSpacing(s,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,d=a>0?Math.max(D.MIN_AXIS_SIZE,Math.min(D.AXIS_SIZE_PX/o,D.MAX_AXIS_SIZE)):D.DEFAULT_AXIS_SIZE,f=o>0?Math.max(D.MIN_AXIS_SIZE,Math.min(D.AXIS_SIZE_PX/a,D.MAX_AXIS_SIZE)):D.DEFAULT_AXIS_SIZE,v=e,p=D.groupArray(t,"position"),m=D.groupArray(t,"type"),g=[...m.keys()],b=D.groupArray(r,"type"),_=0;_<g.length;_+=1){var S=g[_],w=this.getAxisPropertyName(S);if(w!=null){var T=m.get(S),y=b.get(S),O=S===u.plot.AxisType.Y,M=O?o:a;Ae(T),Ae(y);for(var A=0;A<T.length;A+=1){var j=T[A],F=y.indexOf(j),V=D.getAxisLayoutProperty(w,F);v[V]==null&&(v[V]=this.makeLayoutAxis(S,i));var I=v[V];if(I!=null){this.updateLayoutAxis(I,j,A,p,d,f,s);var{range:C,autorange:P}=I;if(l!=null&&C!==void 0&&(P===void 0||P===!1)){var x=l(j),[R,B]=x(C);yt.debug("Setting downsample range",M,R,B),j.range(M,R,B)}else j.range(M)}}}}}removeStaleAxes(e,t){for(var r=e,i=D.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);Ae(l);var u=l.length,d=this.getAxisPropertyName(s);if(d!=null)for(var f=D.getAxisLayoutProperty(d,u);r[f]!=null;)delete r[f],u+=1,f=D.getAxisLayoutProperty(d,u)}}updateLayoutAxis(e,t,r,i,a,o,s){var l,{dh:u}=this,d=t.type===u.plot.AxisType.Y,f=d?o:a,v=e,p=(l=t.label)!==null&&l!==void 0?l:"";if(v.title!==void 0&&typeof v.title!="string"?v.title.text=p:v.title={text:p},t.log&&(v.type="log"),v.side=this.getAxisSide(t.position),r>0){var m,g;v.overlaying=(m=this.getAxisPropertyName(t.type))!==null&&m!==void 0?m:void 0;var b=(g=i.get(t.position))!==null&&g!==void 0?g:[],_=b.indexOf(t);_>0&&(v.anchor="free",t.position===u.plot.AxisPosition.RIGHT?v.position=s.right+(_-b.length+1)*f:t.position===u.plot.AxisPosition.TOP?v.position=s.top+(_-b.length+1)*f:t.position===u.plot.AxisPosition.BOTTOM?v.position=s.bottom+(b.length-_+1)*f:t.position===u.plot.AxisPosition.LEFT&&(v.position=s.left+(b.length-_+1)*f))}else if(t.type===u.plot.AxisType.X){var S=i.get(u.plot.AxisPosition.LEFT)||[],w=i.get(u.plot.AxisPosition.RIGHT)||[],T=Math.max(s.left,s.left+(S.length-1)*o),y=Math.min(s.right-(w.length-1)*o,s.right);v.domain=[T,y]}else if(t.type===u.plot.AxisType.Y){var O=i.get(u.plot.AxisPosition.BOTTOM)||[],M=i.get(u.plot.AxisPosition.TOP)||[],A=Math.max(s.bottom,s.bottom+(O.length-1)*a),j=Math.min(s.top-(M.length-1)*a,s.top);v.domain=[A,j]}}createBoundsFromDays(e){var t=e.map(o=>this.daysOfWeek.indexOf(o)),r=this.daysOfWeek.filter(o=>!e.includes(o)).map(o=>this.daysOfWeek.indexOf(o)),i=new Set;r.forEach(o=>{for(var s=o+1;s<o+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(o=>{for(var s=o-1;s>o-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var u=(l+1)%7;a.push([u,o]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(o=>{o.businessPeriods.length>0?a.push(...this.createPartialHoliday(o,t,r)):i.push(this.createFullHoliday(o,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(v=>{a.push(v.open),a.push(v.close)}),a.push("24:00");for(var o=[],s=0;s<a.length;s+=2){var l=a[s],u=a[s+1];if(l!==u){var d=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],f=bp*(D.periodToDecimal(u)-D.periodToDecimal(l));o.push({values:d,dvalue:f})}}return o}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ea,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:o}=e,s=D.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(d=>({plotStyle:"".concat(o),name:d,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:d,axis:u,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(_p(e))return r.i18n.DateTimeFormat.format(D.DATE_FORMAT,e,t);if(wp(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(Et.isDateType(t)&&typeof e=="string"){var a=e,o=D.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(o,a);if(!r)return s;var l="".concat(o," Z"),u=i.i18n.DateTimeFormat.format("Z",s,r),d=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),f=i.i18n.DateTimeFormat.format("Z",d,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(f))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}},legend:{font:{color:t.legend_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:r,plot_bgcolor:i,title_color:a,coastline_color:o,land_color:s,ocean_color:l,lake_color:u,river_color:d}=e,f={paper_bgcolor:r,plot_bgcolor:i,autosize:!0,colorway:D.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},yanchor:"top",pad:$t({},D.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:$t({},D.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:r,coastlinecolor:o,landcolor:s,oceancolor:l,lakecolor:u,rivercolor:d}};return f.datarevision=0,f}hydrateSettings(e){var{dh:t}=this;return $t($t({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}oe(D,"DEFAULT_AXIS_SIZE",.15);oe(D,"MIN_AXIS_SIZE",.025);oe(D,"MAX_AXIS_SIZE",.2);oe(D,"AXIS_SIZE_PX",75);oe(D,"LEGEND_WIDTH_PX",50);oe(D,"MAX_LEGEND_SIZE",.25);oe(D,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));oe(D,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");oe(D,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));oe(D,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));oe(D,"SUBTITLE_LINE_HEIGHT",25);oe(D,"DEFAULT_MARKER_SIZE",6);oe(D,"MODE_MARKERS","markers");oe(D,"MODE_LINES","lines");const le=D;function Cp(n,e,t){return e=Ep(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ep(n){var e=Pp(n,"string");return typeof e=="symbol"?e:String(e)}function Pp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ws extends Error{constructor(){super(...arguments),Cp(this,"isDownsamplingError",!0)}}function na(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ra(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?na(Object(t),!0).forEach(function(r){se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):na(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function se(n,e,t){return e=Tp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tp(n){var e=Op(n,"string");return typeof e=="symbol"?e:String(e)}function Op(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $e=H.module("Chart");class Ge extends c.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}constructor(e){var t;super(e),se(this,"currentSeries",void 0),se(this,"PlotComponent",void 0),se(this,"plot",void 0),se(this,"plotWrapper",void 0),se(this,"columnFormats",void 0),se(this,"dateTimeFormatterOptions",void 0),se(this,"decimalFormatOptions",void 0),se(this,"integerFormatOptions",void 0),se(this,"rect",void 0),se(this,"ranges",void 0),se(this,"isSubscribed",void 0),se(this,"isLoadedFired",void 0),se(this,"resizeObserver",void 0),se(this,"getCachedConfig",An((r,i,a,o,s,l)=>{var u=[],d=!!r;d&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:Ge.convertIcon(ai),attr:"fill-warning"});var f=!!l;if(f&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:Ge.convertIcon(ai),attr:"fill-warning"}),i||a||o||d){var v=Ge.downsampleButtonTitle(a,o),p=Ge.downsampleButtonAttr(a,o),m=a?Ou:Du;u.push({name:v,title:"Downsampling status",icon:Ge.convertIcon(m),click:this.handleDownsampleClick,attr:p})}var g=s.some(w=>{var{type:T}=w;return T!=null&&!T.includes("3d")}),b=s.some(w=>{var{type:T}=w;return T!=null&&T.includes("3d")}),_=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],S=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||d||f?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...g?_:[],...b?S:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=Bs(e.Plotly),this.plot=q.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:q.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:ra(ra({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){$e.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch($e.debug2("Received data update",t,r),t){case be.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:m,revision:g}=p;return typeof m.datarevision=="number"&&(m.datarevision+=1),{data:r,layout:m,revision:g+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case be.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case be.EVENT_DISCONNECT:{var{onDisconnect:o}=this.props;o();break}case be.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case be.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case be.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case be.EVENT_DOWNSAMPLENEEDED:case be.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:d}=this.props;d(new Ws(u));break}case be.EVENT_ERROR:{var f="".concat(r);this.setState({error:f});var{onError:v}=this.props;v(new Error(f));break}default:$e.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=le.getLayoutRanges(t),i=!ze(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if($e.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if($e.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var o=i.reduce((s,l)=>{var{name:u,visible:d}=l;return u!=null&&d==="legendonly"?[...s,u]:s},[]);a({hiddenSeries:o})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){$e.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=ct.getColumnFormats(e),r=ct.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!ze(this.columnFormats,t)||!ze(this.dateTimeFormatterOptions,r)||!ze(this.decimalFormatOptions,i)||!ze(this.integerFormatOptions,a))&&(this.columnFormats=ct.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new un(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{$e.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:o,error:s,shownError:l,layout:u,revision:d}=this.state,f=this.getCachedConfig(r,i,a,o,t??[],s),v=t!=null;return h.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[v&&h.jsx(e,{ref:this.plot,data:t,layout:u,revision:d,config:f,onAfterPlot:this.handleAfterPlot,onError:$e.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),h.jsx(ln,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"chart-error",children:l}),h.jsx(io,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}se(Ge,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:so.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:gr,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const Dp=Ge;function ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(t),!0).forEach(function(r){J(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function J(n,e,t){return e=Ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ip(n){var e=xp(n,"string");return typeof e=="symbol"?e:String(e)}function xp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var re=H.module("FigureChartModel");class gn extends be{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,J(this,"chartUtils",void 0),J(this,"dh",void 0),J(this,"figure",void 0),J(this,"settings",void 0),J(this,"theme",void 0),J(this,"data",void 0),J(this,"layout",void 0),J(this,"seriesDataMap",void 0),J(this,"pendingSeries",void 0),J(this,"oneClicks",void 0),J(this,"filterColumnMap",void 0),J(this,"lastFilter",void 0),J(this,"isConnected",void 0),J(this,"seriesToProcess",void 0),J(this,"addPendingSeries",Ze(()=>{for(var s=le.getAxisTypeMap(this.figure),{pendingSeries:l}=this,u=function(){var v,p=l[d],m=i.figure.charts.find(g=>g.series.includes(p));i.addSeries(p,s,(v=m==null?void 0:m.showLegend)!==null&&v!==void 0?v:null),p.subscribe()},d=0;d<l.length;d+=1)u();this.pendingSeries=[]},gn.ADD_SERIES_DEBOUNCE)),J(this,"getTimeZone",ot((s,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),J(this,"getValueTranslator",ot((s,l)=>{var u=this.getTimeZone(s,l);return d=>this.chartUtils.unwrapValue(d,u)})),J(this,"getValueParser",ot((s,l)=>{var u=this.getTimeZone(s,l);return d=>this.chartUtils.wrapValue(d,s,u)})),J(this,"getRangeParser",ot((s,l)=>u=>{var[d,f]=u,v=this.getValueParser(s,l);return d=v(d),f=v(f),[d,f]})),J(this,"getAxisRangeParser",ot((s,l)=>u=>{var d=le.getSourceForAxis(s,u);return d!=null?this.getRangeParser(d.columnType,l):f=>f})),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.dh=e,this.chartUtils=new le(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var o={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:o},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,r=le.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var v=t[o],p=0;p<v.series.length;p+=1){var m=v.series[p];i.push(m.name),e.addSeries(m,r,v.showLegend)}var{axes:g,title:b}=v;if(b!=null&&b.length>0&&(t.length>1||e.figure.title!=null)){var _=g.find(F=>F.type===e.dh.plot.AxisType.X),S=g.find(F=>F.type===e.dh.plot.AxisType.Y);if(_==null||S==null)re.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",v);else{var w,T,y,O,M=((w=(T=r.get(_.type))===null||T===void 0?void 0:T.findIndex(F=>F===_))!==null&&w!==void 0?w:0)+1,A=((y=(O=r.get(S.type))===null||O===void 0?void 0:O.findIndex(F=>F===S))!==null&&y!==void 0?y:0)+1,j={align:"center",x:.5,y:1,yshift:17,text:b,showarrow:!1,xref:"x".concat(M," domain"),yref:"y".concat(A," domain")};e.layout.annotations==null?e.layout.annotations=[j]:e.layout.annotations.push(j)}}},o=0;o<t.length;o+=1)a();for(var s=[...this.seriesDataMap.keys()],l=s.filter(f=>i.indexOf(f)<0),u=0;u<l.length;u+=1){var d=l[u];this.seriesDataMap.delete(d)}}addSeries(e,t,r){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,le.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=le.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:o}=e,{columns:s}=o,l=0;l<s.length;l+=1)this.filterColumnMap.set(s[l].name,s[l]);this.oneClicks.push(o)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){re.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(re.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){re.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){re.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){re.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){re.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;re.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];re.debug2("handleFigureUpdated updating series",a.name);for(var{sources:o}=a,s=0;s<o.length;s+=1){var l=o[s],{columnType:u,type:d}=l,f=this.getValueTranslator(u,this.formatter),v=t.getArray(a,d,f);this.setDataArrayForSeries(a,d,v)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){re.error("Request failed",e),this.fireError(["".concat(e.detail)])}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){re.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){re.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;re.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=le.DEFAULT_MARGIN.t+i*le.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=aa({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=aa({},this.layout.title.pad),this.layout.title.pad.t=le.DEFAULT_TITLE_PADDING.t+i*le.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{re.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):re.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,o=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);o&&Ha(o,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:o,xHigh:s}=a;if(o&&s&&o.length===s.length){for(var l=[],u=0;u<o.length;u+=1)l.push(s[u]-o[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:d,xLow:f,xHigh:v,y:p,yLow:m,yHigh:g}=a;f&&v&&f!==d&&(a.error_x=le.getPlotlyErrorBars(d,f,v,this.theme)),m&&g&&m!==p&&(a.error_y=le.getPlotlyErrorBars(p,m,g,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:b,labels:_}=a;b!==void 0&&_===void 0&&(a.labels=b)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){var t=this;if(this.oneClicks.length===0){re.warn("Trying to set a filter, but no one click!");return}re.debug("setFilter",e);for(var r=function(){var o=t.oneClicks[i],{columns:s}=o,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var d=e.get(u);t.lastFilter.get(u)!==d&&s.find(f=>f.name===u)!=null&&o.setValueForColumn(u,d)})},i=0;i<this.oneClicks.length;i+=1)r();this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}}J(gn,"ADD_SERIES_DEBOUNCE",50);const Kn=gn;function oa(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function On(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){oa(a,r,i,o,s,"next",l)}function s(l){oa(a,r,i,o,s,"throw",l)}o(void 0)})}}class Rr{static makeModelFromSettings(e,t,r,i){return On(function*(){var a=yield Rr.makeFigureFromSettings(e,t,r);return new Kn(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return On(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new le(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return On(function*(){return new Kn(e,r,i,t)})()}}const Ap=Rr,Mp="var(--dh-color-chart-colorway)",Np="var(--dh-color-chart-grid)",Lp="var(--dh-color-chart-axis-line)",jp="var(--dh-color-chart-axis-line-zero)",sa={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-color)",colorway:Mp,gridcolor:Np,linecolor:Lp,zerolinecolor:jp,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var la=H.module("ChartTheme");function kr(){var n,e=dr(sa);return e.colorway=Ja((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Iu.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),la.debug2("Chart theme:",sa),la.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function vt(n,e,t){return e=Fp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=Rp(n,"string");return typeof e=="symbol"?e:String(e)}function Rp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Z extends be{static get theme(){return Z._theme==null&&(Z._theme=kr()),Z._theme}static makeRandomSeries(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,i=[],a=[],o=[],s=[],l=new Date("2018-06-01"),u=0;u<r;u+=1){var d=new Date(l.getFullYear(),l.getMonth(),l.getDate()+u-r);i.push("".concat(d.getFullYear(),"-").concat(d.getMonth()+1,"-").concat(d.getDate()));var f=(Math.sin(u/r*e)*r/3+Math.cos(u*.2)*r/6+Math.sin(u*.5)*r/10+Z.random()*r/5+u*Z.smoothing)*t;f=Math.round(f*100)/100,a.push(f),s.push(40+u*Z.smoothing),o.push(Math.sin(u/r*e)*r/3+Z.random()*r/10+u*Z.smoothing)}return{x:i,y:a,s:o,l:s}}static makeScatter(e){return{name:"SCTR",x:e.x,y:e.y,type:"scatter",mode:"markers",hoverinfo:"skip",marker:{size:5}}}static makeArea(e){return{name:"AREA",x:e.x,y:e.s,type:"scatter",mode:"line",fill:"tozeroy",hoverinfo:"all",line:{width:3}}}static makeTrendline(e){return{name:"Trendline <br>R<sup>2</sup> = 0.91",x:e.x,y:e.l,type:"scatter",mode:"line",hoverinfo:"skip",line:{width:3,dash:"dot"}}}static makeErrorBand(e){for(var t=[],r=[],i=0;i<e.y.length;i+=1){var a=e.y[i];t[i]=Math.round((a+18)*100)/100,r[i]=Math.round((a-18)*100)/100}var o=t.concat(r.reverse());return{name:"error",x:e.x.concat(e.x.slice().reverse()),y:o,type:"scatter",mode:"line",hoverinfo:"skip",fill:"toself",line:{width:0,color:Z.theme.error_band_line_color,shape:"spline"}}}static makeLine(e){return{name:"LINE",x:e.x,y:e.y,type:"scatter",mode:"line",hoverinfo:"x+y+text+name",line:{width:3}}}static makeRandomData(){var e=Z.makeRandomSeries(6),t=Z.makeArea(e),r=Z.makeTrendline(e),i=Z.makeRandomSeries(2),a=Z.makeLine(i),o=Z.makeErrorBand(i);return[t,r,a,o]}static makeDefaultLayout(e){var t=new le(e).makeDefaultLayout(Z.theme);return t.title="Chart",t.xaxis&&(t.xaxis.title="Datestamp"),t.yaxis&&(t.yaxis.title="Price"),t}constructor(e){var{data:t=Z.makeRandomData(),layout:r=Z.makeDefaultLayout(e),filterFields:i=[]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(e),vt(this,"data",void 0),vt(this,"filterFields",void 0),vt(this,"layout",void 0),this.data=t,this.layout=r,this.filterFields=i}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){for(var e=new Map,t=0;t<this.filterFields.length;t+=1){var r=this.filterFields[t],i="java.lang.String";e.set(r,{name:r,type:i})}return e}isFilterRequired(){return this.filterFields.length>0}setFilter(){this.fireUpdate(this.data)}}vt(Z,"random",Math.random.bind(Math));vt(Z,"smoothing",1.5);vt(Z,"_theme",void 0);const kp=Z,$p=Bs(gr);var $r=c.createContext(null);function Us(n){var{children:e}=n,{activeThemes:t}=It(),r=c.useMemo(kr,[t]);return h.jsx($r.Provider,{value:r,children:e})}function Bp(n){return n.setFigure!==void 0}function Wp(){return bt($r,"No ChartThemeContext value found.")}const Up=Object.freeze(Object.defineProperty({__proto__:null,Chart:Dp,ChartModel:be,ChartModelFactory:Ap,ChartThemeContext:$r,ChartThemeProvider:Us,ChartUtils:le,DownsamplingError:Ws,FigureChartModel:Kn,MockChartModel:kp,Plot:$p,defaultChartTheme:kr,isFigureChartModel:Bp,useChartTheme:Wp},Symbol.toStringTag,{value:"Module"}));var Vs=Object.freeze({openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showPopoutIcon:!0,showMaximiseIcon:!0,showCloseIcon:!0,responsiveMode:"onload",tabOverlapAllowance:0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:10,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"Close",maximise:"Maximize",minimise:"Minimize",popout:"Open in new window",popin:"Pop in",tabDropdown:"Additional tabs",tabNextLabel:"Next",tabPreviousLabel:"Previous"},content:[]});function Hs(n){return n.componentName!==void 0}function Vp(n){return n.component!==void 0}var zs=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Hp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Vs,isGLComponentConfig:Hs,isReactComponentConfig:Vp,itemDefaultConfig:zs},Symbol.toStringTag,{value:"Module"}));function Gt(n,e,t){return e=zp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zp(n){var e=Gp(n,"string");return typeof e=="symbol"?e:String(e)}function Gp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Tt{constructor(){Gt(this,"_mSubscriptions",void 0),Gt(this,"off",this.unbind),Gt(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Tt.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];if(t)for(var o=0;o<t.length;o++){var s=t[o].ctx||{};try{t[o].fn.apply(s,i)}catch(f){console.error("Error while emitting event:",f)}}i.unshift(e);for(var l=this._mSubscriptions[Tt.ALL_EVENT],u=0;u<l.length;u++){var d=l[u].ctx||{};try{l[u].fn.apply(d,i)}catch(f){console.error("Error while emitting event to allEventSubs:",f)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,a=0;a<this._mSubscriptions[e].length;a++)(!t||this._mSubscriptions[e][a].fn===t)&&(!r||r===this._mSubscriptions[e][a].ctx)&&(this._mSubscriptions[e].splice(a,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Gt(Tt,"ALL_EVENT","__all");const Ce=Tt;function we(n,e,t){return e=Kp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kp(n){var e=Xp(n,"string");return typeof e=="symbol"?e:String(e)}function Xp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xn extends Ce{constructor(e,t,r){super(),we(this,"width",void 0),we(this,"height",void 0),we(this,"title",void 0),we(this,"parent",void 0),we(this,"layoutManager",void 0),we(this,"tab",void 0),we(this,"_config",void 0),we(this,"isHidden",!1),we(this,"beforeCloseHandler",void 0),we(this,"_element",L(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),we(this,"_contentElement",void 0),this.title=Hs(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,a,o=this.parent,s=null;o&&!o.isColumn&&!o.isRow;){var l;if(s=o,o=o.parent,(l=o)!==null&&l!==void 0&&l.isRoot)return!1}if(!o||!s)return!1;for(var u=o.isColumn?"height":"width",d=u==="height"?t:e,f=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=d/f*100,p=(((a=s.config[u])!==null&&a!==void 0?a:0)-v)/(o.contentItems.length-1),m=0;m<o.contentItems.length;m++)if(o.contentItems[m]===s)o.contentItems[m].config[u]=v;else{var g;o.contentItems[m].config[u]=((g=o.contentItems[m].config[u])!==null&&g!==void 0?g:0)+p}return o.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}extendState(e){this.setState(L.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,a=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-a),this.emit("resize")}}}const Yp=Object.freeze(Object.defineProperty({__proto__:null,Container:Xn,ItemContainer:Xn},Symbol.toStringTag,{value:"Module"}));function Gs(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Ks(n){if(window.location.hash)return Gs(n);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},r,i;for(i=0;i<e.length;i++)r=e[i].split("="),t[r[0]]=r[1];return t[n]||null}function Br(n){return window.requestAnimationFrame(n)}function qp(n,e){var t=e.indexOf(n);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Wr(){return(Math.random()*1e15).toString(36).replace(".","")}function Zp(n,e){var t=n.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Ur(n){return L.trim(n.replace(/(<([^>]+)>)/gi,""))}function he(n,e,t){return e=Jp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jp(n){var e=Qp(n,"string");return typeof e=="symbol"?e:String(e)}function Qp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class em extends Ce{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),he(this,"_eElement",void 0),he(this,"_oDocument",void 0),he(this,"_eBody",void 0),he(this,"_destroyAfterMouseUp",void 0),he(this,"_nDelay",400),he(this,"_timeout",void 0),he(this,"timeout",void 0),he(this,"_nDistance",10),he(this,"_nX",0),he(this,"_nY",0),he(this,"_nOriginalX",0),he(this,"_nOriginalY",0),he(this,"_bDragging",!1),this._eElement=e,this._oDocument=L(document),this._eBody=L(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,a,o=this._getCoordinates(e);this._nOriginalX=(t=o.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=o.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(a=this._oDocument)===null||a===void 0||a.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,a,o;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(a=i.find("iframe"))===null||a===void 0||a.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}const Mt=em;function rt(n,e,t){return e=tm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tm(n){var e=nm(n,"string");return typeof e=="symbol"?e:String(e)}function nm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xs{constructor(e,t){rt(this,"_container",void 0),rt(this,"_reactComponent",null),rt(this,"_portalComponent",null),rt(this,"_originalComponentWillUpdate",null),rt(this,"_initialState",void 0),rt(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=za.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=L.extend(e,this._container._config.props);return q.createElement(this._reactClass,t)}}var en=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],rm=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Vr(n){if(en.length>36)throw new Error("Too many keys in config minifier map");var e={};return Hr(n,e,"_min"),e}function Yn(n){if(en.length>36)throw new Error("Too many keys in config minifier map");var e={};return Hr(n,e,"_max"),e}function Hr(n,e,t){var r=t==="_min"?im:am;for(var i in n)if(n.hasOwnProperty(i)){var a=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof a=="object"&&a!=null){var o=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=o;else{var s=r(i,en);e[s]=o}Hr(a,o,t)}else{var l=r(a,rm);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,en);e[u]=l}}}}function im(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function am(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function Dn(n,e,t){return e=om(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function om(n){var e=sm(n,"string");return typeof e=="symbol"?e:String(e)}function sm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qn{constructor(e,t){Dn(this,"name",void 0),Dn(this,"origin",void 0),Dn(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Bt(n,e,t){return e=lm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lm(n){var e=um(n,"string");return typeof e=="symbol"?e:String(e)}function um(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let dm=class extends Ce{constructor(e){super(),Bt(this,"_layoutManager",void 0),Bt(this,"_dontPropagateToParent",void 0),Bt(this,"_childEventSource",void 0),Bt(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ce.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),L(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){L(window).off("gl_child_event",this._boundOnEventFromChild)}};const Ys=dm,cm=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:qn,DragListener:Mt,EventEmitter:Ce,EventHub:Ys,ReactComponentHandler:Xs,animFrame:Br,filterXss:Zp,getHashValue:Gs,getQueryStringParam:Ks,getUniqueId:Wr,minifyConfig:Vr,removeFromArray:qp,stripTags:Ur,unminifyConfig:Yn},Symbol.toStringTag,{value:"Module"}));function Be(n,e,t){return e=hm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hm(n){var e=fm(n,"string");return typeof e=="symbol"?e:String(e)}function fm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qs extends Ce{constructor(e,t,r,i,a){super(),Be(this,"isInitialised",!1),Be(this,"_config",void 0),Be(this,"_dimensions",void 0),Be(this,"_parentId",void 0),Be(this,"_indexInParent",void 0),Be(this,"_layoutManager",void 0),Be(this,"_popoutWindow",null),Be(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=a,this._createWindow()}toConfig(){var e,t,r,i,a,o,s,l,u,d,f;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(a=this._popoutWindow)===null||a===void 0?void 0:a.screenX)!==null&&i!==void 0?i:(o=this._popoutWindow)===null||o===void 0?void 0:o.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(d=this._popoutWindow)===null||d===void 0?void 0:d.screenTop)!==null&&s!==void 0?s:0},content:(f=this.getGlInstance())===null||f===void 0?void 0:f.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=L.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var a;((a=this._layoutManager.root.contentItems.length)!==null&&a!==void 0?a:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;L(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var o;(o=this._popoutWindow)!==null&&o!==void 0&&o.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(a))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Wr();e=Vr(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function ie(n,e,t){return e=vm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vm(n){var e=pm(n,"string");return typeof e=="symbol"?e:String(e)}function pm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class et extends Ce{constructor(e,t,r,i,a,o){var s,l,u,d,f,v,p,m;if(super(),ie(this,"_dragListener",void 0),ie(this,"_layoutManager",void 0),ie(this,"_contentItem",void 0),ie(this,"_originalParent",void 0),ie(this,"_area",null),ie(this,"_lastValidArea",null),ie(this,"_minX",void 0),ie(this,"_maxX",void 0),ie(this,"_minY",void 0),ie(this,"_maxY",void 0),ie(this,"_width",void 0),ie(this,"_height",void 0),ie(this,"_sided",void 0),ie(this,"element",void 0),ie(this,"childElementContainer",void 0),ie(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=a,this._originalParent=o,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=L(et._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Ur((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(a.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),L(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var _,S;this._layoutManager.tabDropPlaceholder.width((_=this._proxyTab.outerWidth(!0))!==null&&_!==void 0?_:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var w=this._layoutManager.container.offset();this._minX=(u=w==null?void 0:w.left)!==null&&u!==void 0?u:0,this._minY=(d=w==null?void 0:w.top)!==null&&d!==void 0?d:0,this._maxX=((f=this._layoutManager.container.width())!==null&&f!==void 0?f:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(m=this.element.height())!==null&&m!==void 0?m:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,a,o=(i=r.pageX)!==null&&i!==void 0?i:0,s=(a=r.pageY)!==null&&a!==void 0?a:0,l=o>this._minX&&o<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(o,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}ie(et,"_template",'<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>');function Wt(n,e,t){return e=mm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mm(n){var e=gm(n,"string");return typeof e=="symbol"?e:String(e)}function gm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zs{constructor(e,t,r){Wt(this,"_element",void 0),Wt(this,"_itemConfig",void 0),Wt(this,"_layoutManager",void 0),Wt(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Mt(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(L.extend(!0,{},r));new et(e,t,this._dragListener,this._layoutManager,i,null)}}function Ut(n,e,t){return e=bm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bm(n){var e=ym(n,"string");return typeof e=="symbol"?e:String(e)}function ym(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Js{constructor(e,t,r){Ut(this,"_element",L(window)),Ut(this,"_itemConfig",void 0),Ut(this,"_layoutManager",void 0),Ut(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Mt(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(L.extend(!0,{},r));new et(e,t,this._dragListener,this._layoutManager,i,null)}}}function Qs(n,e,t){return e=_m(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _m(n){var e=wm(n,"string");return typeof e=="symbol"?e:String(e)}function wm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nt{constructor(){Qs(this,"element",L(Nt._template)),L(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}Qs(Nt,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function In(n,e,t){return e=Sm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sm(n){var e=Cm(n,"string");return typeof e=="symbol"?e:String(e)}function Cm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ct{constructor(e,t,r,i){In(this,"element",void 0),In(this,"_header",void 0),In(this,"_action",void 0),this._header=e,this.element=L('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function Em(n,e,t){return e=Pm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pm(n){var e=Tm(n,"string");return typeof e=="symbol"?e:String(e)}function Tm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Om extends Error{constructor(e,t){super(),Em(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Ye=Om,Dm=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Ye},Symbol.toStringTag,{value:"Module"}));function ne(n,e,t){return e=Im(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Im(n){var e=xm(n,"string");return typeof e=="symbol"?e:String(e)}function xm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ot(n){return n.isStack}function ye(n){return n.isComponent}function el(n){return n.isRoot}class ae extends Ce{constructor(e,t,r,i){super(),ne(this,"config",void 0),ne(this,"type",void 0),ne(this,"contentItems",void 0),ne(this,"parent",void 0),ne(this,"layoutManager",void 0),ne(this,"element",void 0),ne(this,"childElementContainer",void 0),ne(this,"componentName",void 0),ne(this,"isInitialised",!1),ne(this,"isMaximised",!1),ne(this,"isRoot",!1),ne(this,"isRow",!1),ne(this,"isColumn",!1),ne(this,"isStack",!1),ne(this,"isComponent",!1),ne(this,"tab",void 0),ne(this,"_pendingEventPropagations",void 0),ne(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Ce.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var a=0;a<this.contentItems.length;a++)this.contentItems[a].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(r!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var a;(a=this.parent)===null||a===void 0||a.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),a=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");a==null||a.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,Ot(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(a){for(var o=0;o<a.contentItems.length;o++)e(a.contentItems[o])===!0&&t.push(a.contentItems[o]),i(a.contentItems[o])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&ye(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var a=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},o=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+o,y2:a.top+s,surface:o*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new qn(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Ye("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(zs)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof qn&&t.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,t]):this._scheduleEventPropagationToLayoutManager(e,t))}_scheduleEventPropagationToLayoutManager(e,t){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,t.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Br(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function _t(n,e,t){return e=Am(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Am(n){var e=Mm(n,"string");return typeof e=="symbol"?e:String(e)}function Mm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tl extends ae{constructor(e,t,r){super(e,t,r,L()),_t(this,"config",void 0),_t(this,"componentName",void 0),_t(this,"container",void 0),_t(this,"parent",void 0),_t(this,"instance",void 0),this.config=t,this.parent=r;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=L.extend(!0,{},this.config.componentState||{});if(i==null)throw new Ye('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Xn(this.config,this,e),this.instance=new i(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){ae.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),ae.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),ae.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),ae.prototype._$destroy.call(this)}_$getArea(){return null}}function me(n,e,t){return e=Nm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nm(n){var e=Lm(n,"string");return typeof e=="symbol"?e:String(e)}function Lm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tn extends ae{constructor(e,t,r,i){super(t,r,i,L('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),me(this,"isRow",void 0),me(this,"isColumn",void 0),me(this,"childElementContainer",void 0),me(this,"parent",void 0),me(this,"_splitter",[]),me(this,"_splitterSize",void 0),me(this,"_splitterGrabSize",void 0),me(this,"_isColumn",void 0),me(this,"_dimension",void 0),me(this,"_splitterPosition",null),me(this,"_splitterMinPosition",null),me(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,a,o,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),ae.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(o=0;o<this.contentItems.length;o++)if(this.contentItems[o]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[o].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[o].config[this._dimension]=a}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,a=this.contentItems.indexOf(e),o=Math.max(a-1,0),s,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[o]&&(this._splitter[o]._$destroy(),this._splitter.splice(o,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}ae.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=r,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(ae.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,a=(t=this.element.height())!==null&&t!==void 0?t:0,o=0,s=[];this._isColumn?a-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,d,f=this._isColumn?Math.floor(a*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((d=this.contentItems[l].config.width)!==null&&d!==void 0?d:0)/100));o+=f,s.push(f)}var v=Math.floor((this._isColumn?a:i)-o);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var a=this.contentItems[i].config[r];a!=null?e+=a:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var o=0;o<t.length;o++)t[o].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,a=0,o=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++){this.contentItems[d];var f=u.itemSizes[d];f<t?(a+=t-f,l={width:t}):(i+=f-t,l={width:f},r.push(l)),s.push(l)}if(!(a===0||a>i)){var v=a/i;o=a;for(var p=0;p<r.length;p++){l=r[p];var m=Math.round((l.width-t)*v);o-=m,l.width-=m}o!==0&&(s[s.length-1].width-=o);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new nl(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var a,o;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),r=Math.max((o=e[i].minHeight)!==null&&o!==void 0?o:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,a,o=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=o.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,d=this._getMinimumDimensions((r=o.after.config.content)!==null&&r!==void 0?r:[]),f=this._isColumn?d.vertical:d.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=o.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((a=o.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(f||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,a,o,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,d=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),f=((a=s.before.config[this._dimension])!==null&&a!==void 0?a:0)+((o=s.after.config[this._dimension])!==null&&o!==void 0?o:0);s.before.config[this._dimension]=d*f,s.after.config[this._dimension]=(1-d)*f,e.element.css({top:0,left:0}),Br(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function da(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){Zn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zn(n,e,t){return e=jm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jm(n){var e=Fm(n,"string");return typeof e=="symbol"?e:String(e)}function Fm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Jn extends ae{constructor(e,t,r){super(e,da(da({},t),{},{type:"root"}),null,L('<div class="lm_goldenlayout lm_item lm_root"></div>')),Zn(this,"childElementContainer",void 0),Zn(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(ye(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,a=i==="left"||i==="right"?"row":"column",o=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof tn)||l.type!=a){var u=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[o]=50,e.config[o]=50,u.callDownwards("setSize")}else{var d,f=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),f.config[o]=((d=f.config[o])!==null&&d!==void 0?d:0)*.5,e.config[o]=f.config[o],l.callDownwards("setSize")}}}}function ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function it(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(r){ce(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ce(n,e,t){return e=Rm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rm(n){var e=km(n,"string");return typeof e=="symbol"?e:String(e)}function km(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Qn extends ae{constructor(e,t,r){var i,a,o,s,l,u,d,f,v;super(e,t,r,L('<div class="lm_item lm_stack"></div>')),ce(this,"_activeContentItem",null),ce(this,"_header",void 0),ce(this,"childElementContainer",L('<div class="lm_items"></div>')),ce(this,"header",void 0),ce(this,"parent",void 0),ce(this,"isStack",!0),ce(this,"_dropZones",{}),ce(this,"_dropSegment",null),ce(this,"_contentAreaDimensions",null),ce(this,"_dropIndex",void 0),ce(this,"_side",void 0),ce(this,"_sided",!1),ce(this,"config",void 0),this.parent=r,this.config=t;var p=e.config;this._side=!1,this._header={show:((i=p.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(a=p.settings)!==null&&a!==void 0&&a.showPopoutIcon?(o=p.labels)===null||o===void 0?void 0:o.popout:void 0,maximise:(s=p.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=p.settings)!==null&&u!==void 0&&u.showCloseIcon?(d=p.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(f=(v=p.labels)===null||v===void 0?void 0:v.minimise)!==null&&f!==void 0?f:void 0},p.header&&(this._header=it(it({},this._header),p.header)),t.header&&(this._header=it(it({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=it(it({},this._header),t.content[0].header)),this.header=new je(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,a,o=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?o:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:o);for(this.childElementContainer.width(s),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){ae.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",r=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",a=t&&this.parent.isColumn||r&&this.parent.isRow,o=t?"column":"row",s=t?"height":"width";if(ye(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var u,d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?d:d+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var f=this.layoutManager.createContentItem({type:o},this);this.parent.replaceChild(this,f),f.addChild(e,i?0:void 0,!0),f.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,f.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var a=i.hoverArea;if(a.x1<e&&a.x2>e&&a.y1<t&&a.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,a,o,s,l,u,d,f,v,p,m,g,b,_,S=this.header.tabs.length;if(S===0){var w,T,y,O,M,A,j,F,V=this.header.element.offset();(w=this.layoutManager.dropTargetIndicator)===null||w===void 0||w.highlightArea({x1:(T=V==null?void 0:V.left)!==null&&T!==void 0?T:0,x2:((y=V==null?void 0:V.left)!==null&&y!==void 0?y:0)+100,y1:(O=(M=this.header.element.offset())===null||M===void 0?void 0:M.top)!==null&&O!==void 0?O:0,y2:((A=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&A!==void 0?A:0)+((F=this.header.element.innerHeight())!==null&&F!==void 0?F:0)});return}var I=this.header.tabsContainer,C=(t=I.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),P=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!C||!P)){e<C.left?e=C.left+1:e>C.right&&(e=C.right-1);var x,R;if(!(P.left<e&&e<P.right)){for(var B=0;B<S;B++){var Y;if(x=this.header.tabs[B].element,R=(Y=x.get(0))===null||Y===void 0?void 0:Y.getBoundingClientRect(),R&&R.left<e&&e<R.right){this._dropIndex=B;break}}if(x&&R&&e<R.left+R.width*.5)x.before(this.layoutManager.tabDropPlaceholder);else if(x){var Q;this._dropIndex=Math.min(((Q=this._dropIndex)!==null&&Q!==void 0?Q:0)+1,S),x.after(this.layoutManager.tabDropPlaceholder)}}var $=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;$=Math.max($,(o=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&o!==void 0?o:0);var W=$+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);W=Math.min(W,((u=(d=this.header.tabsContainer.offset())===null||d===void 0?void 0:d.left)!==null&&u!==void 0?u:0)+((f=this.header.tabsContainer.innerWidth())!==null&&f!==void 0?f:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:$,x2:W,y1:(p=(m=this.header.element.offset())===null||m===void 0?void 0:m.top)!==null&&p!==void 0?p:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((_=this.header.element.innerHeight())!==null&&_!==void 0?_:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var a;(a=this.layoutManager.dropTargetIndicator)===null||a===void 0||a.highlightArea(i)}this._dropSegment=e}}const $m=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:ae,Component:tl,ContentItem:ae,Root:Jn,RowOrColumn:tn,Stack:Qn,isComponent:ye,isRoot:el,isStack:Ot},Symbol.toStringTag,{value:"Module"}));function xe(n,e,t){return e=Bm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bm(n){var e=Wm(n,"string");return typeof e=="symbol"?e:String(e)}function Wm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Lt{constructor(e,t){var r;xe(this,"header",void 0),xe(this,"contentItem",void 0),xe(this,"element",L(Lt._template)),xe(this,"titleElement",void 0),xe(this,"closeElement",void 0),xe(this,"isActive",!1),xe(this,"_layoutManager",void 0),xe(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new Mt(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),ye(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(e)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),ye(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new et(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){L(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){ye(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&ye(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):ye(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),ye(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),ye(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}xe(Lt,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function z(n,e,t){return e=Um(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Um(n){var e=Vm(n,"string");return typeof e=="symbol"?e:String(e)}function Vm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class je extends Ce{constructor(e,t){var r,i;super(),z(this,"layoutManager",void 0),z(this,"element",L(je._template)),z(this,"tabsContainer",void 0),z(this,"tabDropdownContainer",void 0),z(this,"tabDropdownSearch",void 0),z(this,"tabDropdownList",null),z(this,"controlsContainer",void 0),z(this,"parent",void 0),z(this,"tabs",[]),z(this,"activeContentItem",null),z(this,"closeButton",null),z(this,"tabDropdownButton",null),z(this,"tabNextButton",L(je._nextButtonTemplate)),z(this,"tabPreviousButton",L(je._previousButtonTemplate)),z(this,"holdTimer",null),z(this,"rAF",null),z(this,"CLICK_TIMEOUT",500),z(this,"START_SPEED",.01),z(this,"ACCELERATION",5e-4),z(this,"PADDING",10),z(this,"SCROLL_LEFT","left"),z(this,"SCROLL_RIGHT","right"),z(this,"isDraggingTab",!1),z(this,"isOverflowing",!1),z(this,"isDropdownShown",!1),z(this,"dropdownKeyIndex",0),z(this,"_lastVisibleTabIndex",-1),z(this,"_tabControlOffset",void 0),this.layoutManager=e,(r=this.layoutManager.config.settings)!==null&&r!==void 0&&r.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=t,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(i=this.layoutManager.config.settings)===null||i===void 0?void 0:i.tabControlOffset,this._createControls()}createTab(e,t){for(var r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===e)return;var i=new Lt(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,a,o=0;o<this.tabs.length;o++)a=this.tabs[o].contentItem===e,this.tabs[o].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=o);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,a,o,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((a=(o=this.tabsContainer.get(0))===null||o===void 0?void 0:o.offsetWidth)!==null&&a!==void 0?a:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,d;l.scrollLeft=(u=(d=this.tabsContainer.get(0))===null||d===void 0?void 0:d.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,a;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var o=this.tabsContainer.get(0);o&&(o.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0,o=this.tabsContainer.get(0);if(o){var s=o.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===o.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(d=>{var f,v,p=a||d,m=d-p,g=this.START_SPEED*m+.5*this.ACCELERATION*(m*m);g=Math.min(g,(f=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&f!==void 0?f:1/0),this._handleScrollRepeat(e,t,g,p)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),L(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,a;if(a=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Ct(this,a,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),r=this._getHeaderSetting("popout"),new Ct(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var o=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Ct(this,o,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",o??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Ct(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),L(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),L(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var d=(s+l+u.length)%u.length;d!==s;){if(u.eq(d).css("display")!=="none")return d;d=(d+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var a,o;e.preventDefault(),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),L(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var a=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(a!==0){var o=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=L(window).height())!==null&&r!==void 0?r:0,l=(i=L(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),d=a<s-u.bottom,f=!d&&u.bottom>s*.6,v=Math.min(u.left+(f?u.width:0),l-o.width-this.PADDING),p=f?Math.max(u.top-a,this.PADDING):u.bottom,m=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":m,top:p,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}z(je,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));z(je,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));z(je,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function wt(n,e,t){return e=Hm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hm(n){var e=zm(n,"string");return typeof e=="symbol"?e:String(e)}function zm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nl{constructor(e,t,r){wt(this,"_isVertical",void 0),wt(this,"_size",void 0),wt(this,"_grabSize",void 0),wt(this,"_dragListener",void 0),wt(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new Mt(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=L('<div class="lm_drag_handle"></div>'),t=L('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const Gm=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:qs,DragProxy:et,DragSource:Zs,DragSourceFromEvent:Js,DropTargetIndicator:Nt,Header:je,HeaderButton:Ct,Splitter:nl,Tab:Lt},Symbol.toStringTag,{value:"Module"}));var Km={config:Hp,container:Yp,controls:Gm,errors:Dm,items:$m,utils:cm};const Xm=Km;function ha(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function de(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ha(Object(t),!0).forEach(function(r){K(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function K(n,e,t){return e=Ym(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ym(n){var e=qm(n,"string");return typeof e=="symbol"?e:String(e)}function qm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class rl extends Ce{static minifyConfig(e){return Vr(e)}static unminifyConfig(e){return Yn(e)}constructor(e,t){super(),K(this,"isInitialised",!1),K(this,"_isFullPage",!1),K(this,"_resizeTimeoutId",void 0),K(this,"_components",{"lm-react-component":Xs}),K(this,"_fallbackComponent",void 0),K(this,"_itemAreas",[]),K(this,"_maximisedItem",null),K(this,"_maximisePlaceholder",L('<div class="lm_maximise_place"></div>')),K(this,"_creationTimeoutPassed",!1),K(this,"_subWindowsCreated",!1),K(this,"_dragSources",[]),K(this,"_updatingColumnsResponsive",!1),K(this,"_firstLoad",!0),K(this,"_reactChildMap",new Map),K(this,"_reactChildren",null),K(this,"width",null),K(this,"height",null),K(this,"root",void 0),K(this,"openPopouts",[]),K(this,"selectedItem",null),K(this,"isSubWindow",!1),K(this,"eventHub",new Ys(this)),K(this,"config",void 0),K(this,"container",void 0),K(this,"_originalContainer",void 0),K(this,"dropTargetIndicator",null),K(this,"tabDropPlaceholder",L('<div class="lm_drop_tab_placeholder"></div>')),K(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this.isSubWindow&&L("body").css("visibility","hidden"),this._typeToItem={column:tn.bind(this,!0),row:tn.bind(this,!1),stack:Qn,component:tl}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof ae))throw new Error("Root must be a ContentItem");var t={settings:de({},this.config.settings),dimensions:de({},this.config.dimensions),labels:de({},this.config.labels),content:[]},r=function a(o,s){for(var l in s.config)l!=="content"&&(o[l]=s.config[l]);if(o.componentName==="lm-react-component"&&(o.type="react-component"),s.contentItems.length){o.content=[];for(var u=0;u<s.contentItems.length;u++)o.content[u]={},a(o.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){L(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new Nt,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var a,o;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((o=this.container.height())!==null&&o!==void 0?o:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),L(window).off("resize",this._onResize),L(window).off("unload beforeunload",this._onUnload),L(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i;if(typeof e.type!="string")throw new Ye("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw r="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new Ye(r);return e.type==="component"&&!(t instanceof Qn)&&t&&!(this.isSubWindow===!0&&t instanceof Jn)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,t),i}createPopout(e,t,r,i){var a=[],o=e instanceof ae,s=this;if(o){var l;a=this.toConfig(e).content,r=Wr();for(var u=e.parent,d=e;((f=u)===null||f===void 0?void 0:f.contentItems.length)===1&&!u.isRoot;){var f;d=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(d)}}else e instanceof Array?a=e:a=[e];if(!t&&o){var p,m,g,b=window.screenX||window.screenLeft,_=window.screenY||window.screenTop,S=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:b+S.left,top:_+S.top,width:(m=e.element.width())!==null&&m!==void 0?m:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!o&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),o&&e.remove(),!(!t||!r||i===void 0)){var w=new qs(a,t,r,i,this);return w.on("initialised",function(){s.emit("windowOpened",w)}),w.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(w),w}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Zs(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Js(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,a=0;a<this._itemAreas.length;a++){var o=this._itemAreas[a];e>o.x1&&e<o.x2&&t>o.y1&&t<o.y2&&r>o.surface&&(r=o.surface,i=o)}return i}_$createRootItemAreas(){var e=50,t=de({},this.root._$getArea()),r=[de(de({},t),{},{side:"left",x2:t.x1+e}),de(de({},t),{},{side:"right",x1:t.x2-e}),de(de({},t),{},{side:"top",y2:t.y1+e}),de(de({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var r=e[t];if(Ot(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var a;this._itemAreas.push(i);var o=de(de({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);o.surface=(o.x2-o.x1)*(o.y2-o.y1),this._itemAreas.push(o)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof ae)return e;if(L.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&L(window).resize(this._onResize),L(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Ks("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Yn(e),localStorage.removeItem(r)),e=L.extend(!0,{},Vs,e);var i=function a(o){for(var s in o){var l=o[s];s!=="props"&&typeof l=="object"&&l!=null?a(l):s==="type"&&l==="react-component"&&(o.type="component",o.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=L('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Ur((e=this.config.content[0].title)!==null&&e!==void 0?e:""),L("head").append(L("body link, body style, template, .gl_keep")),this.container=L("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?L(this._originalContainer):L("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,L("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new Ye(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Ye(t,e);this.root=new Jn(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),a=e-i,o=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<a;l++){var u=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{Ot(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}K(rl,"__lm",Xm);const il=rl,Zm="_lm_dragging_4iylo_1",Jm="_lm_goldenlayout_4iylo_1",Qm="_lm_header_4iylo_1",eg="_lm_controls_4iylo_1",tg="_lm_tabpreviousbutton_4iylo_1",ng="_lm_tabnextbutton_4iylo_1",rg="_lm_tab_4iylo_1",ig="_lm_active_4iylo_1",ag="_lm_close_tab_4iylo_1",og="_lm_content_4iylo_1",sg="_lm_dragProxy_4iylo_1",lg="_lm_dropTargetIndicator_4iylo_1",ug="_march_4iylo_1",dg="_lm_inner_4iylo_1",cg="_lm_splitter_4iylo_1",hg="_lm_selectable_4iylo_1",fg="_lm_tabdropdown_list_4iylo_1",vg="_lm_title_4iylo_1",pg="_lm_title_before_4iylo_1",mg="_lm_selected_4iylo_1",gg="_lm_focusin_4iylo_1",bg="_lm_window_blur_4iylo_1",yg="_lm_popout_4iylo_1",_g="_lm_maximise_4iylo_1",wg="_lm_tabdropdown_4iylo_1",Sg="_lm_close_4iylo_1",Cg="_lm_tabdropdown_search_4iylo_1",Eg="_lm_tabs_4iylo_1",Pg="_lm_keyboard_active_4iylo_1",Tg="_lm_maximised_4iylo_1",Og="_lm_items_4iylo_1",fa={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Zm,lm_goldenlayout:Jm,lm_header:Qm,lm_controls:eg,lm_tabpreviousbutton:tg,lm_tabnextbutton:ng,lm_tab:rg,lm_active:ig,lm_close_tab:ag,lm_content:og,lm_dragProxy:sg,lm_dropTargetIndicator:lg,march:ug,lm_inner:dg,lm_splitter:cg,lm_selectable:hg,lm_tabdropdown_list:fg,lm_title:vg,lm_title_before:pg,lm_selected:mg,lm_focusin:gg,lm_window_blur:bg,lm_popout:yg,lm_maximise:_g,lm_tabdropdown:wg,lm_close:Sg,lm_tabdropdown_search:Cg,lm_tabs:Eg,lm_keyboard_active:Pg,lm_maximised:Tg,lm_items:Og},va=Object.freeze({tabHeight:parseInt(fa["tab-height"],10),dragBorderWidth:parseInt(fa["drag-border-width"],10)});function pa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function De(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pa(Object(t),!0).forEach(function(r){al(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function al(n,e,t){return e=Dg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dg(n){var e=Ig(n,"string");return typeof e=="symbol"?e:String(e)}function Ig(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var We=H.module("LayoutUtils");function ol(n){return n.componentName!==void 0}function ut(n){var e=n;return(ol(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Vt(n){return n.focus!==void 0}function ma(n){return n.type==="stack"}class k{static activateTab(e,t){var r=k.getStackForRoot(e,t,!1);if(!r){We.error("Could not find stack for config",t);return}var i=k.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=k.getStackForRoot(e,t,!1);if(!r)return We.error("Could not find stack for config",t),!1;var i=k.getContentItemInStack(r,t),a=r.getActiveContentItem();return a===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=t?"column":"row";if(el(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:r});var i=e.contentItems[0],a=t?i.isColumn:i.isRow;if(!a){e.removeChild(i,!0),e.addChild({type:r});var o=document.activeElement;e.contentItems[0].addChild(i),o&&o.focus!=null&&o.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&Ot(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var a=e.contentItems[i];if(a.isComponent&&a.config!=null&&ii(a.config,t))return e;var o=this.getStackForConfig(a,t,r);if(o)return o}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=this.getStackForConfig(e,t);return!o&&i&&(o=this.getStackForConfig(e,{component:t.component},a)),!o&&r&&(o=this.addStack(e)),o}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;o<t.length;o+=1){var s=t[o],l=o===t.length-1,u=k.getStackForRoot(e,{component:s},r&&l,i,a);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&ii(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var a=e[i],{component:o,content:s}=a;if(o){var l=t(o,a);l!=null?r.push(l):We.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o,'"'))}else if(s){var u=De(De({},a),{},{content:k.dehydrateLayoutConfig(s,t)});r.push(u)}else r.push(a)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(ma(r)&&delete r.activeItemIndex,k.dropLayoutMinorChange(i)):ut(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r){var i=k.cloneLayout(e),a=k.cloneLayout(t);return k.dropLayoutMinorChange(i),k.dropLayoutMinorChange(a),ze(i,a)}return ze(e,t)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var a=e[i];if(ut(a)){var o,{component:s,props:l={}}=a;r.push(De(De({},a),{},{id:(o=a==null?void 0:a.id)!==null&&o!==void 0?o:Le(),props:t(s,l)}))}else if(a.content!==void 0){var u=k.hydrateLayoutConfig(a.content,t);ma(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=u.length&&(We.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),r.push(De(De({},a),{},{content:u}))}else r.push(a)}return r}static openComponent(){var{root:e,config:t,replaceExisting:r=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:o=void 0,dragEvent:s=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,u=De({},t);if(u.id==null&&(u.id=Le.generate()),s!=null){e==null||e.layoutManager.createDragSourceFromEvent(u,s);return}var d=i||{id:u.id,component:u.component};Ae(e);var f=a?k.addStack(e):k.getStackForRoot(e,d);Ae(f);var v=k.getContentItemInStack(f,d);if(o!=null){var p=g=>{We.debug("Component created, focusing element",o),f.off("componentCreated",p);var{element:b}=g.origin;requestAnimationFrame(()=>{k.focusElement(b[0],o)})};f.on("componentCreated",p)}if(r&&v){var m=f.contentItems.indexOf(v);f.addChild(u,m+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[m])}else f.addChild(u);o==null&&l&&Vt(l)&&l.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,a={id:t.id},o=k.getContentItemInStack(e,a);if(r&&o&&e){var s=e==null?void 0:e.contentItems.indexOf(o);e.addChild(t,s+1),e.removeChild(o),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&Vt(i)&&i.focus()}static closeComponent(e,t,r){var i=k.getStackForRoot(e,t,!1,!1,!1);if(!i){We.warn("Cannot find stack for component, ignoring close",t);return}var a=k.getContentItemInStack(i,t),o=document.activeElement;a&&(ye(a)?a.container.close(r):i.removeChild(a)),o&&document.contains(o)&&Vt(o)&&o.focus()}static renameComponent(e,t,r){var i=k.getStackForRoot(e,t,!1);if(!i){We.error("Could not find stack for config",t);return}var a=k.getContentItemInStack(i,t);a&&a.setTitle(r)}static cloneComponent(e,t){var r=k.getStackForRoot(e,t,!1);if(!r)return We.error("Could not find stack for config",t),null;var{props:i={}}=t,a=k.getPanelComponentState(t),o={type:"react-component",component:t.component,props:De(De({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Le.generate()};return k.openComponentInStack(r,o),o}static getPanelComponentState(e){if(ol(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(ut(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:va.tabHeight,borderWidth:va.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=k.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return k.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=k.getComponentConfigFromContainer(t);if(r&&ut(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Vt(r)&&r.focus(),r)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var r=()=>{e.off("initialised",r),t()};e.on("initialised",r)})}}al(k,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var sl=q.forwardRef((n,e)=>{var t=k.getComponentNameFromPanel({props:n});return h.jsx("div",{ref:e,className:"panel-placeholder",children:h.jsxs("div",{children:['Component "',t,'" is not registered.']})})});sl.displayName="PanelPlaceholder";const ee=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function Dt(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function ll(n){return typeof n.id=="string"&&n.layout instanceof il&&n.panelManager instanceof bn&&typeof n.registerComponent=="function"}function xg(n){if(!ll(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function ga(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ba(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(r){Ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ue(n,e,t){return e=Ag(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Mg(n,"string");return typeof e=="symbol"?e:String(e)}function Mg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ge=H.module("PanelManager");class bn{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Ue(this,"layout",void 0),Ue(this,"hydrateComponent",void 0),Ue(this,"dehydrateComponent",void 0),Ue(this,"onPanelsUpdated",void 0),Ue(this,"closed",void 0),Ue(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=o,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ee.FOCUS,this.handleFocus),e.on(ee.MOUNT,this.handleMount),e.on(ee.UNMOUNT,this.handleUnmount),e.on(ee.REOPEN,this.handleReopen),e.on(ee.DELETE,this.handleDeleted),e.on(ee.CLOSED,this.handleClosed),e.on(ee.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(ee.FOCUS,this.handleFocus),e.off(ee.MOUNT,this.handleMount),e.off(ee.UNMOUNT,this.handleUnmount),e.off(ee.REOPEN,this.handleReopen),e.off(ee.DELETE,this.handleDeleted),e.off(ee.CLOSED,this.handleClosed),e.off(ee.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return k.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&ut(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=k.getStackForConfig(this.layout.root,{id:e});return(t=r&&k.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>Dt(r)&&t instanceof r.WrappedComponent||!Dt(r)&&t instanceof r))}updatePanel(e){var t=k.getIdFromPanel(e);if(t==null){ge.error("updatePanel Panel did not have an ID",e);return}ge.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=k.getIdFromPanel(e);if(t==null){ge.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ge.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ge.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ge.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){ge.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ge.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ge.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){ge.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var a=ba(ba({},e),{},{props:i}),{root:o}=this.layout;k.openComponent({root:o,config:a,replaceConfig:t})}handleDeleted(e){ge.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ge.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;k.closeComponent(r,t)}addClosedPanel(e){var t=k.getComponentConfigFromContainer(e);if(t&&ut(t)){var r=this.dehydrateComponent(t.component,t);r!=null&&this.closed.push(r)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Ue(bn,"MAX_CLOSED_PANEL_COUNT",100);var Ng=H.module("PanelErrorBoundary");class ul extends c.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=k.getIdFromContainer(e);Ng.debug("componentWillUnmount",r),t.emit(ee.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?h.jsx("div",{className:"panel-error-boundary",children:h.jsx(Ee,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function ya(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function nn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ya(Object(t),!0).forEach(function(r){Lg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ya(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lg(n,e,t){return e=jg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jg(n){var e=Fg(n,"string");return typeof e=="symbol"?e:String(e)}function Fg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function zr(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var a={};return r!=null&&(a.metadata=r),i!=null&&(a.panelState=i),nn(nn({},n),{},{componentState:null,props:a,type:"react-component"})}function Gr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return nn(nn({metadata:{}},n),{},{localDashboardId:e})}function dl(n){var e=Dt(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!Dt(n)&&"$$typeof"in n&&n.$$typeof===Wl.ForwardRef;return e||t}const Rg={dehydrate:zr,hydrate:Gr};var Kr=q.createContext(void 0),kg=E.shape({on:E.func,off:E.func,isHidden:E.bool,tab:E.shape({header:E.shape({tabs:E.arrayOf(E.shape({contentItem:E.shape({})}))})}),title:E.string,setTitle:E.func,close:E.func}),cl=E.shape({on:E.func,off:E.func,emit:E.func}),$g=E.shape({registerComponent:E.func,root:E.shape({addChild:E.func}),on:E.func,off:E.func,eventHub:cl}),hl=Object.freeze({Container:kg,EventHub:cl,Layout:$g});function Ve(n,e,t){c.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function fl(n,e,t,r){var i,a=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(a==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");q.useEffect(()=>{var o=n(a,e,t,r);return()=>{o()}},[e,r,t,a,n])}function Bg(n){var{dashboardProps:e,componentName:t,component:r,supportedTypes:i,hydrate:a,dehydrate:o}=n,{id:s,layout:l,registerComponent:u}=e,d=c.useCallback(f=>{var v,{dragEvent:p,fetch:m,panelId:g=Le.generate(),widget:b}=f,{id:_,type:S}=b,w=(v=b.title)!==null&&v!==void 0?v:b.name,T=Array.isArray(i)&&i.includes(S)||S===i;if(T){var y={id:_,name:w,type:S},O={localDashboardId:s,metadata:y,fetch:m};a!=null&&(O=a(O,s));var M={type:"react-component",component:t,props:O,title:w,id:g},{root:A}=l;k.openComponent({root:A,config:M,dragEvent:p})}},[t,a,s,l,i]);fl(u,r,a,o),Ve(l.eventHub,ee.OPEN,d)}function Wg(){var n=c.useContext(Kr);if(n==null)throw new Error("LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?");return n}var Ug="SET_WORKSPACE";function _a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Xe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(r){Vg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Vg(n,e,t){return e=Hg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hg(n){var e=zg(n,"string");return typeof e=="symbol"?e:String(e)}function zg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Gg=n=>({type:Ug,payload:n}),Kg=n=>(e,t)=>{e(Gg(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i.save(n)},Xg=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r,a=Xe(Xe({},r),{},{data:Xe(Xe(Xe({},i),n),{},{settings:Xe(Xe({},i.settings),n.settings)})});return e(Kg(a))};function wa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Sa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(r){Yg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yg(n,e,t){return e=qg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qg(n){var e=Zg(n,"string");return typeof e=="symbol"?e:String(e)}function Zg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Jg(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case n:{var{id:a,payload:o}=i;return t&&ze({payload:o},{payload:r[a]})?r:Sa(Sa({},r),{},{[a]:o})}default:return r}}}function Ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ea(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ca(Object(t),!0).forEach(function(r){er(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function er(n,e,t){return e=Qg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qg(n){var e=eb(n,"string");return typeof e=="symbol"?e:String(e)}function eb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tb{constructor(){er(this,"reducers",{}),er(this,"listener",null)}register(e,t){var r;this.reducers=Ea(Ea({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var nb=new tb;const rb=nb;var Xr="SET_DASHBOARD_DATA";const ib=Jg(Xr,{},!1),vl={dashboardData:ib};var ab=new Map,pl=Object.freeze({}),ob=Object.freeze([]),ml=n=>n.dashboardData,tt=(n,e)=>{var t;return(t=ml(n)[e])!==null&&t!==void 0?t:pl},sb=(n,e)=>{var t;return(t=tt(n,e).closed)!==null&&t!==void 0?t:ob},lb=(n,e)=>{var t;return(t=tt(n,e).openedMap)!==null&&t!==void 0?t:ab},Yr=(n,e)=>{var t;return(t=tt(n,e).pluginDataMap)!==null&&t!==void 0?t:pl},gl=(n,e,t)=>Yr(n,e)[t];function Pa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function dt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pa(Object(t),!0).forEach(function(r){ub(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ub(n,e,t){return e=db(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function db(n){var e=cb(n,"string");return typeof e=="symbol"?e:String(e)}function cb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qr=(n,e)=>({type:Xr,id:n,payload:e}),Zr=(n,e)=>(t,r)=>t(qr(n,dt(dt({},tt(r(),n)),e))),bl=(n,e,t)=>(r,i)=>r(qr(n,dt(dt({},tt(i(),n)),{},{pluginDataMap:dt(dt({},Yr(i(),n)),{},{[e]:t})})));function hb(n,e){var t=or(),r=Ga(a=>gl(a,n,e)),i=c.useCallback(a=>t(bl(n,e,a)),[n,e,t]);return[r,i]}Object.entries(vl).map(n=>{var[e,t]=n;return rb.register(e,t)});function fb(n){var{children:e}=n;return h.jsx(h.Fragment,{children:e})}function Ta(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function St(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(r){vb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vb(n,e,t){return e=pb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pb(n){var e=mb(n,"string");return typeof e=="symbol"?e:String(e)}function mb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ht=H.module("DashboardLayout"),gb=Object.freeze({}),bb=[],Oa=()=>{},Da=n=>n;function Jr(n){var e,t,{id:r,children:i,emptyDashboard:a=h.jsx("div",{children:"Dashboard is empty."}),layout:o,layoutConfig:s=bb,onLayoutChange:l=Oa,onLayoutInitialized:u=Oa,hydrate:d=Gr,dehydrate:f=zr,panelWrapper:v=fb}=n,p=or(),m=(e=Ga(N=>tt(N,r)))!==null&&e!==void 0?e:gb,[g,b]=c.useState(!1),[_,S]=c.useState(!1),[w,T]=c.useState(),[y]=c.useState((t=m==null?void 0:m.closed)!==null&&t!==void 0?t:[]),[O,M]=c.useState(!1),[A,j]=c.useState(o.getReactChildren()),F=c.useMemo(()=>new Map,[]),V=c.useMemo(()=>new Map,[]),I=c.useCallback(function(N,U){var G,Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,ti=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f;Ht.debug2("registerComponent",N,U,Re,ti);function ni(jt,El){var yn=U,Pl=v,Tl=dl(yn),{glContainer:Ol,glEventHub:Dl}=jt;return h.jsx(ul,{glContainer:Ol,glEventHub:Dl,children:h.jsx(Pl,St(St({},jt),{},{children:Tl?h.jsx(yn,St(St({},jt),{},{ref:El})):h.jsx(yn,St({},jt))}))})}ni.displayName="DashboardWrapper(".concat((G=U.displayName)!==null&&G!==void 0?G:N,")");var Cl=o.registerComponent(N,q.forwardRef(ni));return F.set(N,Re),V.set(N,ti),Cl},[d,f,F,V,o,v]),C=c.useCallback((N,U)=>{var G;return((G=F.get(N))!==null&&G!==void 0?G:Da)(U,r)},[F,r]),P=c.useCallback((N,U)=>{var G;return((G=V.get(N))!==null&&G!==void 0?G:Da)(U,r)},[V,r]),x=c.useMemo(()=>new bn(o,C,P,new Map,y,N=>{var{closed:U,openedMap:G}=N;p(Zr(r,{closed:U,openedMap:G}))}),[P,p,C,r,y,o]),R=c.useCallback(()=>{if(!_){O||(u(),M(!0));var N=o.toConfig(),U=N.content,G=k.dehydrateLayoutConfig(U,P),Re=w==null||!k.isEqual(w,G);Ht.debug("handleLayoutStateChanged",Re,U,G),Re&&(b(o.root.contentItems.length===0),T(G),l(G),j(o.getReactChildren()))}},[P,O,_,w,o,l,u]),B=c.useCallback(N=>{var U=k.getIdFromContainer(N);o.eventHub.emit(ee.DRAGGING,U),S(!0)},[o.eventHub]),Y=c.useCallback(N=>{var U=k.getIdFromContainer(N);o.eventHub.emit(ee.DROPPED,U),S(!1)},[o.eventHub]),Q=c.useCallback(N=>{if(Ht.debug2("handleComponentCreated",N),!(N==null||N.config==null||N.config.component==null||N.element==null)){var U=N.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),G="".concat(U,"-component");N.element.addClass(G)}},[]),$=c.useCallback(()=>{j(o.getReactChildren())},[o]);Ve(o,"stateChanged",R),Ve(o,"itemPickedUp",B),Ve(o,"itemDropped",Y),Ve(o,"componentCreated",Q),Ve(o.eventHub,ee.TITLE_CHANGED,R),Ve(o,"reactChildrenChanged",$);var W=eo(s);return c.useEffect(function(){if(W!==s&&s!==w){Ht.debug("Setting new layout content...");for(var U=k.hydrateLayoutConfig(s,C);o.root.contentItems.length>0;)o.root.contentItems[0].remove();for(var G=0;G<U.length;G+=1)o.root.addChild(U[G]);b(o.root.contentItems.length===0)}},[C,o,s,w,x,W]),h.jsxs(h.Fragment,{children:[g&&a,A,q.Children.map(i,N=>N!=null?q.cloneElement(N,{id:r,layout:o,panelManager:x,registerComponent:I}):null)]})}Jr.propTypes={id:E.string.isRequired,children:E.node,data:E.shape({}),emptyDashboard:E.node,layout:hl.Layout.isRequired,layoutConfig:E.arrayOf(E.shape({})),onLayoutChange:E.func,onLayoutInitialized:E.func};function Ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function yb(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(r){_b(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _b(n,e,t){return e=wb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wb(n){var e=Sb(n,"string");return typeof e=="symbol"?e:String(e)}function Sb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Cb=100,xn=()=>{},Eb=Object.freeze({});function tr(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:a=Eb,onLayoutConfigChange:o=xn,onGoldenLayoutChange:s=xn,onLayoutInitialized:l=xn,fallbackComponent:u=sl,hydrate:d,dehydrate:f,panelWrapper:v}=n,p=c.useRef(null),[m,g]=c.useState(!1),[b,_]=c.useState();c.useEffect(function(){if(!p.current){_(void 0);return}var T=yb({},k.makeDefaultLayout());T.settings===void 0&&(T.settings={}),Object.assign(T.settings,a),T.content=[];var y=new il(T,p.current),O=()=>{y.off("initialised",O),g(!0)};return y.on("initialised",O),u!=null&&y.setFallbackComponent(u),y.init(),_(y),s(y),()=>{y.destroy()}},[a,u,s,g,_]);var S=c.useMemo(()=>sr(()=>{b!=null&&b.isInitialised&&(b==null||b.updateSize())},Cb),[b]);return br(p.current,S),h.jsxs("div",{className:"dashboard-container w-100 h-100",children:[h.jsx("div",{className:"w-100 h-100",ref:p}),m&&b&&h.jsx(Kr.Provider,{value:b,children:h.jsx(Jr,{emptyDashboard:r,id:e,layout:b,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:l,hydrate:d,dehydrate:f,panelWrapper:v,children:t})})]})}var yl="default",Qr="CREATE_DASHBOARD";function Pb(n,e){n.on(Qr,e)}function Tb(n,e){n.emit(Qr,e)}var Ob=["id","isActive","plugins"];function xa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(r){Db(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Db(n,e,t){return e=Ib(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ib(n){var e=xb(n,"string");return typeof e=="symbol"?e:String(e)}function xb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ab(n,e){if(n==null)return{};var t=Mb(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Mb(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Nb(n){var{id:e,isActive:t,plugins:r}=n,i=Ab(n,Ob),[a,o]=c.useState(t),s=or(),l=c.useCallback(u=>{s(e===yl?Xg({layoutConfig:u}):Zr(e,{layoutConfig:u}))},[e,s]);return!a&&t&&o(!0),a?h.jsx(tr,Aa(Aa({id:e,onLayoutConfigChange:l},i),{},{children:r})):h.jsx(Ee,{})}const Lb=Object.freeze(Object.defineProperty({__proto__:null,CREATE_DASHBOARD:Qr,DEFAULT_DASHBOARD_ID:yl,Dashboard:tr,DashboardLayout:Jr,DashboardUtils:Rg,GLPropTypes:hl,LayoutManagerContext:Kr,LayoutUtils:k,LazyDashboard:Nb,PanelErrorBoundary:ul,PanelEvent:ee,PanelManager:bn,SET_DASHBOARD_DATA:Xr,assertIsDashboardPluginProps:xg,canHaveRef:dl,default:tr,dehydrate:zr,emitCreateDashboard:Tb,getAllDashboardsData:ml,getClosedPanelsForDashboard:sb,getDashboardData:tt,getOpenedPanelMapForDashboard:lb,getPluginDataForDashboard:gl,getPluginDataMapForDashboard:Yr,hydrate:Gr,isDashboardPluginProps:ll,isWrappedComponent:Dt,listenForCreateDashboard:Pb,reducers:vl,setDashboardData:qr,setDashboardPluginData:bl,updateDashboardData:Zr,useDashboardPanel:Bg,useDashboardPluginData:hb,useLayoutManager:Wg,useListener:Ve,usePanelRegistration:fl},Symbol.toStringTag,{value:"Module"}));function jb(n){var{children:e}=n,{activeThemes:t}=It();return c.useEffect(function(){t!=null&&Od.initTheme()},[t]),h.jsx(h.Fragment,{children:e})}function _l(n,e,t){return e=Fb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fb(n){var e=Rb(n,"string");return typeof e=="symbol"?e:String(e)}function Rb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pt{static valueForCell(e,t,r){var i="".concat(e,",").concat(t);return r!==void 0&&r&&(i="(".concat(i,")")),i}constructor(e){_l(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pt.DEFAULT_TYPE,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return new this.dh.Column({index:r,name:e,type:t})}makeRollupTableConfig(){return new this.dh.RollupTableConfig}makeColumns(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=[],i=0;i<e;i+=1)r.push(this.makeColumn("".concat(t).concat(i),pt.DEFAULT_TYPE,i));return r}static makeUserColumnWidths(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5,t=new Map,r=0;r<e;r+=1)t.set(r.toString(),100);return t}makeRow(e){var t=new this.dh.Row({index:e,name:"".concat(e)});return t.get=jest.fn(r=>pt.valueForCell(e,r.index)),t}makeFilter(){return new this.dh.FilterCondition}makeSort(){return new this.dh.Sort}makeTable(){var{columns:e=this.makeColumns(),size:t=1e9,sort:r=[],layoutHints:i={}}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=new this.dh.Table({columns:e,size:t,sort:r});return a.copy=jest.fn(()=>Promise.resolve(a)),a.freeze=jest.fn(()=>Promise.resolve(a)),a.layoutHints=i,a}makeTreeTable(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.makeColumns(),t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=new this.dh.TreeTable({columns:e,size:t,sort:r});return i.copy=jest.fn(()=>Promise.resolve(i)),i}makeInputTable(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return new this.dh.InputTable(e)}makeSubscription(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.makeTable();return new this.dh.TableViewportSubscription({table:e})}makeModel(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.makeTable(),t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;return new Dd(i,e,t??new un(i),r)}}_l(pt,"DEFAULT_TYPE","java.lang.String");const kb=pt;function qe(n,e,t){return e=$b(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $b(n){var e=Bb(n,"string");return typeof e=="symbol"?e:String(e)}function Bb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ie=H.module("TableViewportUpdater"),Wb=150;class Ne extends c.PureComponent{constructor(){super(...arguments),qe(this,"subscription",void 0),qe(this,"getViewportRowRange",An((e,t,r)=>{var i=r-t,a=Math.max(0,t-i*Ne.ROW_BUFFER_PAGES),o=r+i*Ne.ROW_BUFFER_PAGES;return[a,o]})),qe(this,"getViewportColumns",An((e,t,r,i)=>{if(t==null||r==null)return null;for(var a=r-t,o=Math.max(0,t-a*Ne.COLUMN_BUFFER_PAGES),s=Math.min(r+a*Ne.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[],u=o;u<=s;u+=1){var d=Id.getModelIndex(u,i);l.push(e.columns[d])}return l})),qe(this,"updateViewport",sr((e,t,r,i,a)=>{if(t<e){Ie.error("Invalid viewport",e,t);return}if(e===0&&t===0){Ie.debug2("Ignoring 0-0 viewport");return}var{movedColumns:o,table:s}=this.props,[l,u]=this.getViewportRowRange(s,e,t),d=a??this.getViewportColumns(s,r,i,o);if(Ie.debug2("Setting Viewport Top:",l,"Bottom:",u,"Columns:",d),this.subscription==null){Ie.debug2("updateViewport creating new subscription"),this.subscription=s.setViewport(l,u,d);var{onSubscription:f}=this.props;f(this.subscription)}else Ie.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,u,d)},Wb))}componentDidMount(){var{top:e,bottom:t,left:r,right:i,table:a,filters:o,sorts:s,columns:l,customColumns:u}=this.props;a.applyFilter(o),a.applySort(s),a.applyCustomColumns(u),this.updateViewport(e,t,r,i,l)}componentDidUpdate(e){var{top:t,bottom:r,left:i,right:a,table:o,filters:s,sorts:l,customColumns:u,columns:d}=this.props,f=s!==e.filters,v=l!==e.sorts,p=u!==e.customColumns,m=o!==e.table;(f||v||p||m)&&this.closeSubscription(),(f||m)&&(Ie.debug("update table filter",s),o.applyFilter(s)),(v||m)&&(Ie.debug("update table sort",l),o.applySort(l)),(p||m)&&(Ie.debug("update table custom columns",u),o.applyCustomColumns(u)),this.updateViewport(t,r,i,a,d)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(Ie.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;var{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}}qe(Ne,"ROW_BUFFER_PAGES",3);qe(Ne,"COLUMN_BUFFER_PAGES",1);qe(Ne,"defaultProps",{top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]});const Ub=Ne;function rn(n,e,t){return e=Vb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vb(n){var e=Hb(n,"string");return typeof e=="symbol"?e:String(e)}function Hb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var at=H.module("TreeTableViewportUpdater"),zb=150;class an extends c.PureComponent{constructor(e){super(e),rn(this,"listenerCleanup",void 0),rn(this,"updateViewport",sr((t,r)=>{if(r<t){at.error("Invalid viewport",t,r);return}if(t===0&&r===0){at.debug2("Ignoring 0-0 viewport");return}var{table:i,updateInterval:a}=this.props,o=r-t,s=Math.max(0,t-o*3),l=r+o*3+1;if(at.debug2("Setting Viewport Top:",s,"Bottom:",l,i),!this.listenerCleanup){var{dh:u,onViewportUpdate:d}=this.props;this.listenerCleanup=i.addEventListener(u.TreeTable.EVENT_UPDATED,d)}i.setViewport(s,l,void 0,a)},zb)),this.listenerCleanup=null}componentDidMount(){var{top:e,bottom:t,table:r,filters:i,sorts:a}=this.props;at.debug("componentDidMount",this.props),r.applyFilter(i),r.applySort(a),this.updateViewport(e,t)}componentDidUpdate(e){var{top:t,bottom:r,table:i,filters:a,sorts:o}=this.props;a!==e.filters&&(at.debug("update table filter",a),i.applyFilter(a)),o!==e.sorts&&(at.debug("update table sort",o),i.applySort(o)),this.updateViewport(t,r)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}}rn(an,"UPDATE_INTERVAL",1e3);rn(an,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:an.UPDATE_INTERVAL});const Gb=an,Kb=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:xd,AdvancedSettingsType:Ad,AggregationEdit:Md,AggregationUtils:Nd,Aggregations:Ld,BarIcon:jd,ChartBuilder:Fd,ColumnHeaderGroup:Rd,CustomColumnBuilder:kd,DownloadServiceWorkerUtils:$d,FormatColumnWhereIcon:Bd,FormatRowWhereIcon:Wd,HistogramIcon:Ud,InputEditor:Vd,IrisGrid:li,IrisGridMetricCalculator:Hd,IrisGridModel:zd,IrisGridModelFactory:Gd,IrisGridPartitionedTableModel:Kd,IrisGridRenderer:Xd,IrisGridTableModel:Yd,IrisGridTableModelTemplate:qd,IrisGridTestUtils:kb,IrisGridThemeContext:Zd,IrisGridThemeProvider:yo,IrisGridTreeTableModel:Jd,IrisGridUtils:Qd,LineIcon:ec,OptionType:tc,PieIcon:nc,RollupRows:rc,SHORTCUTS:ic,ScatterIcon:ac,TableCsvExporter:oc,TableSaver:sc,TableViewportUpdater:Ub,TreeTableViewportUpdater:Gb,VisibilityOrderingBuilder:lc,createDefaultIrisGridTheme:uc,default:li,isIrisGridTableModelTemplate:dc,isPanelStateV1:cc,isPanelStateV2:hc,isPartitionedGridModel:fc,isPartitionedGridModelProvider:vc},Symbol.toStringTag,{value:"Module"}));var wl={react:q,"react-dom":za,redux:Ul,"react-redux":Vl,"@adobe/react-spectrum":Hl,"@deephaven/auth-plugins":fp,"@deephaven/chart":Up,"@deephaven/components":Rf,"@deephaven/dashboard":Lb,"@deephaven/icons":xu,"@deephaven/iris-grid":Kb,"@deephaven/jsapi-bootstrap":Vf,"@deephaven/jsapi-components":Nv,"@deephaven/jsapi-utils":nv,"@deephaven/log":H,"@deephaven/plugin":Wv,"@deephaven/react-hooks":Zc},Xb=zl.createRequires(wl),Yb=Gl({requires:Xb});const qb=Yb;function Ma(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ei(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ma(a,r,i,o,s,"next",l)}function s(l){Ma(a,r,i,o,s,"throw",l)}o(void 0)})}}var He=H.module("@deephaven/app-utils.PluginUtils");function Zb(n){return nr.apply(this,arguments)}function nr(){return nr=ei(function*(n){var e=yield qb(n);return e}),nr.apply(this,arguments)}function Jb(n){return rr.apply(this,arguments)}function rr(){return rr=ei(function*(n){var e=yield fetch(n);if(!e.ok)throw new Error(e.statusText);try{return yield e.json()}catch{throw new Error("Could not be parsed as JSON")}}),rr.apply(this,arguments)}function Qb(n){return ir.apply(this,arguments)}function ir(){return ir=ei(function*(n){He.debug("Loading plugins...");try{var e=yield Jb("".concat(n,"/manifest.json"));if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");He.debug("Plugin manifest loaded:",e);for(var t=[],r=0;r<e.plugins.length;r+=1){var{name:i,main:a}=e.plugins[r],o="".concat(n,"/").concat(i,"/").concat(a);t.push(Zb(o))}for(var s=yield Promise.allSettled(t),l=new Map,u=0;u<s.length;u+=1){var d=s[u],{name:f}=e.plugins[u];if(d.status==="fulfilled"){var v,p=Ps(d.value)?d.value:(v=d.value.default)!==null&&v!==void 0?v:d.value;p==null?He.error("Plugin '".concat(f,"' is missing an exported value.")):l.set(f,p)}else He.error("Unable to load plugin '".concat(f,"'"),d.reason)}return He.info("Plugins loaded:",l),l}catch(m){return He.error("Unable to load plugins:",m),new Map}}),ir.apply(this,arguments)}function ey(n){var e,t;return(e=(t=n.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function ty(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,r=ey(e),i=[...n.entries(),...t.entries()].filter(l=>{var[,u]=l;return Ts(u)||Qt(u)}).map(l=>{var[u,d]=l;return Qt(d)?{type:Qe.AUTH_PLUGIN,name:u,component:d.AuthPlugin.Component,isAvailable:d.AuthPlugin.isAvailable}:d}),a=i.filter(l=>{var{isAvailable:u}=l;return u(r,e)});if(a.length===0)throw new Error("No login plugins found, please register a login plugin for auth handlers: ".concat(r));a.length>1&&He.warn("More than one login plugin available, will use the first one: ",a.map(l=>{var{name:u}=l;return u}).join(", "));var{name:o,component:s}=a[0];return He.info("Using LoginPlugin",o),s}var ny=Ka.createRequires(()=>wl),ry=Ka.createRemoteComponent({requires:ny});const Oy=ry;function Na(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function iy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Na(a,r,i,o,s,"next",l)}function s(l){Na(a,r,i,o,s,"throw",l)}o(void 0)})}}function ay(n){var{pluginsUrl:e,getCorePlugins:t,children:r}=n,[i,a]=c.useState(null);return c.useEffect(function(){var s=!1;function l(){return u.apply(this,arguments)}function u(){return u=iy(function*(){var d,f=(d=yield t==null?void 0:t())!==null&&d!==void 0?d:[],v=yield Qb(e);if(!s){var p=f.map(m=>[m.name,m]);a(new Map([...p,...v]))}}),u.apply(this,arguments)}return l(),()=>{s=!0}},[e,t]),h.jsx(At.Provider,{value:i,children:r})}function oy(){var n=Ar();return c.useEffect(function(){n.postMessage(Or(Tr))},[n]),null}function La(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function sy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){La(a,r,i,o,s,"next",l)}function s(l){La(a,r,i,o,s,"throw",l)}o(void 0)})}}var ly=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:Ns}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:Rs}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:Ms}]]);function uy(n){var{children:e}=n,t=Je(),r=c.useContext(At),[i,a]=c.useState(),[o,s]=c.useState();c.useEffect(function(){var f=!1;function v(){return p.apply(this,arguments)}function p(){return p=sy(function*(){try{var m=yield t.getAuthConfigValues();f||a(new Map(m))}catch(g){f||s(g)}}),p.apply(this,arguments)}return v(),()=>{f=!0}},[t]);var l=c.useMemo(()=>{if(!(r==null||i==null))try{return ty(r,i,ly)}catch(d){s(d)}},[i,r]),u=l==null||i==null;return u||o!=null?h.jsx(Ee,{isLoading:u&&o==null,errorMessage:gt(o)}):h.jsx(l,{authConfigValues:i,children:h.jsxs(h.Fragment,{children:[h.jsx(oy,{}),e]})})}function ja(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Fa(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ja(a,r,i,o,s,"next",l)}function s(l){ja(a,r,i,o,s,"throw",l)}o(void 0)})}}var dy=H.module("@deephaven/app-utils.ConnectionBootstrap");function cy(n){var{children:e}=n,t=Te(),r=Je(),[i,a]=c.useState(),[o,s]=c.useState();c.useEffect(function(){var d=!1;function f(){return v.apply(this,arguments)}function v(){return v=Fa(function*(){try{var p=yield r.getAsIdeConnection();if(d)return;s(p)}catch(m){if(d)return;a(m)}}),v.apply(this,arguments)}return f(),()=>{d=!0}},[t,r]),c.useEffect(function(){if(o==null)return;function d(v){var{detail:p}=v;dy.info("Shutdown","".concat(JSON.stringify(p))),a("Server shutdown: ".concat(p??"Unknown reason"))}var f=o.addEventListener(t.IdeConnection.EVENT_SHUTDOWN,d);return f},[t,o]);var l=c.useCallback(function(){var u=Fa(function*(d){return Ae(o,"connection"),o.getObject(d)});return function(d){return u.apply(this,arguments)}}(),[o]);return o==null||i!=null?h.jsx(Ee,{"data-testid":"connection-bootstrap-loading",isLoading:o==null,errorMessage:i!=null?"".concat(i):void 0}):h.jsx(mo.Provider,{value:o,children:h.jsx(Pr.Provider,{value:l,children:e})})}function Dy(n){return new URL(n,"".concat(window.location))}function hy(){var n=new URLSearchParams(window.location.search);return n.get("envoyPrefix")}function fy(){var n=hy();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function vy(n){var{children:e}=n,t=c.useContext(Ss);return t?h.jsx(h.Fragment,{children:e}):h.jsx(Ee,{"data-testid":"fonts-loaded-loading"})}function Ra(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function py(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ra(a,r,i,o,s,"next",l)}function s(l){Ra(a,r,i,o,s,"throw",l)}o(void 0)})}}var Sl=c.createContext(null);function my(n){var{children:e}=n,t=Je(),[r,i]=c.useState(),[a,o]=c.useState();c.useEffect(function(){var u=!1;function d(){return f.apply(this,arguments)}function f(){return f=py(function*(){try{var v=yield t.getServerConfigValues();u||i(new Map(v))}catch(p){u||o(p)}}),f.apply(this,arguments)}return d(),()=>{u=!0}},[t]);var s=r==null;return s||a!=null?h.jsx(Ee,{isLoading:s&&a==null,errorMessage:gt(a)}):h.jsx(Sl.Provider,{value:r,children:e})}function gy(){return bt(Sl,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function by(n){var{children:e}=n,t=gy(),r=c.useContext(bo),i=c.useContext(dn),a=$s(t,r,i);return h.jsx(go.Provider,{value:a,children:e})}function yy(n){var{children:e}=n,t=c.useContext(At),r=c.useMemo(()=>t==null?null:Ds(t),[t]);return h.jsx(oo,{themes:r,children:h.jsx(Us,{children:h.jsx(jb,{children:h.jsx(yo,{children:e})})})})}function Iy(n){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:r,serverUrl:i,children:a}=n,o=c.useMemo(()=>fy(),[]),[s,l]=c.useState(0),u=c.useCallback(()=>{},[]),d=c.useCallback(()=>{l(f=>f+1)},[]);return pn(u,d),h.jsx(Lv,{fontClassNames:e,children:h.jsx(ay,{getCorePlugins:r,pluginsUrl:t,children:h.jsx(yy,{children:h.jsx(Qo,{serverUrl:i,options:o,children:h.jsx(gs,{children:h.jsx(uy,{children:h.jsx(my,{children:h.jsx(by,{children:h.jsx(cy,{children:h.jsx(vy,{children:a})})})})})})},s)})})})}export{Iy as AppBootstrap,uy as AuthBootstrap,cy as ConnectionBootstrap,Lv as FontBootstrap,vy as FontsLoaded,Ss as FontsLoadedContext,ay as PluginsBootstrap,Oy as RemoteComponent,yy as ThemeBootstrap,ey as getAuthHandlers,ty as getAuthPluginComponent,Dy as getBaseUrl,fy as getConnectOptions,hy as getEnvoyPrefix,Jb as loadJson,Zb as loadModulePlugin,Qb as loadModulePlugins,gy as useServerConfig,My as useUser};
|
|
4
|
+
//# sourceMappingURL=index-2a61ac6c.js.map
|