@deephaven/embed-grid 0.57.1-alpha-theming-bootstrap.2 → 0.57.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import{C as h,$ as Zs,H as va,I as Qn,F as we,J as ga,r as c,K as qe,L as Me,M as Js,N as ba,O as Qs,P as ya,Q as el,S as tl,T as Vr,U as at,G as K,E as Y,V as E,W as nl,D as zt,X as rl,Y as il,Z as _a,_ as al,a0 as ol,a1 as mt,a2 as wa,a3 as Ve,a4 as On,a5 as x,R as Sa,a6 as zr,a7 as sl,a8 as ll,a9 as ul,aa as er,ab as dl,ac as cl,ad as hl,ae as fl,af as ml,ag as Ea}from"./vendor-50d678a0.js";import{L as W,i as pl,v as Ca,M as tr,b as nr,c as Pa,d as vl,e as gl,a as Ce,r as rr,f as ze,g as bl,h as yl,j as _l,T as Gt,k as wl,C as Sl,D as El,l as Cl,m as Pl,n as Ta,N as Tl,S as Ol,o as Il,p as Dl,W as xl,q as Al,s as Ml,t as Nl,u as Ll,w as jl,x as Oa,y as Ia,z as Fl,A as Rl,B as kl,E as $l,F as Bl,G as Ul,H as Wl,I as ir,J as Hl,K as Vl,O as Gr,P as zl,Q as Gl,R as Kl,U as Xl}from"./index-edaac177.js";import{g as Yl,c as vt,d as ql,e as Zl,h as Da,P as rn,B as Ne,T as wt,M as ar,D as xa,i as Aa,j as Jl,S as or,R as Kr,k as In,l as Dn,m as It,n as Ma,o as Ql,p as eu,q as tu,r as nu,C as ru,s as Na,t as iu,v as au,w as ou,G as su,x as lu,K as uu,y as du,z as cu,A as hu,O as fu,E as mu,F as pu,H as vu,J as gu,L as La,N as bu,Q as yu,U as _u,V as wu,W as ja,X as Su,Y as Eu,Z as Cu,_ as Pu,$ as Tu,a0 as Ou,a1 as Iu,a2 as Du,a3 as Fa,a4 as xu,a5 as Au,a6 as Mu,a7 as an,a8 as ut,a9 as Nu,aa as Lu,ab as ju,ac as Et,ad as Fu,ae as sr,af as Ru,ag as Ra,ah as ka,ai as lr,aj as ur,ak as $a,al as Ba,am as Ua,f as ku,an as Wa,ao as $u,ap as Bu,aq as dr,ar as Kt,as as Uu,at as Ha,au as Xr,av as Wu,aw as Hu,ax as Va,u as Vu,ay as zu,az as on,aA as za,aB as Ga,aC as Gu,aD as Ku,aE as Xu,I as Yr,aF as Yu,aG as qu,aH as Zu,aI as Ju,aJ as Qu,aK as ed,aL as td,aM as nd,aN as rd,aO as id,aP as ad,aQ as od,aR as sd,aS as ld,aT as ud,aU as dd,b as cd,aV as hd,aW as fd,aX as md,aY as pd,aZ as Ka,a_ as vd,a$ as gd,b0 as bd,b1 as yd,b2 as _d,b3 as wd,b4 as Sd,b5 as Ed,b6 as Cd,b7 as Pd,b8 as Td,b9 as Od,ba as Id,bb as Dd,bc as xd}from"./useUser-7c0ab046.js";import{a as _b}from"./useUser-7c0ab046.js";import{c as vn,P as cr,b as Ad,h as Md,p as Nd,o as Ld,s as jd,t as Fd}from"./plotly-71a0b13d.js";import"./helpers-042e6b4d.js";import"./monaco-9eb7d7d5.js";function pt(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 Xa=24,Rd=32,kd=33,$d=150,Ya=200,qa=500,Za=250,Bd={spellCheck:!1},Ud=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange"];function qr(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 Zr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(t),!0).forEach(function(r){Wd(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qr(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wd(n,e,t){return e=Hd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hd(n){var e=Vd(n,"string");return typeof e=="symbol"?e:String(e)}function Vd(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 zd(n,e){if(n==null)return{};var t=Gd(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 Gd(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 Ja(n){var{ariaLabel:e,icon:t,isQuiet:r,labelText:i,children:a,onOpenChange:o}=n,s=zd(n,Ud);return h.jsxs(Zs,{type:"popover",onOpenChange:o,children:[h.jsxs(va,Zr(Zr({},s),{},{"aria-label":e??i,isQuiet:r,children:[h.jsx(Qn,{children:h.jsx(we,{icon:t})}),i==null?null:h.jsx(ga,{children:i})]})),a]})}function Kd(n,e){return n===0?0:e==="all"||n===e.size?"all":e.size}function Qa(n,e){return n===e?!0:n==="all"||e==="all"||n.size!==e.size?!1:[...n.keys()].every(t=>e.has(t))}function eo(n,e){return n.isInverted===e.isInverted&&Qa(n.selection,e.selection)}function to(n,e,t){if(n==="all")return"all";var r=[...n.keys()];return new Set(r.map(i=>t(e(i))))}function no(n,e){var t=n==="all"||n.size>e/2,r=n;return t&&(r=n==="all"?new Set:new Set([...Yl(0,e-1)].filter(i=>!n.has(String(i))).map(i=>String(i)))),{selection:r,isInverted:t}}function Xd(n,e){return n?{}:{errorMessage:e,validationState:"invalid"}}function ro(n){var e;return(e=n==null?void 0:n.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function Yd(n){var e=n==null?void 0:n.UNSAFE_getDOMNode().lastElementChild;return io(e)}function qd(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 io(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 Jr(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 Zd(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Jr(a,r,i,o,s,"next",l)}function s(l){Jr(a,r,i,o,s,"throw",l)}o(void 0)})}}var gn=W.module("useAsyncInterval");function Jd(n,e){var t=ao(),r=c.useRef(0),i=c.useRef(0),a=c.useRef(null),o=c.useCallback(Zd(function*(){var s=Date.now();i.current+=1;var l=a.current==null?e:s-a.current;if(gn.debug("tick #".concat(i.current,"."),l,"ms elapsed since last tick."),a.current=s,yield n(),!!t.current){l+=Date.now()-a.current;var u=Math.max(0,l-e),d=Math.max(0,e-u);gn.debug("Next tick target:",e,", overage",u,", adjusted:",d),r.current=window.setTimeout(o,d)}}),[n,t,e]);c.useEffect(()=>(gn.debug("Setting target interval:",e),a.current=null,o(),()=>{window.clearTimeout(r.current)}),[e,o])}function Qd(n,e){return c.useCallback(function(){var t=n(...arguments);return e(),t},[e,n])}function Xt(n,e){var t=c.useMemo(()=>qe(n,e),[n,e]);return c.useEffect(()=>()=>t.cancel(),[t]),t}function ec(n){var[e,t]=c.useState(n);return c.useEffect(()=>{t(n)},[n]),[e,t]}function tc(n,e,t,r){var i=c.useRef(0);c.useEffect(()=>{i.current>=t||r&&(i.current+=1,n())},[t,r,...e])}function oo(n,e){var t=c.useRef(n),r=e(t.current,n)?t.current:n;return t.current=r,r}function nc(n){n.preventDefault()}function so(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=c.useMemo(()=>"useSubmitButtonRef-".concat(Me()),[]),t=c.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),r=c.useMemo(()=>({id:e,onSubmit:n?void 0:nc}),[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 uo(n,e){var{getItem:t,selectedKeys:r,items:i}=n;return c.useMemo(()=>{var{selection:a,isInverted:o}=no(r,i.length);return{selection:to(a,t,e),isInverted:o}},[r,i.length,t,e])}function rc(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pl,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 Qr(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 ic(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Qr(a,r,i,o,s,"next",l)}function s(l){Qr(a,r,i,o,s,"throw",l)}o(void 0)})}}function ac(n,e,t){var r=c.useRef(null),[i,a]=c.useState(null),o=c.useCallback(ic(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 ei(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 oc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ei(a,r,i,o,s,"next",l)}function s(l){ei(a,r,i,o,s,"throw",l)}o(void 0)})}}function Ct(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(oc(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 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 ni(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){sc(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 sc(n,e,t){return e=lc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lc(n){var e=uc(n,"string");return typeof e=="symbol"?e:String(e)}function uc(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 dc(n,e,t,r){var i=arguments.length===4;return c.useCallback(a=>{var o=i?a??r:a;t(ni(ni({},n),{},{[e]:o}))},[t,n,e,i,r])}function co(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 sn(n,e){var[t,r]=c.useState(n);return c.useEffect(()=>{var i=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(i)}},[n,e]),t}function ho(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 cc(n){var e=ho(Bd,n);return lo(e,ro)}function fo(){var{getKey:n=mo}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=c.useState([]),[r,i]=c.useState(()=>new Set),a=c.useCallback(v=>g=>n(g)===v,[n]),o=c.useCallback(v=>{var g;return(g=e.find(a(v)))!==null&&g!==void 0?g:null},[e,a]),s=c.useCallback(v=>{var g=o(v);if(g==null)throw new Error("No item found matching key: ".concat(v));return g},[o]),l=c.useCallback(v=>{t(g=>[...g,...v])},[]),u=c.useCallback((v,g)=>{t(b=>[...b.slice(0,v),...g,...b.slice(v)])},[]),d=c.useCallback(v=>{var g=new Set(v);t(b=>b.filter(w=>!g.has(n(w))))},[n]),f=c.useCallback((v,g)=>{var b=e.findIndex(a(v));b!==-1&&t(w=>[...w.slice(0,b),g,...w.slice(b+1)])},[e,a]),m=c.useCallback(v=>{if(v.size!==0){var g=[],b=new Map;for(var w of v.keys()){var _=e.findIndex(a(w));g.push(_),b.set(_,w)}g.sort((C,S)=>C-S);var y=[];e.forEach((C,S)=>{if(g[0]===S){var D=b.get(g.shift()),T=v.get(D);y.push(T)}else y.push(C)}),t(y)}},[e,a]),p=c.useMemo(()=>({items:e,selectedKeys:r,append:l,bulkUpdate:m,findItem:o,getItem:s,insert:u,remove:d,setItems:t,setSelectedKeys:i,update:f}),[l,m,o,s,u,e,d,t,r,f]);return p}function mo(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 hc(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 fc=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:Xd,defaultGetKey:mo,extractSpectrumHTMLElement:ro,extractSpectrumLastChildHTMLElement:Yd,findSpectrumComboBoxScrollArea:qd,getSelectedItemCountOrAll:Kd,identityExtractHTMLElement:io,isSelectionEqual:Qa,isSelectionMaybeInvertedEqual:eo,mapSelection:to,optimizeSelection:no,useAsyncInterval:Jd,useCallbackWithAction:Qd,useContextOrThrow:vt,useCopyToClipboard:ql,useDebouncedCallback:Xt,useDebouncedValue:sn,useDependentState:ec,useEffectNTimesWhen:tc,useFormWithDetachedSubmitButton:so,useForwardedRef:Zl,useIsEqualMemo:oo,useIsMountedRef:ao,useMappedRef:lo,useMappedSelection:uo,useOnScrollOffsetChangeCallback:co,useOnScrollRef:rc,usePopoverOnScrollRef:ac,usePrevious:Da,usePromiseFactory:Ct,usePropChangeCallback:dc,useResizeObserver:hc,useSetAttributesCallback:ho,useSpectrumDisableSpellcheckRef:cc,useWindowedListData:fo},Symbol.toStringTag,{value:"Module"})),mc="_spectrumActionBar_tmmkp_5",pc="_spectrumDialogComponentHeading_tmmkp_9",vc="_spectrumEllipsis_tmmkp_14",hr={spectrumActionBar:mc,spectrumDialogComponentHeading:pc,spectrumEllipsis:vc};function ri(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?ri(Object(t),!0).forEach(function(r){gc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ri(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gc(n,e,t){return e=bc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bc(n){var e=yc(n,"string");return typeof e=="symbol"?e:String(e)}function yc(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 po(n){var{heading:e,confirmationButtonLabel:t,children:r,onCancel:i,onConfirm:a}=n,{formProps:o,submitButtonProps:s}=so();return h.jsxs(Js,{children:[h.jsx(ba,{level:3,UNSAFE_className:hr.spectrumDialogComponentHeading,children:e}),h.jsx(Qs,{}),h.jsx(ya,{children:h.jsx(el,Ft(Ft({},o),{},{children:r}))}),h.jsxs(tl,{children:[h.jsx(Vr,{variant:"secondary",onPress:i,children:"Cancel"}),h.jsx(Vr,Ft(Ft({},s),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function _c(n){var{ariaLabel:e,heading:t,confirmationButtonLabel:r,isHidden:i,children:a,onConfirm:o}=n,s=c.useCallback(l=>h.jsx(po,{heading:t,confirmationButtonLabel:r,onCancel:l,onConfirm:()=>{l(),o()},children:a}),[a,r,t,o]);return h.jsx(Ja,{ariaLabel:e,icon:Ca,isHidden:i,isQuiet:!0,height:Xa,children:s})}var wc=["icon","label"];function ii(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 ai(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ii(Object(t),!0).forEach(function(r){Sc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ii(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Sc(n,e,t){return e=Ec(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ec(n){var e=Cc(n,"string");return typeof e=="symbol"?e:String(e)}function Cc(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 Pc(n,e){if(n==null)return{};var t=Tc(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 Tc(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 vo(n){var{icon:e,label:t}=n,r=Pc(n,wc);return h.jsx(va,ai(ai({},r),{},{"aria-label":t,isQuiet:!0,height:Xa,children:h.jsx(Qn,{children:h.jsx(we,{icon:e})})}))}vo.displayName="IconActionButton";function oi(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 Oc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oi(Object(t),!0).forEach(function(r){xe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xe(n,e,t){return e=Ic(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ic(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)}var xc=100,xn;(function(n){n.UP="UP",n.DOWN="DOWN"})(xn||(xn={}));class _e extends c.Component{constructor(e){super(e),xe(this,"popper",void 0),xe(this,"cbContainer",void 0),xe(this,"menuContainer",void 0),xe(this,"input",void 0),xe(this,"getCachedFilteredOptions",at((r,i)=>r.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=Oc({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=qe(this.updateInputValue,xc),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=K.createRef(),this.cbContainer=K.createRef(),this.menuContainer=K.createRef(),this.input=K.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(_e.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(_e.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(_e.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(_e.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===_e.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===_e.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:Y("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:Y("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:Y("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(rn,{ref:this.popper,options:d,className:Y("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}xe(_e,"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});xe(_e,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});xe(_e,"MENU_NAVIGATION_DIRECTION",xn);const Ac=_e;function fr(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),[m,p]=c.useState(!1),v=c.useRef(null);c.useEffect(function(){f(t)},[t]);function g(T){return T.trim().split(s).filter(A=>A).join(`
1
+ import{C as h,$ as Zs,H as va,I as Qn,F as we,J as ga,r as c,K as qe,L as Me,M as Js,N as ba,O as Qs,P as ya,Q as el,S as tl,T as Vr,U as at,G as K,E as Y,V as E,W as nl,D as zt,X as rl,Y as il,Z as _a,_ as al,a0 as ol,a1 as mt,a2 as wa,a3 as Ve,a4 as On,a5 as x,R as Sa,a6 as zr,a7 as sl,a8 as ll,a9 as ul,aa as er,ab as dl,ac as cl,ad as hl,ae as fl,af as ml,ag as Ea}from"./vendor-50d678a0.js";import{L as W,i as pl,v as Ca,M as tr,b as nr,c as Pa,d as vl,e as gl,a as Ce,r as rr,f as ze,g as bl,h as yl,j as _l,T as Gt,k as wl,C as Sl,D as El,l as Cl,m as Pl,n as Ta,N as Tl,S as Ol,o as Il,p as Dl,W as xl,q as Al,s as Ml,t as Nl,u as Ll,w as jl,x as Oa,y as Ia,z as Fl,A as Rl,B as kl,E as $l,F as Bl,G as Ul,H as Wl,I as ir,J as Hl,K as Vl,O as Gr,P as zl,Q as Gl,R as Kl,U as Xl}from"./index-ff646b46.js";import{g as Yl,c as vt,d as ql,e as Zl,h as Da,P as rn,B as Ne,T as wt,M as ar,D as xa,i as Aa,j as Jl,S as or,R as Kr,k as In,l as Dn,m as It,n as Ma,o as Ql,p as eu,q as tu,r as nu,C as ru,s as Na,t as iu,v as au,w as ou,G as su,x as lu,K as uu,y as du,z as cu,A as hu,O as fu,E as mu,F as pu,H as vu,J as gu,L as La,N as bu,Q as yu,U as _u,V as wu,W as ja,X as Su,Y as Eu,Z as Cu,_ as Pu,$ as Tu,a0 as Ou,a1 as Iu,a2 as Du,a3 as Fa,a4 as xu,a5 as Au,a6 as Mu,a7 as an,a8 as ut,a9 as Nu,aa as Lu,ab as ju,ac as Et,ad as Fu,ae as sr,af as Ru,ag as Ra,ah as ka,ai as lr,aj as ur,ak as $a,al as Ba,am as Ua,f as ku,an as Wa,ao as $u,ap as Bu,aq as dr,ar as Kt,as as Uu,at as Ha,au as Xr,av as Wu,aw as Hu,ax as Va,u as Vu,ay as zu,az as on,aA as za,aB as Ga,aC as Gu,aD as Ku,aE as Xu,I as Yr,aF as Yu,aG as qu,aH as Zu,aI as Ju,aJ as Qu,aK as ed,aL as td,aM as nd,aN as rd,aO as id,aP as ad,aQ as od,aR as sd,aS as ld,aT as ud,aU as dd,b as cd,aV as hd,aW as fd,aX as md,aY as pd,aZ as Ka,a_ as vd,a$ as gd,b0 as bd,b1 as yd,b2 as _d,b3 as wd,b4 as Sd,b5 as Ed,b6 as Cd,b7 as Pd,b8 as Td,b9 as Od,ba as Id,bb as Dd,bc as xd}from"./useUser-8de7dad8.js";import{a as _b}from"./useUser-8de7dad8.js";import{c as vn,P as cr,b as Ad,h as Md,p as Nd,o as Ld,s as jd,t as Fd}from"./plotly-71a0b13d.js";import"./helpers-042e6b4d.js";import"./monaco-9eb7d7d5.js";function pt(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 Xa=24,Rd=32,kd=33,$d=150,Ya=200,qa=500,Za=250,Bd={spellCheck:!1},Ud=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange"];function qr(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 Zr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(t),!0).forEach(function(r){Wd(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qr(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wd(n,e,t){return e=Hd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hd(n){var e=Vd(n,"string");return typeof e=="symbol"?e:String(e)}function Vd(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 zd(n,e){if(n==null)return{};var t=Gd(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 Gd(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 Ja(n){var{ariaLabel:e,icon:t,isQuiet:r,labelText:i,children:a,onOpenChange:o}=n,s=zd(n,Ud);return h.jsxs(Zs,{type:"popover",onOpenChange:o,children:[h.jsxs(va,Zr(Zr({},s),{},{"aria-label":e??i,isQuiet:r,children:[h.jsx(Qn,{children:h.jsx(we,{icon:t})}),i==null?null:h.jsx(ga,{children:i})]})),a]})}function Kd(n,e){return n===0?0:e==="all"||n===e.size?"all":e.size}function Qa(n,e){return n===e?!0:n==="all"||e==="all"||n.size!==e.size?!1:[...n.keys()].every(t=>e.has(t))}function eo(n,e){return n.isInverted===e.isInverted&&Qa(n.selection,e.selection)}function to(n,e,t){if(n==="all")return"all";var r=[...n.keys()];return new Set(r.map(i=>t(e(i))))}function no(n,e){var t=n==="all"||n.size>e/2,r=n;return t&&(r=n==="all"?new Set:new Set([...Yl(0,e-1)].filter(i=>!n.has(String(i))).map(i=>String(i)))),{selection:r,isInverted:t}}function Xd(n,e){return n?{}:{errorMessage:e,validationState:"invalid"}}function ro(n){var e;return(e=n==null?void 0:n.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function Yd(n){var e=n==null?void 0:n.UNSAFE_getDOMNode().lastElementChild;return io(e)}function qd(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 io(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 Jr(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 Zd(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Jr(a,r,i,o,s,"next",l)}function s(l){Jr(a,r,i,o,s,"throw",l)}o(void 0)})}}var gn=W.module("useAsyncInterval");function Jd(n,e){var t=ao(),r=c.useRef(0),i=c.useRef(0),a=c.useRef(null),o=c.useCallback(Zd(function*(){var s=Date.now();i.current+=1;var l=a.current==null?e:s-a.current;if(gn.debug("tick #".concat(i.current,"."),l,"ms elapsed since last tick."),a.current=s,yield n(),!!t.current){l+=Date.now()-a.current;var u=Math.max(0,l-e),d=Math.max(0,e-u);gn.debug("Next tick target:",e,", overage",u,", adjusted:",d),r.current=window.setTimeout(o,d)}}),[n,t,e]);c.useEffect(()=>(gn.debug("Setting target interval:",e),a.current=null,o(),()=>{window.clearTimeout(r.current)}),[e,o])}function Qd(n,e){return c.useCallback(function(){var t=n(...arguments);return e(),t},[e,n])}function Xt(n,e){var t=c.useMemo(()=>qe(n,e),[n,e]);return c.useEffect(()=>()=>t.cancel(),[t]),t}function ec(n){var[e,t]=c.useState(n);return c.useEffect(()=>{t(n)},[n]),[e,t]}function tc(n,e,t,r){var i=c.useRef(0);c.useEffect(()=>{i.current>=t||r&&(i.current+=1,n())},[t,r,...e])}function oo(n,e){var t=c.useRef(n),r=e(t.current,n)?t.current:n;return t.current=r,r}function nc(n){n.preventDefault()}function so(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=c.useMemo(()=>"useSubmitButtonRef-".concat(Me()),[]),t=c.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),r=c.useMemo(()=>({id:e,onSubmit:n?void 0:nc}),[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 uo(n,e){var{getItem:t,selectedKeys:r,items:i}=n;return c.useMemo(()=>{var{selection:a,isInverted:o}=no(r,i.length);return{selection:to(a,t,e),isInverted:o}},[r,i.length,t,e])}function rc(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pl,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 Qr(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 ic(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Qr(a,r,i,o,s,"next",l)}function s(l){Qr(a,r,i,o,s,"throw",l)}o(void 0)})}}function ac(n,e,t){var r=c.useRef(null),[i,a]=c.useState(null),o=c.useCallback(ic(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 ei(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 oc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ei(a,r,i,o,s,"next",l)}function s(l){ei(a,r,i,o,s,"throw",l)}o(void 0)})}}function Ct(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(oc(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 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 ni(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){sc(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 sc(n,e,t){return e=lc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lc(n){var e=uc(n,"string");return typeof e=="symbol"?e:String(e)}function uc(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 dc(n,e,t,r){var i=arguments.length===4;return c.useCallback(a=>{var o=i?a??r:a;t(ni(ni({},n),{},{[e]:o}))},[t,n,e,i,r])}function co(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 sn(n,e){var[t,r]=c.useState(n);return c.useEffect(()=>{var i=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(i)}},[n,e]),t}function ho(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 cc(n){var e=ho(Bd,n);return lo(e,ro)}function fo(){var{getKey:n=mo}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=c.useState([]),[r,i]=c.useState(()=>new Set),a=c.useCallback(v=>g=>n(g)===v,[n]),o=c.useCallback(v=>{var g;return(g=e.find(a(v)))!==null&&g!==void 0?g:null},[e,a]),s=c.useCallback(v=>{var g=o(v);if(g==null)throw new Error("No item found matching key: ".concat(v));return g},[o]),l=c.useCallback(v=>{t(g=>[...g,...v])},[]),u=c.useCallback((v,g)=>{t(b=>[...b.slice(0,v),...g,...b.slice(v)])},[]),d=c.useCallback(v=>{var g=new Set(v);t(b=>b.filter(w=>!g.has(n(w))))},[n]),f=c.useCallback((v,g)=>{var b=e.findIndex(a(v));b!==-1&&t(w=>[...w.slice(0,b),g,...w.slice(b+1)])},[e,a]),m=c.useCallback(v=>{if(v.size!==0){var g=[],b=new Map;for(var w of v.keys()){var _=e.findIndex(a(w));g.push(_),b.set(_,w)}g.sort((C,S)=>C-S);var y=[];e.forEach((C,S)=>{if(g[0]===S){var D=b.get(g.shift()),T=v.get(D);y.push(T)}else y.push(C)}),t(y)}},[e,a]),p=c.useMemo(()=>({items:e,selectedKeys:r,append:l,bulkUpdate:m,findItem:o,getItem:s,insert:u,remove:d,setItems:t,setSelectedKeys:i,update:f}),[l,m,o,s,u,e,d,t,r,f]);return p}function mo(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 hc(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 fc=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:Xd,defaultGetKey:mo,extractSpectrumHTMLElement:ro,extractSpectrumLastChildHTMLElement:Yd,findSpectrumComboBoxScrollArea:qd,getSelectedItemCountOrAll:Kd,identityExtractHTMLElement:io,isSelectionEqual:Qa,isSelectionMaybeInvertedEqual:eo,mapSelection:to,optimizeSelection:no,useAsyncInterval:Jd,useCallbackWithAction:Qd,useContextOrThrow:vt,useCopyToClipboard:ql,useDebouncedCallback:Xt,useDebouncedValue:sn,useDependentState:ec,useEffectNTimesWhen:tc,useFormWithDetachedSubmitButton:so,useForwardedRef:Zl,useIsEqualMemo:oo,useIsMountedRef:ao,useMappedRef:lo,useMappedSelection:uo,useOnScrollOffsetChangeCallback:co,useOnScrollRef:rc,usePopoverOnScrollRef:ac,usePrevious:Da,usePromiseFactory:Ct,usePropChangeCallback:dc,useResizeObserver:hc,useSetAttributesCallback:ho,useSpectrumDisableSpellcheckRef:cc,useWindowedListData:fo},Symbol.toStringTag,{value:"Module"})),mc="_spectrumActionBar_tmmkp_5",pc="_spectrumDialogComponentHeading_tmmkp_9",vc="_spectrumEllipsis_tmmkp_14",hr={spectrumActionBar:mc,spectrumDialogComponentHeading:pc,spectrumEllipsis:vc};function ri(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?ri(Object(t),!0).forEach(function(r){gc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ri(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gc(n,e,t){return e=bc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bc(n){var e=yc(n,"string");return typeof e=="symbol"?e:String(e)}function yc(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 po(n){var{heading:e,confirmationButtonLabel:t,children:r,onCancel:i,onConfirm:a}=n,{formProps:o,submitButtonProps:s}=so();return h.jsxs(Js,{children:[h.jsx(ba,{level:3,UNSAFE_className:hr.spectrumDialogComponentHeading,children:e}),h.jsx(Qs,{}),h.jsx(ya,{children:h.jsx(el,Ft(Ft({},o),{},{children:r}))}),h.jsxs(tl,{children:[h.jsx(Vr,{variant:"secondary",onPress:i,children:"Cancel"}),h.jsx(Vr,Ft(Ft({},s),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function _c(n){var{ariaLabel:e,heading:t,confirmationButtonLabel:r,isHidden:i,children:a,onConfirm:o}=n,s=c.useCallback(l=>h.jsx(po,{heading:t,confirmationButtonLabel:r,onCancel:l,onConfirm:()=>{l(),o()},children:a}),[a,r,t,o]);return h.jsx(Ja,{ariaLabel:e,icon:Ca,isHidden:i,isQuiet:!0,height:Xa,children:s})}var wc=["icon","label"];function ii(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 ai(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ii(Object(t),!0).forEach(function(r){Sc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ii(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Sc(n,e,t){return e=Ec(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ec(n){var e=Cc(n,"string");return typeof e=="symbol"?e:String(e)}function Cc(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 Pc(n,e){if(n==null)return{};var t=Tc(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 Tc(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 vo(n){var{icon:e,label:t}=n,r=Pc(n,wc);return h.jsx(va,ai(ai({},r),{},{"aria-label":t,isQuiet:!0,height:Xa,children:h.jsx(Qn,{children:h.jsx(we,{icon:e})})}))}vo.displayName="IconActionButton";function oi(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 Oc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oi(Object(t),!0).forEach(function(r){xe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xe(n,e,t){return e=Ic(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ic(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)}var xc=100,xn;(function(n){n.UP="UP",n.DOWN="DOWN"})(xn||(xn={}));class _e extends c.Component{constructor(e){super(e),xe(this,"popper",void 0),xe(this,"cbContainer",void 0),xe(this,"menuContainer",void 0),xe(this,"input",void 0),xe(this,"getCachedFilteredOptions",at((r,i)=>r.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=Oc({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=qe(this.updateInputValue,xc),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=K.createRef(),this.cbContainer=K.createRef(),this.menuContainer=K.createRef(),this.input=K.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(_e.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(_e.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(_e.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(_e.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===_e.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===_e.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:Y("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:Y("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:Y("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(rn,{ref:this.popper,options:d,className:Y("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}xe(_e,"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});xe(_e,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});xe(_e,"MENU_NAVIGATION_DIRECTION",xn);const Ac=_e;function fr(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),[m,p]=c.useState(!1),v=c.useRef(null);c.useEffect(function(){f(t)},[t]);function g(T){return T.trim().split(s).filter(A=>A).join(`
2
2
  `.concat(s.trim()))}function b(T){return T.split(`
3
3
  `).map(A=>A.trim()).join(" ")}function w(){if(v.current){v.current.style.height="0";var T=v.current.scrollHeight+(v.current.offsetHeight-v.current.clientHeight);T>0&&(v.current.style.height="".concat(T,"px"))}}function _(T){var A=T.target.value;m&&(s&&(A=g(A)),p(!1)),f(A),r(A)}function y(){v.current&&(s&&(f(g(d)),w()),v.current.scrollLeft=0)}function C(){v.current&&document.activeElement!==v.current&&v.current.focus()}function S(){s&&(f(b(d)),r(b(d)))}function D(){p(!0)}return c.useEffect(function(){w()},[d]),h.jsx("textarea",{ref:v,id:l,className:Y(e,"auto-resize-textarea form-control"),placeholder:a,value:d,rows:1,onChange:_,onFocus:y,onMouseDown:C,onBlur:S,onPaste:D,spellCheck:i,disabled:o,"data-testid":u})}fr.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};fr.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function Dt(n){var{children:e,className:t,style:r,"data-testid":i}=n;return h.jsx("div",{className:Y("btn-group",t),style:r,role:"group","data-testid":i,children:e})}Dt.displayName="ButtonGroup";Dt.propTypes={children:E.node.isRequired,className:E.string,style:E.object,"data-testid":E.string};Dt.defaultProps={className:null,style:{},"data-testid":void 0};function Mc(n){var{blockInteraction:e=!0,children:t,debounceMs:r,isOpen:i=!1}=n,a=sn(i,r);return h.jsxs(h.Fragment,{children:[e&&i&&h.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),K.cloneElement(t,{isOpen:i&&a})]})}function Nc(n){var{className:e,icon:t,isOpen:r=!1,subtitle:i,title:a}=n;return h.jsx(tr,{isOpen:r,className:e,children:h.jsx(nr,{children:h.jsxs("div",{className:"info-modal",children:[t!=null&&h.jsx("div",{className:"message-icon",children:h.jsx(we,{icon:t})}),h.jsx("div",{className:"message-header",children:a}),i!=null&&h.jsx("div",{className:"message-content",children:i})]})})})}function go(n){var{className:e="modal-footer",children:t,"data-testid":r}=n;return h.jsx("div",{className:e,"data-testid":r,children:t})}function mr(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:m,"data-testid":p}=n,v=c.useRef(null),g=c.useRef(null),b=c.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),a()},[a,s]),w=c.useCallback(()=>{var y;(y=v.current)===null||y===void 0||y.focus()},[]),_="";return e&&(_=typeof r=="function"?r():r),h.jsxs(tr,{isOpen:e,className:"theme-bg-light",onOpened:w,children:[h.jsx(Pa,{closeButton:!1,children:t}),h.jsx(nr,{children:_}),h.jsxs(go,{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(Ne,{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(Ne,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),h.jsxs(Dt,{children:[h.jsx(Ne,{kind:f?"danger":"primary",onClick:b,ref:v,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:u}),m]})]})]})}mr.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};mr.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var ln=K.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:Y("btn",r),onClick:a,style:o,disabled:i,id:s,children:t})});ln.displayName="Button";ln.propTypes={children:E.node,className:E.string,disabled:E.bool,onClick:E.func,style:E.shape({}),id:E.string};ln.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Lc=ln;function si(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 li(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?si(Object(t),!0).forEach(function(r){jc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):si(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jc(n,e,t){return e=Fc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fc(n){var e=Rc(n,"string");return typeof e=="symbol"?e:String(e)}function Rc(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 kc(n){var{styleProps:e,selectedItemCount:t,onClearSelection:r}=n;return h.jsx(nl,li(li({UNSAFE_className:hr.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:r}))}function $c(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:Y(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 bo(n,e,t){return e=Bc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bc(n){var e=Uc(n,"string");return typeof e=="symbol"?e:String(e)}function Uc(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 Ee extends c.Component{static handleEnter(e){var t=e;t.style.height="0"}static handleEntering(e){var t=e;t.style.height="".concat(Ee.getHeight(t),"px")}static handleExiting(e){var t=e;t.style.height="0"}static handleExit(e){var t=e;t.style.height="".concat(Ee.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(zt,{in:r,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ee.handleEnter,onEntering:Ee.handleEntering,onEntered:this.handleEntered,onExit:Ee.handleExit,onExiting:Ee.handleExiting,timeout:350,children:a=>h.jsx("div",{className:Y({collapse:a==="exited"},t),"data-testid":i,children:e})})}}bo(Ee,"propTypes",{className:E.string,in:E.bool.isRequired,children:E.node.isRequired,autoFocusOnShow:E.bool,"data-testid":E.string});bo(Ee,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const Wc=Ee;var Hc=W.module("TimeInput"),Vc="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",zc=["00:00:00","12:34:56","23:59:59"],yo=K.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(wt.formatTime(a)),[m,p]=c.useState(),v=c.useRef(null);c.useImperativeHandle(e,()=>({focus:()=>{var y;(y=v.current)===null||y===void 0||y.focus()},setSelection:y=>{var C;(C=v.current)===null||C===void 0||C.focus(),p(y)}}),[]),c.useEffect(function(){f(wt.formatTime(a))},[a]);function g(y,C,S){var D=y.selectionStart===0?24:60,T=parseInt(S,10)-C;return Number.isNaN(T)?T=0:t?T=(T%D+D)%D:T=Math.min(Math.max(0,T),D-1),"".concat(T).padStart(2,"0")}function b(y,C,S,D,T){return D===0&&T===2&&C===1&&parseInt(S,10)>1?"0".concat(S).concat(y.substring(2)):xa(y,C,S)}function w(y){Hc.debug("handleChange",y),f(y),wt.isTimeString(y)&&i(wt.parseTime(y))}var _=c.useCallback(y=>{p(y),l(y)},[l]);return h.jsx(ar,{ref:v,className:r,example:zc,getNextSegmentValue:g,getPreferredReplacementString:b,onChange:w,onSelect:_,pattern:Vc,selection:m,value:d,onFocus:o,onBlur:s,"data-testid":u})});yo.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Yt=yo;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 Gc(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){Ke(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 Ke(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)}var di=-1,An;(function(n){n.UP="UP",n.DOWN="DOWN"})(An||(An={}));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=K.createRef(),this.menuContainer=K.createRef(),this.button=K.createRef(),this.input=K.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 wt.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===di){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],m="option-".concat(d,"-").concat(f.value);l=l||f.value===t,u.push(h.jsxs("button",{type:"button",value:d,className:Y("cs-option-btn",{"keyboard-active":a===d&&!s}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[f.value===t&&h.jsx(we,{icon:r,className:"mr-2"}),f.value!==t&&h.jsx("span",{className:"mr-4"}),f.title]},m))}return u.push(h.jsx("hr",{className:"cs-divider"},"option-divider")),u.push(h.jsxs("button",{type:"button",value:di,className:Y("cs-option-btn",{"keyboard-active":s}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?h.jsx(we,{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(Yt,{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=Gc({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:Y("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:h.jsxs("button",{type:"button",className:Y("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[h.jsx("span",{className:Y({"text-muted":r===null}),children:this.getSelectedText()}),h.jsx("span",{className:"cs-caret"}),h.jsx(Aa,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}Ke(fe,"MENU_NAVIGATION_DIRECTION",An);Ke(fe,"DROP_DOWN_MENU_HEIGHT",125);Ke(fe,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:vl,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 Yc=fe;var qc=W.module("DateInput"),Zc="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Jc=["2000-01-01","2022-12-31"],Qc="YYYY-MM-DD",_o=K.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(),m=c.useCallback(p=>{qc.debug("handleChange",p),u(p),r(p)},[r]);return h.jsx("div",{className:"d-flex flex-row align-items-center",children:h.jsx(ar,{ref:e,className:Y(t),example:Jc,getNextSegmentValue:Jl,onChange:m,onSelect:f,pattern:Zc,placeholder:Qc,selection:d,value:l,onFocus:a,onBlur:o,"data-testid":s})})});_o.displayName="DateInput";const eh=_o;function wo(n,e,t){return e=th(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function th(n){var e=nh(n,"string");return typeof e=="symbol"?e:String(e)}function nh(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 So extends c.PureComponent{constructor(e){super(e),wo(this,"searchInput",void 0),this.searchInput=K.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=qe(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(or,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":a})}}wo(So,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const rh=So;function ih(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(""),m=c.useCallback(y=>{u(y)},[]),p=c.useCallback(()=>{i(Kr.getItemsInRanges(t,l)),u([])},[t,l,i]),v=c.useCallback(()=>{if(d!==""){var y=a(d);y==null?(r(d),f("")):s(y)}},[d,r,a]),g=c.useCallback(y=>{var{value:C}=y.target;f(C),s(C===""?null:a(C))},[a]),b=c.useCallback(()=>{u([])},[]),w=c.useCallback(y=>{y.key==="Enter"&&v()},[v]),_=c.useMemo(()=>14+rl(t.length,1,6)*In.DEFAULT_ROW_HEIGHT,[t.length]);return h.jsxs("div",{className:Y("editable-item-list-container",{"is-invalid":e}),children:[h.jsx("div",{style:{height:_},children:h.jsx(In,{itemCount:t.length,items:t.map((y,C)=>({value:y,isSelected:Kr.isSelected(l,C)})),offset:0,selectedRanges:l,onSelectionChange:m,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:Y("form-control",{"is-invalid":o!=null}),placeholder:"Enter value",type:"text",value:d,onChange:g,onFocus:b,onKeyDown:w})}),h.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[h.jsx(Ne,{kind:"ghost",onClick:v,disabled:o!=null||d==="",icon:gl,tooltip:"Add new item","data-testid":"add-item-button"}),h.jsx(Ne,{kind:"ghost",onClick:p,disabled:l.length===0,icon:Ca,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}var ah=W.module("ErrorBoundary");class oh 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;ah.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(Ce,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function sh(n,e,t){return e=lh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lh(n){var e=uh(n,"string");return typeof e=="symbol"?e:String(e)}function uh(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 dt 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=dt.isParentSelected(e,a),u=l==null||!l;o.forEach((m,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=dt.isParentSelected(e,r);f!=null&&f?d.forEach((m,p)=>d.set(p,!1)):d.forEach((m,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(Dn,{className:"hcm-parent",checked:dt.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(Dn,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(i,s),children:s},s)})]},i)}),h.jsx(Ne,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?"".concat(t,"-btn-select-all"):void 0,children:"Select All"}),h.jsx(Ne,{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:Y("btn hcm-btn",t),onClick:this.toggleMenu,id:i,"data-testid":a,children:[h.jsxs("span",{children:[r&&h.jsx(we,{icon:r,className:"hcm-icon mr-1"}),e]}),h.jsx("span",{className:"cs-caret"}),h.jsx(rn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}sh(dt,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const dh=dt;const ch=`:root{--dh-color-gray-900: #000;--dh-color-gray-800: #222;--dh-color-gray-700: #464646;--dh-color-gray-600: #6d6d6d;--dh-color-gray-500: #909090;--dh-color-gray-400: #b1b1b1;--dh-color-gray-300: #d5d5d5;--dh-color-gray-200: #e6e6e6;--dh-color-gray-100: #f8f8f8;--dh-color-gray-75: #fdfdfd;--dh-color-gray-50: #fff;--dh-color-blue-100: #112451;--dh-color-blue-200: #16306c;--dh-color-blue-300: #1d3d88;--dh-color-blue-400: #254ba4;--dh-color-blue-500: #2f5bc0;--dh-color-blue-600: #3b6bda;--dh-color-blue-700: #4c7dee;--dh-color-blue-800: #6390fa;--dh-color-blue-900: #7ca4ff;--dh-color-blue-1000: #97b7ff;--dh-color-blue-1100: #afc9ff;--dh-color-blue-1200: #c7d9ff;--dh-color-blue-1300: #dbe6ff;--dh-color-blue-1400: #ecf1ff;--dh-color-seafoam-100: #1f2925;--dh-color-seafoam-200: #263630;--dh-color-seafoam-300: #2f463e;--dh-color-seafoam-400: #37574b;--dh-color-seafoam-500: #3e6959;--dh-color-seafoam-600: #447b68;--dh-color-seafoam-700: #488f78;--dh-color-seafoam-800: #4ca387;--dh-color-seafoam-900: #4fb797;--dh-color-seafoam-1000: #54cba6;--dh-color-seafoam-1100: #5edeb7;--dh-color-seafoam-1200: #78edc7;--dh-color-seafoam-1300: #9ef8d7;--dh-color-seafoam-1400: #cbfce8;--dh-color-black: var(--dh-color-gray-50);--dh-color-white: var(--dh-color-gray-75);--dh-color-bg: var(--dh-color-white);--dh-color-fg: var(--dh-color-black);--dh-color-grid-bg: var(--dh-color-bg)}/*# sourceMappingURL=theme-light-palette.css.map */
4
4
  `;var hh=ch;function fh(){var{selectedThemeKey:n,setSelectedThemeKey:e,themes:t}=It(),r=c.useCallback(i=>{e(i)},[e]);return h.jsx(il,{label:"Pick a color scheme",items:t,selectedKey:n,onSelectionChange:r,children:i=>h.jsx(_a,{children:i.name},i.themeKey)})}var mh=.025,ph=.9,vh=.1,gh=.618,ci=80,et={SIZE:8,DOT_SIZE:2},Re=18,bh=250,yh=60*1e3,_h={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 wh(){return rr(_h)}var Sh=K.memo(()=>{var{activeThemes:n}=It(),e=c.useMemo(wh,[n]),t=c.useRef(null),r=c.useRef(null),[i,a]=c.useState(!1),o=window.devicePixelRatio,s,l,u,d,f,m=null,p=[];function v(){var O;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),(O=s)===null||O===void 0||O.scale(o,o)}function g(){var{foregroundFill:O,foregroundStroke:L}=e,N=document.createElement("canvas");N.width=et.SIZE,N.height=et.SIZE;var j=N.getContext("2d");return j!=null&&(j.fillStyle=L,j.fillRect(0,0,et.DOT_SIZE,et.DOT_SIZE),j.fillStyle=O,j.fillRect(0,0,et.SIZE,et.SIZE)),j==null?void 0:j.createPattern(N,"repeat")}function b(O){var L=Math.random()-.5,N=mh*L;return O<vh?N=Math.abs(N):O>ph&&(N=-Math.abs(N)),O+N}function w(){for(var O=[],L=gh,N=0;N<u+Re;N+=1)L=b(L),O.push(L);return O}function _(){for(;p.length>=u+Re;)p.pop();for(;p.length<u+Re;)p.push(b(p[p.length-1]))}function y(O,L){L.beginPath(),L.moveTo(-1,d+1),L.lineTo(-1,d*O[0]);for(var N=0;N<O.length;N+=1)L.lineTo(N,d*O[N]);L.lineTo(u+Re,d*O[O.length-1]),L.lineTo(u+Re,d+1),L.closePath()}function C(O){O.beginPath();for(var L=1;L<u;L+=ci)O.moveTo(L,0),O.lineTo(L,d);for(var N=1;N<d;N+=ci)O.moveTo(0,N),O.lineTo(u,N)}function S(O){var L,N,j;m=(L=m)!==null&&L!==void 0?L:O;var{background:G,foregroundStroke:q,gridColor:Z}=e;ze(s),s.fillStyle=G,s.fillRect(0,0,u,d),C(s),s.lineWidth=1,s.strokeStyle=Z,s.stroke();var te=(((N=m)!==null&&N!==void 0?N:0)-(O??0))/(1e3/Re);if(s.translate(te,0),y(p,s),s.lineWidth=2,s.strokeStyle=q,s.stroke(),s.translate(-te,0),l!=null&&(s.fillStyle=l),s.fill(),s.setTransform(o,0,0,o,0,0),(O??0)-((j=m)!==null&&j!==void 0?j:0)>1e3/Re){for(var F,U=Math.floor(((O??0)-((F=m)!==null&&F!==void 0?F:0))/(1e3/Re)),I=0;I<U;I+=1)p.shift(),p.push(b(p[p.length-1]));m=O}f!=null&&cancelAnimationFrame(f),f=requestAnimationFrame(S)}var D=qe(()=>{f=requestAnimationFrame(O=>{v(),_(),a(!1),S(O)})},bh,{leading:!0});function T(){a(!0),f!=null&&cancelAnimationFrame(f),f=null,m=null}var A=qe(()=>{T()},yh);function R(){f==null&&(a(!1),v(),_(),f=requestAnimationFrame(S)),A()}function k(){document.hasFocus()&&R()}function B(){f!=null&&cancelAnimationFrame(f),A(),D()}return c.useEffect(()=>{var O;return s=(O=t.current)===null||O===void 0?void 0:O.getContext("2d",{alpha:!1}),v(),p=w(),l=g(),S(),A(),window.addEventListener("resize",B),window.addEventListener("focus",R),window.addEventListener("blur",T),window.addEventListener("mousemove",k),window.addEventListener("keydown",k),()=>{f!=null&&cancelAnimationFrame(f),window.removeEventListener("resize",B),window.removeEventListener("focus",R),window.removeEventListener("blur",T),window.removeEventListener("mousemove",k),window.removeEventListener("keydown",k),A.cancel(),D.cancel()}},[e]),h.jsx("div",{className:"random-area-plot-animation-container",ref:r,children:h.jsx("canvas",{ref:t,className:i?"shade":""})})});const Eo=Sh;function Co(n){var{text:e,placement:t="top-start"}=n,r=c.useMemo(()=>({placement:t}),[t]);return h.jsxs(h.Fragment,{children:[h.jsx(ga,{UNSAFE_className:hr.spectrumEllipsis,children:e??h.jsx(h.Fragment,{children:" "})}),e==null||e===""?null:h.jsx(Ma,{options:r,children:e})]})}var Eh=["scrollRef","getItemDisplayText","getKey"];function hi(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 fi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hi(Object(t),!0).forEach(function(r){Ch(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):hi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ch(n,e,t){return e=Ph(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ph(n){var e=Th(n,"string");return typeof e=="symbol"?e:String(e)}function Th(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 Oh(n,e){if(n==null)return{};var t=Ih(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 Ih(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 Dh(n){var{scrollRef:e,getItemDisplayText:t,getKey:r}=n,i=Oh(n,Eh),a=c.useCallback(o=>{var s=r(o),l=t(o);return h.jsx(_a,{textValue:l??String(s),children:h.jsx(Co,{text:l})},s)},[t,r]);return h.jsx(al,fi(fi({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var pr=K.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:m,"data-testid":p}=n;return h.jsxs("button",{ref:e,type:"button",className:Y("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:m,disabled:i,"data-testid":p,children:[t,h.jsx(we,{icon:bl,className:"linked btn-socketed-icon",transform:"down-1"}),h.jsx(we,{icon:yl,className:"is-invalid btn-socketed-icon"})]})});pr.displayName="SocketedButton";pr.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 xh=pr;var Ah=500;function Mh(n){var{heading:e,content:t,delayMs:r=Ah}=n,[i,a]=c.useState(!1);return c.useEffect(()=>{window.setTimeout(()=>{a(!0)},r)},[r]),i?h.jsxs(ol,{children:[h.jsx(Qn,{size:"XXL",children:h.jsx(we,{icon:_l})}),h.jsx(ba,{children:e}),t==null?null:h.jsx(ya,{children:t})]}):null}const Nh="_track_1ymiy_30",Lh="_handle_1ymiy_13",jh="_ticks_1ymiy_98",Po={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_1ymiy_3","time-slider-popovers":"_time-slider-popovers_1ymiy_8","handle-popper":"_handle-popper_1ymiy_13","flex-spacer":"_flex-spacer_1ymiy_26",track:Nh,"track-fills":"_track-fills_1ymiy_37","track-fill":"_track-fill_1ymiy_37","track-fill-start":"_track-fill-start_1ymiy_55","track-fill-middle":"_track-fill-middle_1ymiy_56","track-fill-end":"_track-fill-end_1ymiy_59","handle-track":"_handle-track_1ymiy_62",handle:Lh,ticks:jh,"tick-labels":"_tick-labels_1ymiy_116","tick-label":"_tick-label_1ymiy_116","tick-label-wrapper":"_tick-label-wrapper_1ymiy_132"};var Rt=parseInt(Po["handle-size"],10),mi=parseInt(Po["popover-width"],10),me=24*60*60-1,pi=5*60;function Fh(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 m=c.useCallback((g,b)=>{var w=g,_=b;w===_&&(_<me?_+=1:w-=1),l(w),d(_),r({startTime:w,endTime:_})},[l,d,r]),p=c.useCallback(g=>{m(g,u)},[m,u]),v=c.useCallback(g=>{m(s,g)},[m,s]);return h.jsxs("div",{className:"time-slider","data-testid":o,children:[h.jsx(Rh,{startTime:s,endTime:u,onStartTimeChange:p,onEndTimeChange:v,isStartModified:i,isEndModified:a}),h.jsxs("div",{className:"track",ref:f,children:[h.jsx(kh,{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(vi,{track:f,time:s,setTime:p}),h.jsx(vi,{track:f,time:u,setTime:v})]}),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 Rh(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,m]=c.useState(l?e:t),p=c.useRef(null),v=c.useRef(null),g=c.useRef(null),b=c.useRef(null);c.useEffect(function(){d(e>t?t:e),m(e>t?e:t)},[e,t]),c.useEffect(function(){if(g.current!==null){var D;(D=v.current)===null||D===void 0||D.setSelection(g.current)}if(b.current!==null){var T;(T=p.current)===null||T===void 0||T.setSelection(b.current)}},[l]);function w(S){e<=t?r(S):i(S)}function _(S){e<=t?i(S):r(S)}var y=c.useCallback(S=>{g.current=S,b.current=null},[]),C=c.useCallback(S=>{g.current=null,b.current=S},[]);return h.jsxs("div",{className:"time-slider-popovers",children:[h.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(u/me*100,"% - ").concat(mi/2,"px)")}}),h.jsxs("div",{className:"handle-popper",children:[h.jsx("label",{className:Y({modified:l?o:a}),children:l?"End Time":"Start Time"}),h.jsx(Yt,{ref:p,allowValueWrapping:!1,value:u,onChange:w,onSelect:y,"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:Y({modified:l?a:o}),children:l?"Start Time":"End Time"}),h.jsx(Yt,{ref:v,allowValueWrapping:!1,value:f,onChange:_,onSelect:C,"data-testid":s!==void 0?"".concat(s,"-input-2"):void 0})]}),h.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat((me-f)/me*100,"% - ").concat(mi/2,"px)")}})]})}function kh(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/me,")")}}),h.jsx("div",{className:"track-fill track-fill-end",style:{transform:"scaleX(".concat((me-e)/me,")")}})]}),e<t&&h.jsx("div",{className:"track-fill track-fill-middle",style:{transform:"translateX(".concat(e/me*100,"%) scaleX(").concat((t-e)/me,")")}})]})}function vi(n){var{track:e,time:t,setTime:r,"data-testid":i}=n,a=c.useMemo(()=>{var m=3600,p=Rt/2;return t<m?p=t/m*(Rt/2):t>23*m&&(p=Rt/2+1/(me-23*m)*(t-23*m)*(Rt/2)),"translateX(calc(".concat(t/me*100,"% - ").concat(p,"px))")},[t]),o=c.useCallback(m=>{if(!e.current)return 0;var p=e.current.getBoundingClientRect(),v=Math.max(m-p.left,0),g=me*Math.min(1,v/p.width),b=pi*Math.round(g/pi),w=Math.min(me,b);return w},[e]),s=c.useCallback(m=>{var{clientX:p}=m;r(o(p))},[r,o]),l=c.useCallback(m=>{var{clientX:p}=m;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 To(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(zt,{in:t,timeout:Gt.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:h.jsxs("div",{className:Y("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(zt,{in:u,timeout:Gt.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx("div",{className:"buttons-container",children:e})}),s&&h.jsx(Ne,{kind:"ghost",icon:wl,tooltip:"Close notification",className:"my-2",onClick:s})]})})}To.TYPE=Object.freeze({ERROR:"error"});function $h(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??Me());return h.jsxs(h.Fragment,{children:[h.jsx("label",{className:Y("validate-label",t,{modified:a}),htmlFor:d,"data-testid":l,children:r}),K.Children.toArray(e).map(f=>K.isValidElement(f)?K.cloneElement(f,{className:Y(f.props.className,{"is-invalid":o})}):h.jsx("div",{className:Y(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 Bh=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:Ja,AutoCompleteInput:Ac,AutoResizeTextarea:fr,BasicModal:mr,BulkActionBar:kc,Button:Ne,ButtonGroup:Dt,ButtonOld:Lc,CSS_VAR_EXPRESSION_PREFIX:Sl,CardFlip:$c,Checkbox:Dn,Collapse:Wc,ComboBox:Ql,ConfirmActionButton:_c,ConfirmationDialog:po,ContextActionUtils:eu,ContextActions:tu,ContextMenuItem:nu,ContextMenuRoot:ru,CopyButton:Na,CustomTimeSelect:Yc,DEFAULT_DARK_THEME_KEY:El,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:xa,DEFAULT_LIGHT_THEME_KEY:Cl,DEFAULT_PRELOAD_DATA_VARIABLES:Pl,DateInput:eh,DateTimeInput:iu,DebouncedModal:Mc,DebouncedSearchInput:rh,DragUtils:au,DraggableItemList:ou,DropdownMenu:Aa,EditableItemList:ih,ErrorBoundary:oh,GLOBAL_SHORTCUTS:su,HierarchicalCheckboxMenu:dh,IconActionButton:vo,InfoModal:Nc,ItemList:In,ItemListItem:lu,get KEY(){return uu},LoadingOverlay:Ce,LoadingSpinner:Ta,get MODIFIER(){return du},MaskedInput:ar,Menu:cu,MenuItem:hu,Modal:tr,ModalBody:nr,ModalFooter:go,ModalHeader:Pa,NON_WHITESPACE_REGEX:Tl,Option:fu,Page:mu,Popper:rn,RadioGroup:pu,RadioItem:vu,RandomAreaPlotAnimation:Eo,SVG_ICON_MANUAL_COLOR_MAP:Ol,SearchInput:or,SearchableCombobox:Dh,Select:gu,SelectValueList:La,Shortcut:bu,ShortcutRegistry:yu,SocketedButton:xh,Stack:_u,THEME_CACHE_LOCAL_STORAGE_KEY:Il,TMP_CSS_PROP_PREFIX:Dl,TableViewEmptyState:Mh,TextWithTooltip:Co,ThemeContext:wu,ThemeExport:Gt,ThemePicker:fh,ThemeProvider:ja,TimeInput:Yt,TimeSlider:Fh,ToastNotification:To,Tooltip:Ma,UISwitch:Su,ValidateLabelInput:$h,WHITESPACE_REGEX:xl,calculatePreloadStyleContent:Al,createCssVariableResolver:Ml,extractDistinctCssVariableExpressions:Nl,fillToLength:Eu,getActiveThemes:Ll,getDefaultBaseThemes:jl,getExpressionRanges:Oa,getThemeKey:Ia,getThemePreloadData:Fl,overrideSVGFillColors:Rl,preloadTheme:kl,replaceSVGFillColor:$l,resolveCssVariablesInRecord:rr,resolveCssVariablesInString:Bl,setThemePreloadData:Ul,themeDHDefault:Cu,themeDark:Wl,themeLight:hh,trimTrailingMask:Pu,useTheme:It},Symbol.toStringTag,{value:"Module"}));function Pe(){return vt(ir,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Uh(n,e){var t=Pe(),r=c.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return c.useEffect(()=>()=>{r.disconnect()},[r]),r}var vr=c.createContext(null);function Oo(n){var{serverUrl:e,options:t,children:r}=n,i=Uh(e,t);return h.jsx(vr.Provider,{value:i,children:r})}function Ze(){return vt(vr,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}const Wh=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Hl,ApiContext:ir,ClientBootstrap:Oo,ClientContext:vr,useApi:Pe,useClient:Ze},Symbol.toStringTag,{value:"Module"}));function Hh(n){return function(t){var{children:r}=t;return h.jsx(ir.Provider,{value:n,children:r})}}function gi(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 Vh(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){gi(a,r,i,o,s,"next",l)}function s(l){gi(a,r,i,o,s,"throw",l)}o(void 0)})}}var bn=W.module("MessageUtils"),Io="io.deephaven.message.LoginOptions.request",Do="io.deephaven.message.SessionDetails.request",xo="io.deephaven.broadcast",gr="io.deephaven.broadcast.Login",Ao="io.deephaven.broadcast.Logout";function un(n){var e=n;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function Mo(n){return un(n)&&n.message===gr}function No(n){return un(n)&&n.message===Ao}function Lo(n){var e=n;return e!=null&&typeof e.id=="string"}function br(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Me(),t=arguments.length>2?arguments[2]:void 0;return{message:n,id:e,payload:t}}function zh(n,e){return{id:n,payload:e}}function yr(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function _r(n){return Mn.apply(this,arguments)}function Mn(){return Mn=Vh(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=yr();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=Me(),s=l=>{var{data:u}=l;if(!Lo(u)){bn.debug("Ignoring non-deephaven response",u);return}if(bn.debug("Received message",u),(u==null?void 0:u.id)!==o){bn.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 Tu("Request timed out"))},e),t.postMessage(br(n,o),"*")})}),Mn.apply(this,arguments)}function Gh(n,e,t){return e=Kh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kh(n){var e=Xh(n,"string");return typeof e=="symbol"?e:String(e)}function Xh(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 jo extends Error{constructor(){super(...arguments),Gh(this,"isNoConsolesError",!0)}}function Fo(n){return n.isNoConsolesError}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 dn(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 ot=W.module("SessionUtils");function Yh(n,e){return ot.info("Starting connection to '".concat(e,"'...")),new n.IdeConnection(e)}function Ro(n,e,t){return Nn.apply(this,arguments)}function Nn(){return Nn=dn(function*(n,e,t){ot.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new jo("No console types available");ot.info("Available types:",r);var i=r[0];ot.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:Me.generate()};return ot.info("Console session established",o),{session:a,config:o,connection:e,details:t,dh:n}}),Nn.apply(this,arguments)}function qh(n,e,t){return ot.info("createCoreClient",e),new n.CoreClient(e,t)}function Zh(n){return n!=null&&typeof n=="object"}function Jh(){return Ln.apply(this,arguments)}function Ln(){return Ln=dn(function*(){var n=yield _r(Do);if(!Zh(n))throw new Error("Unexpected session details response: ".concat(n));return n}),Ln.apply(this,arguments)}function Qh(){return jn.apply(this,arguments)}function jn(){return jn=dn(function*(){var n=new URLSearchParams(window.location.search);switch(n.get("authProvider")){case"parent":return Jh()}return{}}),jn.apply(this,arguments)}function ef(n,e,t){return Fn.apply(this,arguments)}function Fn(){return Fn=dn(function*(n,e,t){var r;try{r=yield Ro(n,e,t)}catch(i){if(!Fo(i))throw i}return r}),Fn.apply(this,arguments)}const tf=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:xo,BROADCAST_LOGIN_MESSAGE:gr,BROADCAST_LOGOUT_MESSAGE:Ao,BooleanColumnFormatter:Ou,CharColumnFormatter:Iu,DateTimeColumnFormatter:Du,DateUtils:Fa,DecimalColumnFormatter:xu,DefaultColumnFormatter:Au,FETCH_TIMEOUT:Mu,Formatter:an,FormatterUtils:ut,IntegerColumnFormatter:Nu,LOGIN_OPTIONS_REQUEST:Io,NoConsolesError:jo,SESSION_DETAILS_REQUEST:Do,StringColumnFormatter:Lu,TableColumnFormatter:ju,TableUtils:Et,createComboboxFilterArgs:Fu,createConnection:Yh,createCoreClient:qh,createFilterConditionFactory:sr,createKeyFromOffsetRow:Ru,createNotNullOrEmptyFilterCondition:Ra,createOnTableUpdatedHandler:ka,createSearchTextFilter:lr,createSelectedValuesFilter:ur,createSessionWrapper:Ro,createShowOnlyEmptyFilterCondition:$a,createValueFilter:Ba,defaultRowDeserializer:Ua,fetchVariableDefinition:ku,generateEmptyKeyedItems:Wa,getColumnFormats:$u,getDateTimeFormatterOptions:Bu,getSessionDetails:Qh,getSize:dr,getWindowParent:yr,isBroadcastLoginMessage:Mo,isBroadcastLogoutMessage:No,isClosed:Kt,isCustomColumnFormatDefined:Uu,isMessage:un,isNoConsolesError:Fo,isResponse:Lo,loadSessionWrapper:ef,makeMessage:br,makeResponse:zh,padFirstAndLastRow:Ha,requestParentResponse:_r},Symbol.toStringTag,{value:"Module"}));var yi=W.module("useTableListener"),nf=(n,e,t)=>c.useEffect(function(){if(n==null){yi.debug2("Emitter undefined, skipping addEventListener",e);return}return yi.debug2("Adding listener",e),n.addEventListener(e,t)},[n,e,t]);const ct=nf;function rf(n,e,t){return e=af(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function af(n){var e=of(n,"string");return typeof e=="symbol"?e:String(e)}function of(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 sf extends Error{constructor(){super(...arguments),rf(this,"isColumnNameError",!0)}}const lf=sf;function uf(n,e,t){return e=df(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function df(n){var e=cf(n,"string");return typeof e=="symbol"?e:String(e)}function cf(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 hf extends Error{constructor(){super(...arguments),uf(this,"isTableDisconnectError",!0)}}const ff=hf;var kt=W.module("useTable"),mf=(n,e,t,r)=>{var i=Pe(),[a,o]=c.useState(void 0),[s,l]=c.useState([]),[u,d]=c.useState(null),[f,m]=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 lf("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:w}=b;if(!a){kt.error("Columns not initialized.");return}var _=a.map(y=>w.rows.map(C=>C.get(y)));l(_)},[a]),v=c.useCallback(()=>{m(new ff("Table disconnected"))},[]),g=c.useCallback(()=>{m(null)},[]);return ct(n,i.Table.EVENT_UPDATED,p),ct(n,i.Table.EVENT_DISCONNECT,v),ct(n,i.Table.EVENT_RECONNECT,g),{columns:a,data:s,error:f??u}};const ko=mf;var pf=(n,e,t,r)=>{var i=c.useMemo(()=>[r],[r]),{columns:a=[],data:o=[],error:s}=ko(n,e,t,i);return{column:a[0],data:o[0],error:s}};const $o=pf;function _i(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 vf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){_i(a,r,i,o,s,"next",l)}function s(l){_i(a,r,i,o,s,"throw",l)}o(void 0)})}}var Te=W.module("TableInput"),yn=250;function wr(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),m=Pe(),p=c.useMemo(()=>{var F=ut.getColumnFormats(a),U=ut.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:I={},defaultIntegerFormatOptions:$={}}=a;return new an(m,F,U,I,$)},[m,a]),[v,g]=c.useState(""),[b,w]=c.useState(new Set(o)),[_,y]=c.useState(),C=c.useRef(null),S=Math.min((e=_==null?void 0:_.size)!==null&&e!==void 0?e:0,yn),{column:D,data:T,error:A}=$o(_,0,yn-1,i),R=c.useCallback(F=>D?p.getFormattedString(F,D.type,D.name):"".concat(F),[D,p]),[k,B]=c.useMemo(()=>{var F=new Set(b),U=[];if(T==null)return[U,null];if(T.forEach($=>{var V="".concat($),Fe=b.has(V);Fe&&F.delete(V),U.push({value:V,displayValue:R($),isSelected:Fe})}),F.size>0){Te.debug2("Selection has items that are missing from the viewport");var I=new Set(b);return Array.from(F).forEach($=>{I.delete($)}),[U,I]}return[U,null]},[T,b,R]);c.useEffect(()=>{B!==null&&(w(B),l(Array.from(B)))},[l,B]);var O=c.useCallback(function(){var F=vf(function*(U){try{var I=yield U;Te.debug("Table resolved",I),y(I)}catch($){if(Xr.isCanceled($))return;Te.error($)}});return function(U){return F.apply(this,arguments)}}(),[]);c.useEffect(()=>{var F=Xr.makeCancelable(d);return O(F),()=>{Te.debug2("Cancel table promise"),F.cancel()}},[d,O]);var L=c.useCallback(F=>{var{value:U}=F.target;g(U);var I=k.findIndex(V=>V.displayValue.includes(U));if(I>-1){var $;Te.debug2("Found ".concat(U," at index ").concat(I)),($=C.current)===null||$===void 0||$.scrollIntoView(I)}else Te.debug2("".concat(U," not found"))},[k,C]),N=c.useCallback(F=>{if(Te.debug("handleSelect",F),F>=k.length){Te.error("Invalid index",F);return}var U=k[F].value,I=new Set(b);k[F].isSelected?I.delete(U):I.add(U),w(I),l(Array.from(I))},[l,k,b]),j=c.useCallback(()=>{var F=k.map(I=>I.value),U=new Set(F);w(U),l(F)},[k,l]),G=c.useCallback(()=>{w(new Set),l([])},[l]),q=c.useCallback(()=>{},[]),Z=c.useCallback(F=>{var U,{relatedTarget:I}=F;Te.debug("handleChildBlur",I,I instanceof HTMLElement,f.current,(U=f.current)===null||U===void 0?void 0:U.contains(I)),(!I||f.current&&I instanceof HTMLElement&&!f.current.contains(I))&&u()},[u]),te=k.length===0;return h.jsxs("div",{ref:f,className:Y("table-input-container d-flex flex-column position-relative",r),children:[h.jsx(or,{disabled:!!A||te,value:v,placeholder:"Search",onChange:L,className:"mb-2 d-flex",onBlur:Z}),h.jsx(La,{className:"table-input-list",disabled:_===void 0||te,isInvalid:s,items:te?[{value:"Empty",isSelected:!1}]:k,itemCount:S,offset:0,onSelect:N,onViewportChange:q,ref:C,onBlur:Z}),_&&h.jsxs("div",{className:"meta-row",children:[h.jsx("div",{className:"d-flex align-items-center text-muted small",children:_!=null&&_.size>S&&h.jsxs(h.Fragment,{children:["Table is too large, showing the first ",yn," items."]})}),h.jsxs("div",{children:[h.jsx("button",{type:"button",className:"btn btn-link",onBlur:Z,onClick:j,children:"Select All"}),h.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:Z,onClick:G,children:"Clear"})]})]}),_==null||A&&h.jsx("div",{className:"h-100 w-100 position-absolute",children:h.jsx(Ce,{isLoaded:_!=null,isLoading:_==null&&A==null,errorMessage:(t=A==null?void 0:A.message)!==null&&t!==void 0?t:null})})]})}wr.displayName="TableInput";wr.defaultProps={isInvalid:!1,className:void 0};var wi=W.module("useBroadcastChannel");function Sr(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wu,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xo,t=c.useMemo(()=>new BroadcastChannel(e),[e]);return c.useEffect(()=>()=>{t.close()},[t]),c.useEffect(()=>{function r(i){var{data:a}=i;if(!un(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 cn(n,e){var t=c.useCallback(r=>{Mo(r.data)?n==null||n(r.data):No(r.data)&&(e==null||e(r.data))},[n,e]);Sr(t)}var qt="io.deephaven.web.client.auth.refreshToken",Bo=c.createContext(null),gf=W.module("RefreshTokenUtils");function Rn(){var n=mt.get(qt);try{if(n!=null)return JSON.parse(n)}catch(e){gf.error("Error parsing refresh token",n,e)}return null}function kn(n){if(n==null){mt.remove(qt);return}var e=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),t=new Date(n.expiry);mt.set(qt,e,{secure:!0,sameSite:"strict",expires:t})}function Uo(n){var{children:e}=n,t=Pe(),r=Ze(),[i,a]=c.useState(Rn());c.useEffect(function(){var u=r.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{var{detail:f}=d;kn(f),a(f)});return u},[t,r,i]);var o=c.useCallback(()=>{a(Rn())},[]),s=c.useCallback(()=>{kn(null),a(null)},[]);return cn(o,s),h.jsx(Bo.Provider,{value:i,children:e})}function je(){var n=Pe();return c.useMemo(()=>new Et(n),[n])}function bf(n,e,t,r){var i=je(),[a,o]=c.useState(""),s=sn(a,t),l=c.useCallback(m=>{o(m.trim())},[]),{data:u,isLoading:d}=Ct(i.doesColumnValueExist,[n,e,s,r]),f=d||a!==s?null:u;return{valueTrimmed:a,valueTrimmedDebounced:s,valueExists:f,trimAndUpdateValue:l}}var Si=W.module("useDebouncedViewportSearch"),yf=200;function _f(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yf,r=je(),{table:i,applyFiltersAndRefresh:a}=n,o=c.useMemo(()=>qe(s=>{if(Si.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(()=>()=>{Si.debug("Cancelling debounced search function"),o.cancel()},[o]),o}var Wo=300;function wf(n){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:r,mapItemToValue:i}=n,a=je(),o=uo(e,i),s=sn(o,Wo),l=oo(s,eo);return c.useMemo(()=>ur(a,t,l.selection,r,l.isInverted),[t,l,r,a])}function Er(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(()=>Hu(...t.map(i=>i(n))),[n,...t])}function Sf(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 Ei(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 Ef(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ei(a,r,i,o,s,"next",l)}function s(l){Ei(a,r,i,o,s,"throw",l)}o(void 0)})}}function Cf(n){var{table:e,columnName:t,defaultValue:r,itemHeight:i,topOffset:a=0,value:o}=n;return c.useCallback(Ef(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 Cr(n){var[,e]=c.useState(0),t=Pe();return ct(n,t.Table.EVENT_SIZECHANGED,()=>{e(r=>r+1)}),dr(n)}var Pf=W.module("useInitializeViewportData");function Ho(n){var e=fo({}),t=Math.max(0,Cr(n));return c.useEffect(()=>{var r=e.items.length;t!==r&&(Pf.debug("size changed:",{currentSize:r,targetSize:t}),e.setItems(Array.from(Wa(0,t-1))))},[t,n]),e}function Vo(n,e,t){return c.useCallback(function(i){var[a,o]=Ha(i,e,t,dr(n));n==null||n.setViewport(a,o)},[n,t,e])}var Ci=W.module("useViewportData");function Pr(n){var{table:e,itemHeight:t=1,scrollDebounce:r=$d,viewportSize:i=10,viewportPadding:a=50,deserializeRow:o=Ua}=n,s=Ho(e),l=Vo(e,i,a),u=c.useCallback(g=>{e&&!Kt(e)?l(g):Ci.debug("setViewport called on closed table.",e)},[e,l]),d=c.useCallback(g=>{e&&!Kt(e)?(e.applyFilter(g),u(0)):Ci.debug("applyFiltersAndRefresh called on closed table.",e)},[u,e]),f=Pe(),m=c.useMemo(()=>ka(s,o),[o,s]);ct(e,f.Table.EVENT_UPDATED,m);var p=Cr(e);c.useEffect(()=>{u(0)},[e,u,p]);var v=co(t,u,r);return c.useMemo(()=>({viewportData:s,size:p,table:e,applyFiltersAndRefresh:d,setViewport:u,onScroll:v}),[d,v,u,p,e,s])}function Tr(n,e){var{applyFiltersAndRefresh:t}=n;c.useEffect(()=>{t(e)},[t,e])}function Tf(n,e){for(var t=je(),[r,i]=c.useState(""),a=c.useMemo(()=>lr(t,e,r),[e,r,t]),o=Xt(i,Ya),s=Pr({table:n,itemHeight:kd,viewportSize:qa,viewportPadding:Za}),l=arguments.length,u=new Array(l>2?l-2:0),d=2;d<l;d++)u[d-2]=arguments[d];var f=Er(s.table,a,...u);return Tr(s,f),{list:s,onSearchTextChange:o}}function Of(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=je(),r=c.useMemo(()=>Ra(t),[t]);return c.useMemo(()=>sr(n,r,e),[n,e,r])}function zo(n){c.useEffect(()=>()=>{n!=null&&(Kt(n)||n.close())},[n])}function If(n,e,t){for(var r=je(),[i,a]=c.useState(""),[o,s]=c.useState(""),[l,u]=c.useState(null),[d,f]=c.useState(()=>new Map),{data:m,isLoading:p}=Ct(r.doesColumnValueExist,[n,e,o,!1]),v=p||o!==i?null:m,g=c.useMemo(()=>lr(r,e,o),[e,o,r]),b=c.useMemo(()=>ur(r,e,new Set(d.keys()),!1,!0),[e,d,r]),w=arguments.length,_=new Array(w>3?w-3:0),y=3;y<w;y++)_[y-3]=arguments[y];var{data:C}=Ct(r.createDistinctSortedColumnTable,[n,e,"asc",..._]);zo(C);var S=Pr({table:C,itemHeight:Rd,viewportSize:qa,viewportPadding:Za}),D=i.length>0&&S.size===0,T=d.has(i),A=Xt(s,Ya),R=c.useCallback(j=>{a(j),A(j)},[A]),k=Xt(u,0),B=c.useCallback(j=>{if(a(""),s(""),u(j),k(null),j!=null){var G=S.viewportData.findItem(j);if(G!=null){var q=t(G);f(Z=>{var te=new Map(Z);return te.set(q,{value:q}),te})}}},[k,S.viewportData,t]),O=c.useCallback(j=>{f(G=>{if(j.size===0)return G;var q=new Map(G);for(var Z of j)q.set(Z,{value:Z});return q})},[]),L=c.useCallback(j=>{f(G=>{if(j==="all")return new Map;var q=new Map(G);for(var Z of j)q.delete(Z);return q})},[]),N=Er(S.table,g,b);return Tr(S,N),c.useMemo(()=>({list:S,hasSearchTextWithZeroResults:D,searchText:i,searchTextExists:v,searchTextIsInSelectedValues:T,selectedKey:l,selectedValueMap:d,onSearchTextChange:R,onSelectKey:B,onAddValues:O,onRemoveValues:L}),[D,S,O,L,R,B,i,v,T,l,d])}function Pi(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 Df(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Pi(a,r,i,o,s,"next",l)}function s(l){Pi(a,r,i,o,s,"throw",l)}o(void 0)})}}function xf(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(Df(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}=Ct(i,[]);return c.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:o,isError:s,isLoading:l}}function Af(n,e){var t=je(),r=c.useMemo(()=>$a(t,n),[n,t]);return c.useMemo(()=>sr(e,r),[e,r])}function Mf(n,e,t){var r=je();return c.useMemo(()=>Ba(r,n,e,t),[n,t,r,e])}const Nf=Object.freeze(Object.defineProperty({__proto__:null,ConnectionContext:Va,DEBOUNCE_MS:Wo,REFRESH_TOKEN_KEY:qt,RefreshTokenBootstrap:Uo,RefreshTokenContext:Bo,TableInput:wr,makeApiContextWrapper:Hh,readRefreshToken:Rn,storeRefreshToken:kn,useBroadcastChannel:Sr,useBroadcastLoginListener:cn,useCheckIfExistsValue:bf,useConnection:Vu,useDebouncedViewportSearch:_f,useDebouncedViewportSelectionFilter:wf,useFilterConditionFactories:Er,useFilteredItemsWithDefaultValue:Sf,useGetItemPosition:Cf,useInitializeViewportData:Ho,useNotNullOrEmptyFilter:Of,usePickerWithSelectedValues:If,useSearchableViewportData:Tf,useSelectDistinctTable:xf,useSetPaddedViewportCallback:Vo,useShowOnlyEmptyFilter:Af,useTable:ko,useTableClose:zo,useTableColumn:$o,useTableListener:ct,useTableSize:Cr,useTableUtils:je,useValueFilter:Mf,useViewportData:Pr,useViewportFilter:Tr},Symbol.toStringTag,{value:"Module"}));var Go=c.createContext(!1);function Lf(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(Go.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 xt=c.createContext(null),Je=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function Ko(n){return"DashboardPlugin"in n}function Zt(n){return"AuthPlugin"in n}function Xo(n){return"TablePlugin"in n}function Yo(n){return Ko(n)||Zt(n)||Xo(n)}function jf(n){return"type"in n&&n.type===Je.DASHBOARD_PLUGIN}function hn(n){return"type"in n&&n.type===Je.WIDGET_PLUGIN}function Ff(n){return"type"in n&&n.type===Je.TABLE_PLUGIN}function qo(n){return"type"in n&&n.type===Je.AUTH_PLUGIN}function Zo(n){return"type"in n&&n.type===Je.THEME_PLUGIN}var Rf=W.module("@deephaven/plugin.PluginUtils");function kf(n,e){return n==null||!hn(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function $f(n){var e=h.jsx(we,{icon:Vl});if(!hn(n))return e;var{icon:t}=n;return t==null?e:c.isValidElement(t)?t:h.jsx(we,{icon:t})}function Jo(n){var e=[...n.entries()].filter(t=>Zo(t[1]));return Rf.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:Ia(r,s),name:s,styleContent:u}})}).flat()}function Qo(){return vt(xt,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function Bf(n){var{fetch:e,type:t}=n,r=Qo(),i=c.useMemo(()=>[...r.values()].filter(hn).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 Uf=Object.freeze(Object.defineProperty({__proto__:null,PluginType:Je,PluginsContext:xt,WidgetView:Bf,getIconForPlugin:$f,getThemeDataFromPlugins:Jo,isAuthPlugin:qo,isDashboardPlugin:jf,isLegacyAuthPlugin:Zt,isLegacyDashboardPlugin:Ko,isLegacyPlugin:Yo,isLegacyTablePlugin:Xo,isTablePlugin:Ff,isThemePlugin:Zo,isWidgetPlugin:hn,pluginSupportsType:kf,usePlugins:Qo},Symbol.toStringTag,{value:"Module"}));function Wf(n){if(n==null)return!1;var e=n;return e.Component!==void 0&&typeof e.isAvailable=="function"}var es="io.deephaven.auth.AnonymousAuthenticationHandler",Hf="io.deephaven.authentication.psk.PskAuthenticationHandler";function Ti(n,e,t){return e=Vf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vf(n){var e=zf(n,"string");return typeof e=="symbol"?e:String(e)}function zf(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 Gf extends Error{constructor(){super(...arguments),Ti(this,"name","AuthenticationError"),Ti(this,"isAuthenticationError",!0)}}const ts=Gf;function Oi(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 Kf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Oi(a,r,i,o,s,"next",l)}function s(l){Oi(a,r,i,o,s,"throw",l)}o(void 0)})}}var Ii=W.module("AuthPluginBase");function Or(n){var{children:e,getLoginOptions:t}=n,r=Ze(),[i,a]=c.useState(),[o,s]=c.useState(!1);return c.useEffect(()=>{var l=!1;function u(){if(l)throw new zu("Login canceled.")}function d(){return f.apply(this,arguments)}function f(){return f=Kf(function*(){try{var m=yield t();u(),Ii.info("Logging in..."),yield r.login(m),u(),s(!0)}catch(g){if(!l){var p;Ii.error("Unable to login:",g);var v=(p=pt(g))!==null&&p!==void 0?p:"Unable to login. Verify credentials.";a(new ts(v)),s(!1)}}}),f.apply(this,arguments)}return d(),()=>{l=!0}},[r,t]),o?h.jsx(h.Fragment,{children:e}):h.jsx(Ce,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:pt(i)})}var Xf={canLogout:!1};function Yf(n){var{children:e}=n,t=Pe(),r=c.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return h.jsx(Or,{getLoginOptions:r,children:h.jsx(on.Provider,{value:Xf,children:e})})}var qf={Component:Yf,isAvailable:n=>n.includes(es)};const ns=qf;function Di(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){Di(a,r,i,o,s,"next",l)}function s(l){Di(a,r,i,o,s,"throw",l)}o(void 0)})}}var Jf=W.module("AuthPluginParent"),Qf={canLogout:!1};function em(n){return n!=null&&typeof n.type=="string"}function tm(){return $n.apply(this,arguments)}function $n(){return $n=Zf(function*(){Jf.info("Logging in by delegating to parent window...");var n=yield _r(Io);if(!em(n))throw new Error("Unexpected login options response: ".concat(n));return n}),$n.apply(this,arguments)}function nm(){var n;return(n=new URLSearchParams(window.location.search).get("authProvider"))!==null&&n!==void 0?n:""}function rm(n){var{children:e}=n;return h.jsx(Or,{getLoginOptions:tm,children:h.jsx(on.Provider,{value:Qf,children:e})})}var im={Component:rm,isAvailable:()=>yr()!=null&&nm()==="parent"};const rs=im;function is(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:Y("btn btn-primary",{"btn-spinner":r},{"btn-cancelable":r}),"data-testid":"btn-login",children:[r&&h.jsxs("span",{children:[h.jsx(Ta,{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 as(n){var{children:e,logoPath:t="./logo.png"}=n;return h.jsxs("div",{className:"login-container",children:[h.jsx(Eo,{}),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 xi(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 _n(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){xi(a,r,i,o,s,"next",l)}function s(l){xi(a,r,i,o,s,"throw",l)}o(void 0)})}}var Bn="io.deephaven.authentication.psk.PskAuthenticationHandler",os="psk",Un="io.deephaven.web.client.auth.psk.token",st=W.module("AuthPluginPsk");function am(){return new URLSearchParams(window.location.search).get(os)}function om(){st.debug2("clearWindowToken");var n=new URL(window.location.href);n.searchParams.delete(os),window.history.replaceState(null,"",n.href)}function Ai(){var n;return(n=mt.get(Un))!==null&&n!==void 0?n:null}function wn(n){st.debug2("Storing token in cookie",n),n!=null?mt.set(Un,n,{secure:!0,sameSite:"strict"}):mt.remove(Un)}function sm(n){var{children:e,logoPath:t}=n,r=Ze(),i=c.useRef(null),a=c.useRef(null),[o,s]=c.useState(),[l,u]=c.useState(!1),[d,f]=c.useState(!1),[m,p]=c.useState(!1),[v,g]=c.useState(""),b=c.useCallback(function(){var S=_n(function*(D){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;st.info("Logging in..."),p(!0);var A=null;try{if(A=r.login({type:Bn,token:D}),a.current=A,yield A,st.info("Logged in successfully"),a.current!==A)return;wn(D),f(!0)}catch(B){if(a.current!==A)return;if(u(!0),T){var R;st.error("Unable to login",B);var k=(R=pt(B))!==null&&R!==void 0?R:"Unable to login: Verify credentials.";s(new ts(k))}}p(!1)});return function(D){return S.apply(this,arguments)}}(),[r]),w=c.useCallback(()=>{a.current=null,p(!1)},[]),_=c.useCallback(_n(function*(){st.debug("onLogin");var S=Ai();d||m||S==null||b(S,!1)}),[d,m,b]),y=c.useCallback(()=>{wn(null)},[]);cn(_,y),c.useEffect(()=>{var S=!1;function D(){return T.apply(this,arguments)}function T(){return T=_n(function*(){var A,R=(A=am())!==null&&A!==void 0?A:Ai();if(om(),R==null){u(!0);return}p(!0);try{yield r.login({type:Bn,token:R}),S||(wn(R),f(!0),p(!1))}catch{S||(u(!0),p(!1))}}),T.apply(this,arguments)}return D(),()=>{S=!0}},[r]);var C=c.useCallback(()=>{m?w():b(v)},[w,m,b,v]);return c.useEffect(function(){var D;(D=i.current)===null||D===void 0||D.focus()},[i,l]),h.jsxs(h.Fragment,{children:[d&&e,l&&h.jsx(zt,{in:!d,timeout:Gt.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(as,{logoPath:t,children:h.jsx(is,{errorMessage:pt(o),isLoggingIn:m,onSubmit:C,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:v,onChange:S=>{s(void 0),g(S.target.value)}})]})})})}),h.jsx(Ce,{"data-testid":"auth-psk-loading",isLoaded:d||l,isLoading:!d&&!l})]})}var lm={Component:sm,isAvailable:n=>n.includes(Bn)};const ss=lm;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 Sn(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){um(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 um(n,e,t){return e=dm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dm(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)}var hm=W.module("UserUtils");function ls(n,e){return n.get("internal.webClient.appInit.".concat(e))}function us(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 ls(n,b)}function l(b,w){var _=s(b);return _==="true"?!0:_==="false"?!1:(_!==void 0&&hm.warn("Unexpected value for ".concat(b,": ").concat(_)),w)}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:[],m=l("canCopy",!0),p=l("canDownloadCsv",!0),v=l("canUsePanels",!0),g=l("canLogout",!0);return Sn(Sn({name:u,operateAs:d,groups:f},a),{},{permissions:Sn({canUsePanels:v,canCopy:m,canDownloadCsv:p,canLogout:g},o)})}const fm=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:es,AUTH_HANDLER_TYPE_PSK:Hf,AuthPluginAnonymous:ns,AuthPluginBase:Or,AuthPluginParent:rs,AuthPluginPsk:ss,Login:as,LoginForm:is,UserContext:za,UserOverrideContext:Ga,UserPermissionsOverrideContext:on,getAppInitValue:ls,getUserFromConfig:us,isAuthPlugin:Wf},Symbol.toStringTag,{value:"Module"})),ds=typeof vn=="function"?vn:vn.default;cr.register([Ad,Md,Nd,Ld,jd,Fd]);function ue(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=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 ee{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(ee.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(ee.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(ee.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(ee.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(ee.EVENT_ERROR,{detail:e}))}}ue(ee,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");ue(ee,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");ue(ee,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");ue(ee,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");ue(ee,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");ue(ee,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");ue(ee,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");ue(ee,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");ue(ee,"EVENT_ERROR","ChartModel.EVENT_ERROR");const ge=ee;function Ni(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 tt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ni(Object(t),!0).forEach(function(r){oe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ni(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function oe(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=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)}var gt=W.module("ChartUtils"),Li="io.deephaven.time.DateTime",bm=36e5,ym=1e6;function _m(n){return n.asDate!==void 0}function wm(n){return n.asNumber!==void 0}function ji(n){return n.dhTimeZone!==void 0}function Sm(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class P{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*)(%?)(.*)/);ze(a);var[,o,s,l,,u,d,f,m,p]=a,v=l.replace(",","").length,g=s.indexOf(",")>=0||l.indexOf(",")>=0,b=g?",":"",w=f!=null&&f!==""?"e":"f",_=m!==""?m:w,y=u.length+d.length,C="",S="0".concat(v).concat(b,".").concat(y).concat(C).concat(_),D=P.convertNumberPrefix(o),T=P.convertNumberPrefix(p);return{tickformat:S,tickprefix:D,ticksuffix:T,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},o=i;return r&&(o=i/ym),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]:P.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 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];Sm(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(" "):gt.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=P.getAllAxes(e),s=P.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 m=d.series[f],{sources:p}=m,v=p.filter(_=>_.axis),g=function(){var y=v[b],{axis:C}=y,{type:S}=C,D=s.get(S);ze(D);var T=D.indexOf(C),A=r.getAxisPropertyName(S);if(A!=null){var R=P.getAxisLayoutProperty(A,T);if(i.has(R))gt.debug("".concat(R," already added."));else{gt.debug("Adding ".concat(R," to axisFormats."));var k=r.getPlotlyAxisFormat(y,t);if(k===null)i.set(R,a);else{i.set(R,k);var{businessCalendar:B}=C;if(B!=null){var O=[],{businessPeriods:L,businessDays:N,holidays:j,timeZone:G}=B,q=t==null?void 0:t.getColumnTypeFormatter(Li),Z;ji(q)&&(Z=q.dhTimeZone);var te=Z?(G.standardOffset-Z.standardOffset)/60:0;j.length>0&&O.push(...r.createRangeBreakValuesFromHolidays(j,G,Z)),L.forEach(F=>O.push({pattern:"hour",bounds:[P.periodToDecimal(F.close)+te,P.periodToDecimal(F.open)+te]})),N.length<r.daysOfWeek.length&&r.createBoundsFromDays(N).forEach(F=>O.push({pattern:"day of week",bounds:F})),k.rangebreaks=O}if(i.size===d.axes.length)return{v:i}}}}},b=0;b<v.length;b+=1){var w=g();if(typeof w=="object")return w.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(P.MODE_LINES),(r??!0)&&a.add(P.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(P.MODE_LINES),(r??!1)&&a.add(P.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?P.ORIENTATION.HORIZONTAL:P.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:m,shape:p,shapeSize:v}=e,g=m.some(C=>{var S;return(S=C.axis)===null||S===void 0?void 0:S.businessCalendar}),b=this.getChartType(u,g),w=this.getPlotlyChartMode(u,s??void 0,l??void 0),_=this.getPlotlySeriesOrientation(e),y=P.makeSeriesData(b,w,o,a,_);return this.addSourcesToSeriesData(y,u,m,t),this.addStylingToSeriesData(y,u,i,d,f,p,v,r),y}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);wa(a,d,[]);var f=l!=null?this.getAxisPropertyName(l.type):null;if(f!=null){var m=i.get(l.type);if(m){var p=m.indexOf(l),v=p>0?"".concat(p+1):"";a["".concat(f,"axis")]="".concat(f).concat(v)}}}}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=P.getMarkerSymbol(o)}catch(f){gt.warn("Unable to handle shape",o,":",f)}s!=null&&(d.marker.size=s*P.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=P.getAllAxes(t),u=0;u<t.charts.length;u+=1){var d=t.charts[u],f=i==null?void 0:i(d),m=this.getChartBounds(t,d,a,o);this.updateLayoutAxes(s,d.axes,l,r,a,o,m,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:m}=t,p=u+d,v=f+m,g=1/s,b=1/l,w=P.AXIS_SIZE_PX/r,_=P.AXIS_SIZE_PX/i,y={bottom:(l-v)*b+(v<l?_/2:0),top:(l-f)*b-(f>0?_/2:0),left:u*g+(u>0?w/2:0),right:p*g-(p<s?w/2:0)},C=P.groupArray(t.axes,"position"),S=(a=C.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return S.length>0&&(r>0?y.right-=(y.right-y.left)*Math.max(0,Math.min(P.LEGEND_WIDTH_PX/r,P.MAX_LEGEND_SIZE)):y.right-=(y.right-y.left)*P.DEFAULT_AXIS_SIZE),y}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&&ji(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=P.addTickSpacing(s,i,!0)):Et.isNumberType(a)&&(s=P.getPlotlyNumberFormat(t,a,o),s=P.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(P.MIN_AXIS_SIZE,Math.min(P.AXIS_SIZE_PX/o,P.MAX_AXIS_SIZE)):P.DEFAULT_AXIS_SIZE,f=o>0?Math.max(P.MIN_AXIS_SIZE,Math.min(P.AXIS_SIZE_PX/a,P.MAX_AXIS_SIZE)):P.DEFAULT_AXIS_SIZE,m=e,p=P.groupArray(t,"position"),v=P.groupArray(t,"type"),g=[...v.keys()],b=P.groupArray(r,"type"),w=0;w<g.length;w+=1){var _=g[w],y=this.getAxisPropertyName(_);if(y!=null){var C=v.get(_),S=b.get(_),D=_===u.plot.AxisType.Y,T=D?o:a;ze(C),ze(S);for(var A=0;A<C.length;A+=1){var R=C[A],k=S.indexOf(R),B=P.getAxisLayoutProperty(y,k);m[B]==null&&(m[B]=this.makeLayoutAxis(_,i));var O=m[B];if(O!=null){this.updateLayoutAxis(O,R,A,p,d,f,s);var{range:L,autorange:N}=O;if(l!=null&&L!==void 0&&(N===void 0||N===!1)){var j=l(R),[G,q]=j(L);gt.debug("Setting downsample range",T,G,q),R.range(T,G,q)}else R.range(T)}}}}}removeStaleAxes(e,t){for(var r=e,i=P.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);ze(l);var u=l.length,d=this.getAxisPropertyName(s);if(d!=null)for(var f=P.getAxisLayoutProperty(d,u);r[f]!=null;)delete r[f],u+=1,f=P.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,m=e,p=(l=t.label)!==null&&l!==void 0?l:"";if(m.title!==void 0&&typeof m.title!="string"?m.title.text=p:m.title={text:p},t.log&&(m.type="log"),m.side=this.getAxisSide(t.position),r>0){var v,g;m.overlaying=(v=this.getAxisPropertyName(t.type))!==null&&v!==void 0?v:void 0;var b=(g=i.get(t.position))!==null&&g!==void 0?g:[],w=b.indexOf(t);w>0&&(m.anchor="free",t.position===u.plot.AxisPosition.RIGHT?m.position=s.right+(w-b.length+1)*f:t.position===u.plot.AxisPosition.TOP?m.position=s.top+(w-b.length+1)*f:t.position===u.plot.AxisPosition.BOTTOM?m.position=s.bottom+(b.length-w+1)*f:t.position===u.plot.AxisPosition.LEFT&&(m.position=s.left+(b.length-w+1)*f))}else if(t.type===u.plot.AxisType.X){var _=i.get(u.plot.AxisPosition.LEFT)||[],y=i.get(u.plot.AxisPosition.RIGHT)||[],C=Math.max(s.left,s.left+(_.length-1)*o),S=Math.min(s.right-(y.length-1)*o,s.right);m.domain=[C,S]}else if(t.type===u.plot.AxisType.Y){var D=i.get(u.plot.AxisPosition.BOTTOM)||[],T=i.get(u.plot.AxisPosition.TOP)||[],A=Math.max(s.bottom,s.bottom+(D.length-1)*a),R=Math.min(s.top-(T.length-1)*a,s.top);m.domain=[A,R]}}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(m=>{a.push(m.open),a.push(m.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=bm*(P.periodToDecimal(u)-P.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,Li,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:o}=e,s=P.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(_m(e))return r.i18n.DateTimeFormat.format(P.DATE_FORMAT,e,t);if(wm(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=P.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}}};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,r=tt(tt({},e),{},{autosize:!0,colorway:P.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:tt({},P.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:tt({},P.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)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return tt(tt({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}oe(P,"DEFAULT_AXIS_SIZE",.15);oe(P,"MIN_AXIS_SIZE",.025);oe(P,"MAX_AXIS_SIZE",.2);oe(P,"AXIS_SIZE_PX",75);oe(P,"LEGEND_WIDTH_PX",50);oe(P,"MAX_LEGEND_SIZE",.25);oe(P,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));oe(P,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");oe(P,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));oe(P,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));oe(P,"SUBTITLE_LINE_HEIGHT",25);oe(P,"DEFAULT_MARKER_SIZE",6);oe(P,"MODE_MARKERS","markers");oe(P,"MODE_LINES","lines");const ie=P;function Em(n,e,t){return e=Cm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cm(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 cs extends Error{constructor(){super(...arguments),Em(this,"isDownsamplingError",!0)}}function Fi(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 Ri(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fi(Object(t),!0).forEach(function(r){le(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function le(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=Om(n,"string");return typeof e=="symbol"?e:String(e)}function Om(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 ke=W.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),le(this,"currentSeries",void 0),le(this,"PlotComponent",void 0),le(this,"plot",void 0),le(this,"plotWrapper",void 0),le(this,"columnFormats",void 0),le(this,"dateTimeFormatterOptions",void 0),le(this,"decimalFormatOptions",void 0),le(this,"integerFormatOptions",void 0),le(this,"rect",void 0),le(this,"ranges",void 0),le(this,"isSubscribed",void 0),le(this,"isLoadedFired",void 0),le(this,"resizeObserver",void 0),le(this,"getCachedConfig",On((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(Gr),attr:"fill-warning"});var f=!!l;if(f&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:Ge.convertIcon(Gr),attr:"fill-warning"}),i||a||o||d){var m=Ge.downsampleButtonTitle(a,o),p=Ge.downsampleButtonAttr(a,o),v=a?zl:Gl;u.push({name:m,title:"Downsampling status",icon:Ge.convertIcon(v),click:this.handleDownsampleClick,attr:p})}var g=s.some(y=>{var{type:C}=y;return C!=null&&!C.includes("3d")}),b=s.some(y=>{var{type:C}=y;return C!=null&&C.includes("3d")}),w=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],_=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||d||f?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...g?w:[],...b?_:[]]]}})),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=ds(e.Plotly),this.plot=K.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:K.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:Ri(Ri({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ke.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(ke.debug2("Received data update",t,r),t){case ge.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:v,revision:g}=p;return typeof v.datarevision=="number"&&(v.datarevision+=1),{data:r,layout:v,revision:g+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case ge.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case ge.EVENT_DISCONNECT:{var{onDisconnect:o}=this.props;o();break}case ge.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case ge.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case ge.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case ge.EVENT_DOWNSAMPLENEEDED:case ge.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 cs(u));break}case ge.EVENT_ERROR:{var f="".concat(r);this.setState({error:f});var{onError:m}=this.props;m(new Error(f));break}default:ke.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=ie.getLayoutRanges(t),i=!Ve(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ke.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(ke.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){ke.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=ut.getColumnFormats(e),r=ut.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!Ve(this.columnFormats,t)||!Ve(this.dateTimeFormatterOptions,r)||!Ve(this.decimalFormatOptions,i)||!Ve(this.integerFormatOptions,a))&&(this.columnFormats=ut.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new an(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=>{ke.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),m=t!=null;return h.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[m&&h.jsx(e,{ref:this.plot,data:t,layout:u,revision:d,config:f,onAfterPlot:this.handleAfterPlot,onError:ke.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),h.jsx(rn,{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(Na,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}le(Ge,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Fa.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:cr,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const Im=Ge;function ki(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 $i(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ki(Object(t),!0).forEach(function(r){J(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ki(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function J(n,e,t){return e=Dm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dm(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)}var se=W.module("FigureChartModel");class fn extends ge{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",qe(()=>{for(var s=ie.getAllAxes(this.figure),{pendingSeries:l}=this,u=function(){var m,p=l[d],v=i.figure.charts.find(g=>g.series.includes(p));i.addSeries(p,s,(m=v==null?void 0:v.showLegend)!==null&&m!==void 0?m:null),p.subscribe()},d=0;d<l.length;d+=1)u();this.pendingSeries=[]},fn.ADD_SERIES_DEBOUNCE)),J(this,"getTimeZone",at((s,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),J(this,"getValueTranslator",at((s,l)=>{var u=this.getTimeZone(s,l);return d=>this.chartUtils.unwrapValue(d,u)})),J(this,"getValueParser",at((s,l)=>{var u=this.getTimeZone(s,l);return d=>this.chartUtils.wrapValue(d,s,u)})),J(this,"getRangeParser",at((s,l)=>u=>{var[d,f]=u,m=this.getValueParser(s,l);return d=m(d),f=m(f),[d,f]})),J(this,"getAxisRangeParser",at((s,l)=>u=>{var d=ie.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 ie(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.charts.length>0){var e=this.figure.charts[0];return e.title}return""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:e}=this.figure,t=ie.getAllAxes(this.figure),r=[],i=0;i<e.length;i+=1)for(var a=e[i],o=0;o<a.series.length;o+=1){var s=a.series[o];r.push(s.name),this.addSeries(s,t,a.showLegend)}for(var l=[...this.seriesDataMap.keys()],u=l.filter(m=>r.indexOf(m)<0),d=0;d<u.length;d+=1){var f=u[d];this.seriesDataMap.delete(f)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=ie.groupArray(t,"type"),o=this.chartUtils.makeSeriesDataFromSeries(e,a,ie.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,o),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=ie.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:s}=e,{columns:l}=s,u=0;u<l.length;u+=1)this.filterColumnMap.set(l[u].name,l[u]);this.oneClicks.push(s)}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){se.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&&(se.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){se.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){se.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){se.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){se.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;se.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];se.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),m=t.getArray(a,d,f);this.setDataArrayForSeries(a,d,m)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){se.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){se.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){se.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;se.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=ie.DEFAULT_MARGIN.t+i*ie.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=$i({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=$i({},this.layout.title.pad),this.layout.title.pad.t=ie.DEFAULT_TITLE_PADDING.t+i*ie.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)=>{se.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):se.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&&wa(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:m,y:p,yLow:v,yHigh:g}=a;f&&m&&f!==d&&(a.error_x=ie.getPlotlyErrorBars(d,f,m,this.theme)),v&&g&&v!==p&&(a.error_y=ie.getPlotlyErrorBars(p,v,g,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:b,labels:w}=a;b!==void 0&&w===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){se.warn("Trying to set a filter, but no one click!");return}se.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(fn,"ADD_SERIES_DEBOUNCE",50);const Wn=fn;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 En(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)})}}class Ir{static makeModelFromSettings(e,t,r,i){return En(function*(){var a=yield Ir.makeFigureFromSettings(e,t,r);return new Wn(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return En(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new ie(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return En(function*(){return new Wn(e,r,i,t)})()}}const Am=Ir,Mm="var(--dh-color-chart-colorway)",Nm="var(--dh-color-chart-grid)",Lm="var(--dh-color-chart-axis-line)",jm="var(--dh-color-chart-axis-line-zero)",Fm="var(--dh-color-chart-active)",Rm="var(--dh-color-chart-range-bg)",Ui={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)",colorway:Mm,gridcolor:Nm,linecolor:Lm,zerolinecolor:jm,activecolor:Fm,rangebgcolor:Rm,"area-color":"var(--dh-color-chart-area)","trend-color":"var(--dh-color-chart-trend)","line-color":"var(--dh-color-chart-line-deprecated)","error-band-line-color":"var(--dh-color-chart-error-band-line)","error-band-fill-color":"var(--dh-color-chart-error-band-fill)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)"};var Wi=W.module("ChartTheme");function Dr(){var n,e=rr(Ui);return e.colorway=Oa((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Kl.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Wi.debug2("Chart theme:",Ui),Wi.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,activecolor:e.activecolor,rangebgcolor:e.rangebgcolor,area_color:e["area-color"],trend_color:e["trend-color"],line_color:e["line-color"],error_band_line_color:e["error-band-line-color"],error_band_fill_color:e["error-band-fill-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"]})}function ht(n,e,t){return e=km(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function km(n){var e=$m(n,"string");return typeof e=="symbol"?e:String(e)}function $m(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 X extends ge{static get theme(){return X._theme==null&&(X._theme=Dr()),X._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+X.random()*r/5+u*X.smoothing)*t;f=Math.round(f*100)/100,a.push(f),s.push(40+u*X.smoothing),o.push(Math.sin(u/r*e)*r/3+X.random()*r/10+u*X.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:{color:X.theme.area_color,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",color:X.theme.trend_color}}}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",fillcolor:X.theme.error_band_fill_color,line:{width:0,color:X.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:{color:X.theme.line_color,width:3}}}static makeRandomData(){var e=X.makeRandomSeries(6),t=X.makeArea(e),r=X.makeTrendline(e),i=X.makeRandomSeries(2),a=X.makeLine(i),o=X.makeErrorBand(i);return[t,r,a,o]}static makeDefaultLayout(e){var t=new ie(e).makeDefaultLayout(X.theme);return t.title="Chart",t.xaxis&&(t.xaxis.title="Datestamp"),t.yaxis&&(t.yaxis.title="Price"),t}constructor(e){var{data:t=X.makeRandomData(),layout:r=X.makeDefaultLayout(e),filterFields:i=[]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(e),ht(this,"data",void 0),ht(this,"filterFields",void 0),ht(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)}}ht(X,"random",Math.random.bind(Math));ht(X,"smoothing",1.5);ht(X,"_theme",void 0);const Bm=X,Um=ds(cr);var xr=c.createContext(null);function hs(n){var{children:e}=n,{activeThemes:t}=It(),r=c.useMemo(Dr,[t]);return h.jsx(xr.Provider,{value:r,children:e})}function Wm(n){return n.setFigure!==void 0}function Hm(){return vt(xr,"No ChartThemeContext value found.")}const Vm=Object.freeze(Object.defineProperty({__proto__:null,Chart:Im,ChartModel:ge,ChartModelFactory:Am,ChartThemeContext:xr,ChartThemeProvider:hs,ChartUtils:ie,DownsamplingError:cs,FigureChartModel:Wn,MockChartModel:Bm,Plot:Um,defaultChartTheme:Dr,isFigureChartModel:Wm,useChartTheme:Hm},Symbol.toStringTag,{value:"Module"}));var fs=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 ms(n){return n.componentName!==void 0}function zm(n){return n.component!==void 0}var ps=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Gm=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:fs,isGLComponentConfig:ms,isReactComponentConfig:zm,itemDefaultConfig:ps},Symbol.toStringTag,{value:"Module"}));function Vt(n,e,t){return e=Km(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Km(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)}class Pt{constructor(){Vt(this,"_mSubscriptions",void 0),Vt(this,"off",this.unbind),Vt(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Pt.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[Pt.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)}}Vt(Pt,"ALL_EVENT","__all");const Se=Pt;function ye(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 Hn extends Se{constructor(e,t,r){super(),ye(this,"width",void 0),ye(this,"height",void 0),ye(this,"title",void 0),ye(this,"parent",void 0),ye(this,"layoutManager",void 0),ye(this,"tab",void 0),ye(this,"_config",void 0),ye(this,"isHidden",!1),ye(this,"beforeCloseHandler",void 0),ye(this,"_element",x(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ye(this,"_contentElement",void 0),this.title=ms(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)),m=d/f*100,p=(((a=s.config[u])!==null&&a!==void 0?a:0)-m)/(o.contentItems.length-1),v=0;v<o.contentItems.length;v++)if(o.contentItems[v]===s)o.contentItems[v].config[u]=m;else{var g;o.contentItems[v].config[u]=((g=o.contentItems[v].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(x.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 Zm=Object.freeze(Object.defineProperty({__proto__:null,Container:Hn,ItemContainer:Hn},Symbol.toStringTag,{value:"Module"}));function vs(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function gs(n){if(window.location.hash)return vs(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 Ar(n){return window.requestAnimationFrame(n)}function Jm(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 Mr(){return(Math.random()*1e15).toString(36).replace(".","")}function Qm(n,e){var t=n.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function Nr(n){return x.trim(n.replace(/(<([^>]+)>)/gi,""))}function he(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=tp(n,"string");return typeof e=="symbol"?e:String(e)}function tp(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 np extends Se{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=x(document),this._eBody=x(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 At=np;function nt(n,e,t){return e=rp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rp(n){var e=ip(n,"string");return typeof e=="symbol"?e:String(e)}function ip(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 bs{constructor(e,t){nt(this,"_container",void 0),nt(this,"_reactComponent",null),nt(this,"_portalComponent",null),nt(this,"_originalComponentWillUpdate",null),nt(this,"_initialState",void 0),nt(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=Sa.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=x.extend(e,this._container._config.props);return K.createElement(this._reactClass,t)}}var Jt=["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"],ap=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Lr(n){if(Jt.length>36)throw new Error("Too many keys in config minifier map");var e={};return jr(n,e,"_min"),e}function Vn(n){if(Jt.length>36)throw new Error("Too many keys in config minifier map");var e={};return jr(n,e,"_max"),e}function jr(n,e,t){var r=t==="_min"?op:sp;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,Jt);e[s]=o}jr(a,o,t)}else{var l=r(a,ap);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Jt);e[u]=l}}}}function op(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function sp(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function Cn(n,e,t){return e=lp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lp(n){var e=up(n,"string");return typeof e=="symbol"?e:String(e)}function up(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 zn{constructor(e,t){Cn(this,"name",void 0),Cn(this,"origin",void 0),Cn(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function $t(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)}let hp=class extends Se{constructor(e){super(),$t(this,"_layoutManager",void 0),$t(this,"_dontPropagateToParent",void 0),$t(this,"_childEventSource",void 0),$t(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Se.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),x(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(){x(window).off("gl_child_event",this._boundOnEventFromChild)}};const ys=hp,fp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:zn,DragListener:At,EventEmitter:Se,EventHub:ys,ReactComponentHandler:bs,animFrame:Ar,filterXss:Qm,getHashValue:vs,getQueryStringParam:gs,getUniqueId:Mr,minifyConfig:Lr,removeFromArray:Jm,stripTags:Nr,unminifyConfig:Vn},Symbol.toStringTag,{value:"Module"}));function $e(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=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 _s extends Se{constructor(e,t,r,i,a){super(),$e(this,"isInitialised",!1),$e(this,"_config",void 0),$e(this,"_dimensions",void 0),$e(this,"_parentId",void 0),$e(this,"_indexInParent",void 0),$e(this,"_layoutManager",void 0),$e(this,"_popoutWindow",null),$e(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=x.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;x(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-"+Mr();e=Lr(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 re(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=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 Qe extends Se{constructor(e,t,r,i,a,o){var s,l,u,d,f,m,p,v;if(super(),re(this,"_dragListener",void 0),re(this,"_layoutManager",void 0),re(this,"_contentItem",void 0),re(this,"_originalParent",void 0),re(this,"_area",null),re(this,"_lastValidArea",null),re(this,"_minX",void 0),re(this,"_maxX",void 0),re(this,"_minY",void 0),re(this,"_maxY",void 0),re(this,"_width",void 0),re(this,"_height",void 0),re(this,"_sided",void 0),re(this,"element",void 0),re(this,"childElementContainer",void 0),re(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=x(Qe._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",Nr((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(),x(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,_;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((_=this._proxyTab.outerHeight(!0))!==null&&_!==void 0?_:0)}var y=this._layoutManager.container.offset();this._minX=(u=y==null?void 0:y.left)!==null&&u!==void 0?u:0,this._minY=(d=y==null?void 0:y.top)!==null&&d!==void 0?d:0,this._maxX=((f=this._layoutManager.container.width())!==null&&f!==void 0?f:0)+this._minX,this._maxY=((m=this._layoutManager.container.height())!==null&&m!==void 0?m:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(v=this.element.height())!==null&&v!==void 0?v: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")}}re(Qe,"_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 Bt(n,e,t){return e=bp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bp(n){var e=yp(n,"string");return typeof e=="symbol"?e:String(e)}function yp(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{constructor(e,t,r){Bt(this,"_element",void 0),Bt(this,"_itemConfig",void 0),Bt(this,"_layoutManager",void 0),Bt(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new At(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(x.extend(!0,{},r));new Qe(e,t,this._dragListener,this._layoutManager,i,null)}}function Ut(n,e,t){return e=_p(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _p(n){var e=wp(n,"string");return typeof e=="symbol"?e:String(e)}function wp(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 Ss{constructor(e,t,r){Ut(this,"_element",x(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 At(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(x.extend(!0,{},r));new Qe(e,t,this._dragListener,this._layoutManager,i,null)}}}function Es(n,e,t){return e=Sp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sp(n){var e=Ep(n,"string");return typeof e=="symbol"?e:String(e)}function Ep(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 Mt{constructor(){Es(this,"element",x(Mt._template)),x(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()}}Es(Mt,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Pn(n,e,t){return e=Cp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cp(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 St{constructor(e,t,r,i){Pn(this,"element",void 0),Pn(this,"_header",void 0),Pn(this,"_action",void 0),this._header=e,this.element=x('<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 Tp(n,e,t){return e=Op(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Op(n){var e=Ip(n,"string");return typeof e=="symbol"?e:String(e)}function Ip(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 Dp extends Error{constructor(e,t){super(),Tp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Xe=Dp,xp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Xe},Symbol.toStringTag,{value:"Module"}));function ne(n,e,t){return e=Ap(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ap(n){var e=Mp(n,"string");return typeof e=="symbol"?e:String(e)}function Mp(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 Tt(n){return n.isStack}function be(n){return n.isComponent}function Cs(n){return n.isRoot}class ae extends Se{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(Se.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,Tt(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&&be(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 zn(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Xe("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(ps)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof zn&&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,Ar(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function bt(n,e,t){return e=Np(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Np(n){var e=Lp(n,"string");return typeof e=="symbol"?e:String(e)}function Lp(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 Ps extends ae{constructor(e,t,r){super(e,t,r,x()),bt(this,"config",void 0),bt(this,"componentName",void 0),bt(this,"container",void 0),bt(this,"parent",void 0),bt(this,"instance",void 0),this.config=t,this.parent=r;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=x.extend(!0,{},this.config.componentState||{});if(i==null)throw new Xe('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 Hn(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 pe(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=Fp(n,"string");return typeof e=="symbol"?e:String(e)}function Fp(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 Qt extends ae{constructor(e,t,r,i){super(t,r,i,x('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),pe(this,"isRow",void 0),pe(this,"isColumn",void 0),pe(this,"childElementContainer",void 0),pe(this,"parent",void 0),pe(this,"_splitter",[]),pe(this,"_splitterSize",void 0),pe(this,"_splitterGrabSize",void 0),pe(this,"_isColumn",void 0),pe(this,"_dimension",void 0),pe(this,"_splitterPosition",null),pe(this,"_splitterMinPosition",null),pe(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 m=Math.floor((this._isColumn?a:i)-o);return{itemSizes:s,additionalPixel:m,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++)if(this.contentItems[i].config[r]!==void 0){var a;e+=(a=this.contentItems[i].config[r])!==null&&a!==void 0?a:0}else 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 m=a/i;o=a;for(var p=0;p<r.length;p++){l=r[p];var v=Math.round((l.width-t)*m);o-=v,l.width-=v}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 Ts(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}),Ar(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Hi(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 Vi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hi(Object(t),!0).forEach(function(r){Gn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Gn(n,e,t){return e=Rp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rp(n){var e=kp(n,"string");return typeof e=="symbol"?e:String(e)}function kp(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 Kn extends ae{constructor(e,t,r){super(e,Vi(Vi({},t),{},{type:"root"}),null,x('<div class="lm_goldenlayout lm_item lm_root"></div>')),Gn(this,"childElementContainer",void 0),Gn(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(be(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 Qt)||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 zi(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 rt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zi(Object(t),!0).forEach(function(r){ce(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):zi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ce(n,e,t){return e=$p(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $p(n){var e=Bp(n,"string");return typeof e=="symbol"?e:String(e)}function Bp(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 ae{constructor(e,t,r){var i,a,o,s,l,u,d,f,m;super(e,t,r,x('<div class="lm_item lm_stack"></div>')),ce(this,"_activeContentItem",null),ce(this,"_header",void 0),ce(this,"childElementContainer",x('<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=(m=p.labels)===null||m===void 0?void 0:m.minimise)!==null&&f!==void 0?f:void 0},p.header&&(this._header=rt(rt({},this._header),p.header)),t.header&&(this._header=rt(rt({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=rt(rt({},this._header),t.content[0].header)),this.header=new Le(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(be(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,m,p,v,g,b,w,_=this.header.tabs.length;if(_===0){var y,C,S,D,T,A,R,k,B=this.header.element.offset();(y=this.layoutManager.dropTargetIndicator)===null||y===void 0||y.highlightArea({x1:(C=B==null?void 0:B.left)!==null&&C!==void 0?C:0,x2:((S=B==null?void 0:B.left)!==null&&S!==void 0?S:0)+100,y1:(D=(T=this.header.element.offset())===null||T===void 0?void 0:T.top)!==null&&D!==void 0?D:0,y2:((A=(R=this.header.element.offset())===null||R===void 0?void 0:R.top)!==null&&A!==void 0?A:0)+((k=this.header.element.innerHeight())!==null&&k!==void 0?k:0)});return}var O=this.header.tabsContainer,L=(t=O.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),N=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!L||!N)){e<L.left?e=L.left+1:e>L.right&&(e=L.right-1);var j,G;if(!(N.left<e&&e<N.right)){for(var q=0;q<_;q++){var Z;if(j=this.header.tabs[q].element,G=(Z=j.get(0))===null||Z===void 0?void 0:Z.getBoundingClientRect(),G&&G.left<e&&e<G.right){this._dropIndex=q;break}}if(j&&G&&e<G.left+G.width*.5)j.before(this.layoutManager.tabDropPlaceholder);else if(j){var te;this._dropIndex=Math.min(((te=this._dropIndex)!==null&&te!==void 0?te:0)+1,_),j.after(this.layoutManager.tabDropPlaceholder)}}var F=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;F=Math.max(F,(o=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&o!==void 0?o:0);var U=F+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);U=Math.min(U,((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)),(m=this.layoutManager.dropTargetIndicator)===null||m===void 0||m.highlightArea({x1:F,x2:U,y1:(p=(v=this.header.element.offset())===null||v===void 0?void 0:v.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)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w: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 Up=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:ae,Component:Ps,ContentItem:ae,Root:Kn,RowOrColumn:Qt,Stack:Xn,isComponent:be,isRoot:Cs,isStack:Tt},Symbol.toStringTag,{value:"Module"}));function De(n,e,t){return e=Wp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wp(n){var e=Hp(n,"string");return typeof e=="symbol"?e:String(e)}function Hp(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(e,t){var r;De(this,"header",void 0),De(this,"contentItem",void 0),De(this,"element",x(Nt._template)),De(this,"titleElement",void 0),De(this,"closeElement",void 0),De(this,"isActive",!1),De(this,"_layoutManager",void 0),De(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 At(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),be(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),be(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 Qe(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){x(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){be(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&&be(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):be(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),be(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(),be(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}De(Nt,"_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 H(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=zp(n,"string");return typeof e=="symbol"?e:String(e)}function zp(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 Le extends Se{constructor(e,t){var r,i;super(),H(this,"layoutManager",void 0),H(this,"element",x(Le._template)),H(this,"tabsContainer",void 0),H(this,"tabDropdownContainer",void 0),H(this,"tabDropdownSearch",void 0),H(this,"tabDropdownList",null),H(this,"controlsContainer",void 0),H(this,"parent",void 0),H(this,"tabs",[]),H(this,"activeContentItem",null),H(this,"closeButton",null),H(this,"tabDropdownButton",null),H(this,"tabNextButton",x(Le._nextButtonTemplate)),H(this,"tabPreviousButton",x(Le._previousButtonTemplate)),H(this,"holdTimer",null),H(this,"rAF",null),H(this,"CLICK_TIMEOUT",500),H(this,"START_SPEED",.01),H(this,"ACCELERATION",5e-4),H(this,"PADDING",10),H(this,"SCROLL_LEFT","left"),H(this,"SCROLL_RIGHT","right"),H(this,"isDraggingTab",!1),H(this,"isOverflowing",!1),H(this,"isDropdownShown",!1),H(this,"dropdownKeyIndex",0),H(this,"_lastVisibleTabIndex",-1),H(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 Nt(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,m,p=a||d,v=d-p,g=this.START_SPEED*v+.5*this.ACCELERATION*(v*v);g=Math.min(g,(f=(m=this.tabsContainer.get(0))===null||m===void 0?void 0:m.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(),x(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 St(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 St(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 St(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 St(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"),x(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"),x(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(),x(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=x(window).height())!==null&&r!==void 0?r:0,l=(i=x(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,m=Math.min(u.left+(f?u.width:0),l-o.width-this.PADDING),p=f?Math.max(u.top-a,this.PADDING):u.bottom,v=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":v,top:p,left:m})}}}}_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()}}}}H(Le,"_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(""));H(Le,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));H(Le,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function yt(n,e,t){return e=Gp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gp(n){var e=Kp(n,"string");return typeof e=="symbol"?e:String(e)}function Kp(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 Ts{constructor(e,t,r){yt(this,"_isVertical",void 0),yt(this,"_size",void 0),yt(this,"_grabSize",void 0),yt(this,"_dragListener",void 0),yt(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new At(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=x('<div class="lm_drag_handle"></div>'),t=x('<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 Xp=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:_s,DragProxy:Qe,DragSource:ws,DragSourceFromEvent:Ss,DropTargetIndicator:Mt,Header:Le,HeaderButton:St,Splitter:Ts,Tab:Nt},Symbol.toStringTag,{value:"Module"}));var Yp={config:Gm,container:Zm,controls:Xp,errors:xp,items:Up,utils:fp};const qp=Yp;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 de(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){z(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 z(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=Jp(n,"string");return typeof e=="symbol"?e:String(e)}function Jp(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 Os extends Se{static minifyConfig(e){return Lr(e)}static unminifyConfig(e){return Vn(e)}constructor(e,t){super(),z(this,"isInitialised",!1),z(this,"_isFullPage",!1),z(this,"_resizeTimeoutId",void 0),z(this,"_components",{"lm-react-component":bs}),z(this,"_fallbackComponent",void 0),z(this,"_itemAreas",[]),z(this,"_maximisedItem",null),z(this,"_maximisePlaceholder",x('<div class="lm_maximise_place"></div>')),z(this,"_creationTimeoutPassed",!1),z(this,"_subWindowsCreated",!1),z(this,"_dragSources",[]),z(this,"_updatingColumnsResponsive",!1),z(this,"_firstLoad",!0),z(this,"_reactChildMap",new Map),z(this,"_reactChildren",null),z(this,"width",null),z(this,"height",null),z(this,"root",void 0),z(this,"openPopouts",[]),z(this,"selectedItem",null),z(this,"isSubWindow",!1),z(this,"eventHub",new ys(this)),z(this,"config",void 0),z(this,"container",void 0),z(this,"_originalContainer",void 0),z(this,"dropTargetIndicator",null),z(this,"tabDropPlaceholder",x('<div class="lm_drop_tab_placeholder"></div>')),z(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&&x("body").css("visibility","hidden"),this._typeToItem={column:Qt.bind(this,!0),row:Qt.bind(this,!1),stack:Xn,component:Ps}}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){x(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 Mt,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(),x(window).off("resize",this._onResize),x(window).off("unload beforeunload",this._onUnload),x(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 Xe("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 Xe(r);return e.type==="component"&&!(t instanceof Xn)&&t&&!(this.isSubWindow===!0&&t instanceof Kn)&&(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=Mr();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 m;i=(m=u)===null||m===void 0?void 0:m.contentItems.indexOf(d)}}else e instanceof Array?a=e:a=[e];if(!t&&o){var p,v,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,_=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:b+_.left,top:w+_.top,width:(v=e.element.width())!==null&&v!==void 0?v: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 y=new _s(a,t,r,i,this);return y.on("initialised",function(){s.emit("windowOpened",y)}),y.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(y),y}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new ws(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Ss(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(Tt(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(x.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&&x(window).resize(this._onResize),x(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=gs("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Vn(e),localStorage.removeItem(r)),e=x.extend(!0,{},fs,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=x('<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=Nr((e=this.config.content[0].title)!==null&&e!==void 0?e:""),x("head").append(x("body link, body style, template, .gl_keep")),this.container=x("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?x(this._originalContainer):x("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,x("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 Xe(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Xe(t,e);this.root=new Kn(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=>{Tt(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}z(Os,"__lm",qp);const Is=Os,Qp="_lm_dragging_11jwh_1",ev="_lm_goldenlayout_11jwh_1",tv="_lm_header_11jwh_1",nv="_lm_controls_11jwh_1",rv="_lm_tabpreviousbutton_11jwh_1",iv="_lm_tabnextbutton_11jwh_1",av="_lm_tab_11jwh_1",ov="_lm_active_11jwh_1",sv="_lm_close_tab_11jwh_1",lv="_lm_content_11jwh_1",uv="_lm_dragProxy_11jwh_1",dv="_lm_dropTargetIndicator_11jwh_1",cv="_march_11jwh_1",hv="_lm_inner_11jwh_1",fv="_lm_splitter_11jwh_1",mv="_lm_selectable_11jwh_1",pv="_lm_tabdropdown_list_11jwh_1",vv="_lm_title_11jwh_1",gv="_lm_title_before_11jwh_1",bv="_lm_selected_11jwh_1",yv="_lm_focusin_11jwh_1",_v="_lm_window_blur_11jwh_1",wv="_lm_popout_11jwh_1",Sv="_lm_maximise_11jwh_1",Ev="_lm_tabdropdown_11jwh_1",Cv="_lm_close_11jwh_1",Pv="_lm_tabdropdown_search_11jwh_1",Tv="_lm_tabs_11jwh_1",Ov="_lm_keyboard_active_11jwh_1",Iv="_lm_maximised_11jwh_1",Dv="_lm_items_11jwh_1",Ki={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Qp,lm_goldenlayout:ev,lm_header:tv,lm_controls:nv,lm_tabpreviousbutton:rv,lm_tabnextbutton:iv,lm_tab:av,lm_active:ov,lm_close_tab:sv,lm_content:lv,lm_dragProxy:uv,lm_dropTargetIndicator:dv,march:cv,lm_inner:hv,lm_splitter:fv,lm_selectable:mv,lm_tabdropdown_list:pv,lm_title:vv,lm_title_before:gv,lm_selected:bv,lm_focusin:yv,lm_window_blur:_v,lm_popout:wv,lm_maximise:Sv,lm_tabdropdown:Ev,lm_close:Cv,lm_tabdropdown_search:Pv,lm_tabs:Tv,lm_keyboard_active:Ov,lm_maximised:Iv,lm_items:Dv},Xi=Object.freeze({tabHeight:parseInt(Ki["tab-height"],10),dragBorderWidth:parseInt(Ki["drag-border-width"],10)});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 Oe(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){Ds(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 Ds(n,e,t){return e=xv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xv(n){var e=Av(n,"string");return typeof e=="symbol"?e:String(e)}function Av(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 Be=W.module("LayoutUtils");function xs(n){return n.componentName!==void 0}function lt(n){var e=n;return(xs(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Wt(n){return n.focus!==void 0}function qi(n){return n.type==="stack"}class M{static activateTab(e,t){var r=M.getStackForRoot(e,t,!1);if(!r){Be.error("Could not find stack for config",t);return}var i=M.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=M.getStackForRoot(e,t,!1);if(!r)return Be.error("Could not find stack for config",t),!1;var i=M.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(Cs(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&&Tt(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&&zr(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=M.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&&zr(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):Be.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o,'"'))}else if(s){var u=Oe(Oe({},a),{},{content:M.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?(qi(r)&&delete r.activeItemIndex,M.dropLayoutMinorChange(i)):lt(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=M.cloneLayout(e),a=M.cloneLayout(t);return M.dropLayoutMinorChange(i),M.dropLayoutMinorChange(a),Ve(i,a)}return Ve(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(lt(a)){var o,{component:s,props:l={}}=a;r.push(Oe(Oe({},a),{},{id:(o=a==null?void 0:a.id)!==null&&o!==void 0?o:Me(),props:t(s,l)}))}else if(a.content!==void 0){var u=M.hydrateLayoutConfig(a.content,t);qi(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=u.length&&(Be.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),r.push(Oe(Oe({},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=Oe({},t);if(u.id==null&&(u.id=Me.generate()),s!=null){e==null||e.layoutManager.createDragSourceFromEvent(u,s);return}var d=i||{id:u.id,component:u.component};ze(e);var f=a?M.addStack(e):M.getStackForRoot(e,d);ze(f);var m=M.getContentItemInStack(f,d);if(o!=null){var p=g=>{Be.debug("Component created, focusing element",o),f.off("componentCreated",p);var{element:b}=g.origin;requestAnimationFrame(()=>{M.focusElement(b[0],o)})};f.on("componentCreated",p)}if(r&&m){var v=f.contentItems.indexOf(m);f.addChild(u,v+1),f.removeChild(m),f.setActiveContentItem(f.contentItems[v])}else f.addChild(u);o==null&&l&&Wt(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=M.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&&Wt(i)&&i.focus()}static closeComponent(e,t,r){var i=M.getStackForRoot(e,t,!1,!1,!1);if(!i){Be.warn("Cannot find stack for component, ignoring close",t);return}var a=M.getContentItemInStack(i,t),o=document.activeElement;a&&(be(a)?a.container.close(r):i.removeChild(a)),o&&document.contains(o)&&Wt(o)&&o.focus()}static renameComponent(e,t,r){var i=M.getStackForRoot(e,t,!1);if(!i){Be.error("Could not find stack for config",t);return}var a=M.getContentItemInStack(i,t);a&&a.setTitle(r)}static cloneComponent(e,t){var r=M.getStackForRoot(e,t,!1);if(!r)return Be.error("Could not find stack for config",t),null;var{props:i={}}=t,a=M.getPanelComponentState(t),o={type:"react-component",component:t.component,props:Oe(Oe({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Me.generate()};return M.openComponentInStack(r,o),o}static getPanelComponentState(e){if(xs(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(lt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Xi.tabHeight,borderWidth:Xi.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=M.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return M.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=M.getComponentConfigFromContainer(t);if(r&&lt(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]:M.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Wt(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)})}}Ds(M,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var As=K.forwardRef((n,e)=>{var t=M.getComponentNameFromPanel({props:n});return h.jsx("div",{ref:e,className:"panel-placeholder",children:h.jsxs("div",{children:['Component "',t,'" is not registered.']})})});As.displayName="PanelPlaceholder";const Q=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 Ot(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function Ms(n){return typeof n.id=="string"&&n.layout instanceof Is&&n.panelManager instanceof mn&&typeof n.registerComponent=="function"}function Mv(n){if(!Ms(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function Zi(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 Ji(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zi(Object(t),!0).forEach(function(r){Ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ue(n,e,t){return e=Nv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nv(n){var e=Lv(n,"string");return typeof e=="symbol"?e:String(e)}function Lv(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 ve=W.module("PanelManager");class mn{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(Q.FOCUS,this.handleFocus),e.on(Q.MOUNT,this.handleMount),e.on(Q.UNMOUNT,this.handleUnmount),e.on(Q.REOPEN,this.handleReopen),e.on(Q.DELETE,this.handleDeleted),e.on(Q.CLOSED,this.handleClosed),e.on(Q.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(Q.FOCUS,this.handleFocus),e.off(Q.MOUNT,this.handleMount),e.off(Q.UNMOUNT,this.handleUnmount),e.off(Q.REOPEN,this.handleReopen),e.off(Q.DELETE,this.handleDeleted),e.off(Q.CLOSED,this.handleClosed),e.off(Q.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 M.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&lt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=M.getStackForConfig(this.layout.root,{id:e});return(t=r&&M.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=>Ot(r)&&t instanceof r.WrappedComponent||!Ot(r)&&t instanceof r))}updatePanel(e){var t=M.getIdFromPanel(e);if(t==null){ve.error("updatePanel Panel did not have an ID",e);return}ve.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=M.getIdFromPanel(e);if(t==null){ve.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ve.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ve.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ve.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){ve.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ve.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ve.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){ve.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var a=Ji(Ji({},e),{},{props:i}),{root:o}=this.layout;M.openComponent({root:o,config:a,replaceConfig:t})}handleDeleted(e){ve.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ve.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;M.closeComponent(r,t)}addClosedPanel(e){var t=M.getComponentConfigFromContainer(e);if(t&&lt(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(mn,"MAX_CLOSED_PANEL_COUNT",100);var jv=W.module("PanelErrorBoundary");class Ns 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=M.getIdFromContainer(e);jv.debug("componentWillUnmount",r),t.emit(Q.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(Ce,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}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 en(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){Fv(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 Fv(n,e,t){return e=Rv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rv(n){var e=kv(n,"string");return typeof e=="symbol"?e:String(e)}function kv(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 Fr(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),en(en({},n),{},{componentState:null,props:a,type:"react-component"})}function Rr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return en(en({metadata:{}},n),{},{localDashboardId:e})}function Ls(n){var e=Ot(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!Ot(n)&&"$$typeof"in n&&n.$$typeof===sl.ForwardRef;return e||t}const $v={dehydrate:Fr,hydrate:Rr};var kr=K.createContext(void 0),Bv=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}),js=E.shape({on:E.func,off:E.func,emit:E.func}),Uv=E.shape({registerComponent:E.func,root:E.shape({addChild:E.func}),on:E.func,off:E.func,eventHub:js}),Fs=Object.freeze({Container:Bv,EventHub:js,Layout:Uv});function We(n,e,t){c.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function Rs(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.");K.useEffect(()=>{var o=n(a,e,t,r);return()=>{o()}},[e,r,t,a,n])}function Wv(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 m,{dragEvent:p,fetch:v,panelId:g=Me.generate(),widget:b}=f,{id:w,type:_}=b,y=(m=b.title)!==null&&m!==void 0?m:b.name,C=Array.isArray(i)&&i.includes(_)||_===i;if(C){var S={id:w,name:y,type:_},D={localDashboardId:s,metadata:S,fetch:v};a!=null&&(D=a(D,s));var T={type:"react-component",component:t,props:D,title:y,id:g},{root:A}=l;M.openComponent({root:A,config:T,dragEvent:p})}},[t,a,s,l,i]);Rs(u,r,a,o),We(l.eventHub,Q.OPEN,d)}function Hv(){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}function ea(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 ta(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ea(Object(t),!0).forEach(function(r){Vv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Vv(n,e,t){return e=zv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zv(n){var e=Gv(n,"string");return typeof e=="symbol"?e:String(e)}function Gv(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 Kv(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&&Ve({payload:o},{payload:r[a]})?r:ta(ta({},r),{},{[a]:o})}default:return r}}}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){Yn(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 Yn(n,e,t){return e=Xv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xv(n){var e=Yv(n,"string");return typeof e=="symbol"?e:String(e)}function Yv(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 qv{constructor(){Yn(this,"reducers",{}),Yn(this,"listener",null)}register(e,t){var r;this.reducers=ra(ra({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var Zv=new qv;const Jv=Zv;var $r="SET_DASHBOARD_DATA";const Qv=Kv($r,{},!1),ks={dashboardData:Qv};var eg=new Map,tg=Object.freeze({}),ng=Object.freeze([]),$s=n=>n.dashboardData,Lt=(n,e)=>{var t;return(t=$s(n)[e])!==null&&t!==void 0?t:tg},rg=(n,e)=>{var t;return(t=Lt(n,e).closed)!==null&&t!==void 0?t:ng},ig=(n,e)=>{var t;return(t=Lt(n,e).openedMap)!==null&&t!==void 0?t:eg};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){ag(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 ag(n,e,t){return e=og(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function og(n){var e=sg(n,"string");return typeof e=="symbol"?e:String(e)}function sg(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 Bs=(n,e)=>({type:$r,id:n,payload:e}),Us=(n,e)=>(t,r)=>t(Bs(n,aa(aa({},Lt(r(),n)),e)));Object.entries(ks).map(n=>{var[e,t]=n;return Jv.register(e,t)});function lg(n){var{children:e}=n;return h.jsx(h.Fragment,{children:e})}function oa(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?oa(Object(t),!0).forEach(function(r){ug(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ug(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=cg(n,"string");return typeof e=="symbol"?e:String(e)}function cg(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=W.module("DashboardLayout"),hg=Object.freeze({}),fg=[],sa=()=>{},la=n=>n;function Br(n){var e,t,{id:r,children:i,emptyDashboard:a=h.jsx("div",{children:"Dashboard is empty."}),layout:o,layoutConfig:s=fg,onLayoutChange:l=sa,onLayoutInitialized:u=sa,hydrate:d=Rr,dehydrate:f=Fr,panelWrapper:m=lg}=n,p=ll(),v=(e=ul(I=>Lt(I,r)))!==null&&e!==void 0?e:hg,[g,b]=c.useState(!1),[w,_]=c.useState(!1),[y,C]=c.useState(),[S]=c.useState((t=v==null?void 0:v.closed)!==null&&t!==void 0?t:[]),[D,T]=c.useState(!1),[A,R]=c.useState(o.getReactChildren()),k=c.useMemo(()=>new Map,[]),B=c.useMemo(()=>new Map,[]),O=c.useCallback(function(I,$){var V,Fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,Wr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f;Ht.debug2("registerComponent",I,$,Fe,Wr);function Hr(jt,Gs){var pn=$,Ks=m,Xs=Ls(pn),{glContainer:Ys,glEventHub:qs}=jt;return h.jsx(Ns,{glContainer:Ys,glEventHub:qs,children:h.jsx(Ks,_t(_t({},jt),{},{children:Xs?h.jsx(pn,_t(_t({},jt),{},{ref:Gs})):h.jsx(pn,_t({},jt))}))})}Hr.displayName="DashboardWrapper(".concat((V=$.displayName)!==null&&V!==void 0?V:I,")");var zs=o.registerComponent(I,K.forwardRef(Hr));return k.set(I,Fe),B.set(I,Wr),zs},[d,f,k,B,o,m]),L=c.useCallback((I,$)=>{var V;return((V=k.get(I))!==null&&V!==void 0?V:la)($,r)},[k,r]),N=c.useCallback((I,$)=>{var V;return((V=B.get(I))!==null&&V!==void 0?V:la)($,r)},[B,r]),j=c.useMemo(()=>new mn(o,L,N,new Map,S,I=>{var{closed:$,openedMap:V}=I;p(Us(r,{closed:$,openedMap:V}))}),[N,p,L,r,S,o]),G=c.useCallback(()=>{if(!w){D||(u(),T(!0));var I=o.toConfig(),$=I.content,V=M.dehydrateLayoutConfig($,N),Fe=y==null||!M.isEqual(y,V);Ht.debug("handleLayoutStateChanged",Fe,$,V),Fe&&(b(o.root.contentItems.length===0),C(V),l(V),R(o.getReactChildren()))}},[N,D,w,y,o,l,u]),q=c.useCallback(I=>{var $=M.getIdFromContainer(I);o.eventHub.emit(Q.DRAGGING,$),_(!0)},[o.eventHub]),Z=c.useCallback(I=>{var $=M.getIdFromContainer(I);o.eventHub.emit(Q.DROPPED,$),_(!1)},[o.eventHub]),te=c.useCallback(I=>{if(Ht.debug2("handleComponentCreated",I),!(I==null||I.config==null||I.config.component==null||I.element==null)){var $=I.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),V="".concat($,"-component");I.element.addClass(V)}},[]),F=c.useCallback(()=>{R(o.getReactChildren())},[o]);We(o,"stateChanged",G),We(o,"itemPickedUp",q),We(o,"itemDropped",Z),We(o,"componentCreated",te),We(o.eventHub,Q.TITLE_CHANGED,G),We(o,"reactChildrenChanged",F);var U=Da(s);return c.useEffect(function(){if(U!==s&&s!==y){Ht.debug("Setting new layout content...");for(var $=M.hydrateLayoutConfig(s,L);o.root.contentItems.length>0;)o.root.contentItems[0].remove();for(var V=0;V<$.length;V+=1)o.root.addChild($[V]);b(o.root.contentItems.length===0)}},[L,o,s,y,j,U]),h.jsxs(h.Fragment,{children:[g&&a,A,K.Children.map(i,I=>I!=null?K.cloneElement(I,{id:r,layout:o,panelManager:j,registerComponent:O}):null)]})}Br.propTypes={id:E.string.isRequired,children:E.node,data:E.shape({}),emptyDashboard:E.node,layout:Fs.Layout.isRequired,layoutConfig:E.arrayOf(E.shape({})),onLayoutChange:E.func,onLayoutInitialized:E.func};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 mg(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){pg(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 pg(n,e,t){return e=vg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vg(n){var e=gg(n,"string");return typeof e=="symbol"?e:String(e)}function gg(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 bg=100,Tn=()=>{},yg=Object.freeze({});function da(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:a=yg,onLayoutConfigChange:o=Tn,onGoldenLayoutChange:s=Tn,onLayoutInitialized:l=Tn,fallbackComponent:u=As,hydrate:d,dehydrate:f,panelWrapper:m}=n,p=c.useRef(null),[v,g]=c.useState(!1),[b,w]=c.useState();c.useEffect(function(){if(!p.current){w(void 0);return}var C=mg({},M.makeDefaultLayout());C.settings===void 0&&(C.settings={}),Object.assign(C.settings,a),C.content=[];var S=new Is(C,p.current),D=()=>{S.off("initialised",D),g(!0)};return S.on("initialised",D),u!=null&&S.setFallbackComponent(u),S.init(),w(S),s(S),()=>{S.destroy()}},[a,u,s,g,w]);var _=c.useMemo(()=>er(()=>{b!=null&&b.isInitialised&&(b==null||b.updateSize())},bg),[b]);return c.useEffect(function(){return window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[_]),h.jsxs("div",{className:"dashboard-container w-100 h-100",children:[h.jsx("div",{className:"w-100 h-100",ref:p}),v&&b&&h.jsx(kr.Provider,{value:b,children:h.jsx(Br,{emptyDashboard:r,id:e,layout:b,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:l,hydrate:d,dehydrate:f,panelWrapper:m,children:t})})]})}var _g="default";const wg=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_DASHBOARD_ID:_g,Dashboard:da,DashboardLayout:Br,DashboardUtils:$v,GLPropTypes:Fs,LayoutManagerContext:kr,LayoutUtils:M,PanelErrorBoundary:Ns,PanelEvent:Q,PanelManager:mn,SET_DASHBOARD_DATA:$r,assertIsDashboardPluginProps:Mv,canHaveRef:Ls,default:da,dehydrate:Fr,getAllDashboardsData:$s,getClosedPanelsForDashboard:rg,getDashboardData:Lt,getOpenedPanelMapForDashboard:ig,hydrate:Rr,isDashboardPluginProps:Ms,isWrappedComponent:Ot,reducers:ks,setDashboardData:Bs,updateDashboardData:Us,useDashboardPanel:Wv,useLayoutManager:Hv,useListener:We,usePanelRegistration:Rs},Symbol.toStringTag,{value:"Module"}));function Sg(n){var{children:e}=n,{activeThemes:t}=It();return c.useEffect(function(){t!=null&&Gu.initTheme()},[t]),h.jsx(h.Fragment,{children:e})}function Ws(n,e,t){return e=Eg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Eg(n){var e=Cg(n,"string");return typeof e=="symbol"?e:String(e)}function Cg(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 ft{static valueForCell(e,t,r){var i="".concat(e,",").concat(t);return r!==void 0&&r&&(i="(".concat(i,")")),i}constructor(e){Ws(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ft.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),ft.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=>ft.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 Ku(i,e,t??new an(i),r)}}Ws(ft,"DEFAULT_TYPE","java.lang.String");const Pg=ft;function Ye(n,e,t){return e=Tg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tg(n){var e=Og(n,"string");return typeof e=="symbol"?e:String(e)}function Og(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=W.module("TableViewportUpdater"),Ig=150;class Ae extends c.PureComponent{constructor(){super(...arguments),Ye(this,"subscription",void 0),Ye(this,"getViewportRowRange",On((e,t,r)=>{var i=r-t,a=Math.max(0,t-i*Ae.ROW_BUFFER_PAGES),o=r+i*Ae.ROW_BUFFER_PAGES;return[a,o]})),Ye(this,"getViewportColumns",On((e,t,r,i)=>{if(t==null||r==null)return null;for(var a=r-t,o=Math.max(0,t-a*Ae.COLUMN_BUFFER_PAGES),s=Math.min(r+a*Ae.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[],u=o;u<=s;u+=1){var d=Xu.getModelIndex(u,i);l.push(e.columns[d])}return l})),Ye(this,"updateViewport",er((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)},Ig))}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,m=l!==e.sorts,p=u!==e.customColumns,v=o!==e.table;(f||m||p||v)&&this.closeSubscription(),(f||v)&&(Ie.debug("update table filter",s),o.applyFilter(s)),(m||v)&&(Ie.debug("update table sort",l),o.applySort(l)),(p||v)&&(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}}Ye(Ae,"ROW_BUFFER_PAGES",3);Ye(Ae,"COLUMN_BUFFER_PAGES",1);Ye(Ae,"defaultProps",{top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]});const Dg=Ae;function tn(n,e,t){return e=xg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xg(n){var e=Ag(n,"string");return typeof e=="symbol"?e:String(e)}function Ag(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 it=W.module("TreeTableViewportUpdater"),Mg=150;class nn extends c.PureComponent{constructor(e){super(e),tn(this,"listenerCleanup",void 0),tn(this,"updateViewport",er((t,r)=>{if(r<t){it.error("Invalid viewport",t,r);return}if(t===0&&r===0){it.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(it.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)},Mg)),this.listenerCleanup=null}componentDidMount(){var{top:e,bottom:t,table:r,filters:i,sorts:a}=this.props;it.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&&(it.debug("update table filter",a),i.applyFilter(a)),o!==e.sorts&&(it.debug("update table sort",o),i.applySort(o)),this.updateViewport(t,r)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}}tn(nn,"UPDATE_INTERVAL",1e3);tn(nn,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:nn.UPDATE_INTERVAL});const Ng=nn,Lg=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:Yu,AdvancedSettingsType:qu,AggregationEdit:Zu,AggregationUtils:Ju,Aggregations:Qu,BarIcon:ed,ChartBuilder:td,ColumnHeaderGroup:nd,CustomColumnBuilder:rd,DownloadServiceWorkerUtils:id,FormatColumnWhereIcon:ad,FormatRowWhereIcon:od,HistogramIcon:sd,InputEditor:ld,IrisGrid:Yr,IrisGridMetricCalculator:ud,IrisGridModel:dd,IrisGridModelFactory:cd,IrisGridRenderer:hd,IrisGridTableModel:fd,IrisGridTableModelTemplate:md,IrisGridTestUtils:Pg,IrisGridThemeContext:pd,IrisGridThemeProvider:Ka,IrisGridTreeTableModel:vd,IrisGridUtils:gd,LineIcon:bd,OptionType:yd,PieIcon:_d,RollupRows:wd,SHORTCUTS:Sd,ScatterIcon:Ed,TableCsvExporter:Cd,TableSaver:Pd,TableViewportUpdater:Dg,TreeTableViewportUpdater:Ng,VisibilityOrderingBuilder:Td,createDefaultIrisGridTheme:Od,default:Yr,isIrisGridTableModelTemplate:Id,isPanelStateV1:Dd,isPanelStateV2:xd},Symbol.toStringTag,{value:"Module"}));var Hs={react:K,"react-dom":Sa,redux:dl,"react-redux":cl,"@adobe/react-spectrum":hl,"@deephaven/auth-plugins":fm,"@deephaven/chart":Vm,"@deephaven/components":Bh,"@deephaven/dashboard":wg,"@deephaven/icons":Xl,"@deephaven/iris-grid":Lg,"@deephaven/jsapi-bootstrap":Wh,"@deephaven/jsapi-components":Nf,"@deephaven/jsapi-utils":tf,"@deephaven/log":W,"@deephaven/plugin":Uf,"@deephaven/react-hooks":fc},jg=fl.createRequires(Hs),Fg=ml({requires:jg});const Rg=Fg;function ca(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 Ur(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ca(a,r,i,o,s,"next",l)}function s(l){ca(a,r,i,o,s,"throw",l)}o(void 0)})}}var He=W.module("@deephaven/app-utils.PluginUtils");function kg(n){return qn.apply(this,arguments)}function qn(){return qn=Ur(function*(n){var e=yield Rg(n);return e}),qn.apply(this,arguments)}function $g(n){return Zn.apply(this,arguments)}function Zn(){return Zn=Ur(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")}}),Zn.apply(this,arguments)}function Bg(n){return Jn.apply(this,arguments)}function Jn(){return Jn=Ur(function*(n){He.debug("Loading plugins...");try{var e=yield $g("".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(kg(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 m,p=Yo(d.value)?d.value:(m=d.value.default)!==null&&m!==void 0?m: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(v){return He.error("Unable to load plugins:",v),new Map}}),Jn.apply(this,arguments)}function Ug(n){var e,t;return(e=(t=n.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function Wg(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,r=Ug(e),i=[...n.entries(),...t.entries()].filter(l=>{var[,u]=l;return qo(u)||Zt(u)}).map(l=>{var[u,d]=l;return Zt(d)?{type:Je.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 Hg=Ea.createRequires(()=>Hs),Vg=Ea.createRemoteComponent({requires:Hg});const pb=Vg;function ha(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 zg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ha(a,r,i,o,s,"next",l)}function s(l){ha(a,r,i,o,s,"throw",l)}o(void 0)})}}function Gg(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=zg(function*(){var d,f=(d=yield t==null?void 0:t())!==null&&d!==void 0?d:[],m=yield Bg(e);if(!s){var p=f.map(v=>[v.name,v]);a(new Map([...p,...m]))}}),u.apply(this,arguments)}return l(),()=>{s=!0}},[e,t]),h.jsx(xt.Provider,{value:i,children:r})}function Kg(){var n=Sr();return c.useEffect(function(){n.postMessage(br(gr))},[n]),null}function fa(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 Xg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){fa(a,r,i,o,s,"next",l)}function s(l){fa(a,r,i,o,s,"throw",l)}o(void 0)})}}var Yg=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:rs}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:ss}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:ns}]]);function qg(n){var{children:e}=n,t=Ze(),r=c.useContext(xt),[i,a]=c.useState(),[o,s]=c.useState();c.useEffect(function(){var f=!1;function m(){return p.apply(this,arguments)}function p(){return p=Xg(function*(){try{var v=yield t.getAuthConfigValues();f||a(new Map(v))}catch(g){f||s(g)}}),p.apply(this,arguments)}return m(),()=>{f=!0}},[t]);var l=c.useMemo(()=>{if(!(r==null||i==null))try{return Wg(r,i,Yg)}catch(d){s(d)}},[i,r]),u=l==null||i==null;return u||o!=null?h.jsx(Ce,{isLoading:u&&o==null,errorMessage:pt(o)}):h.jsx(l,{authConfigValues:i,children:h.jsxs(h.Fragment,{children:[h.jsx(Kg,{}),e]})})}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 Zg(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 Jg=W.module("@deephaven/app-utils.ConnectionBootstrap");function Qg(n){var{children:e}=n,t=Pe(),r=Ze(),[i,a]=c.useState(),[o,s]=c.useState();return c.useEffect(function(){var u=!1;function d(){return f.apply(this,arguments)}function f(){return f=Zg(function*(){try{var m=yield r.getAsIdeConnection();if(u)return;s(m)}catch(p){if(u)return;a(p)}}),f.apply(this,arguments)}return d(),()=>{u=!0}},[t,r]),c.useEffect(function(){if(o==null)return;function u(f){var{detail:m}=f;Jg.info("Shutdown","".concat(JSON.stringify(m))),a("Server shutdown: ".concat(m??"Unknown reason"))}var d=o.addEventListener(t.IdeConnection.EVENT_SHUTDOWN,u);return d},[t,o]),o==null||i!=null?h.jsx(Ce,{"data-testid":"connection-bootstrap-loading",isLoading:o==null,errorMessage:i!=null?"".concat(i):void 0}):h.jsx(Va.Provider,{value:o,children:e})}function vb(n){return new URL(n,"".concat(window.location))}function eb(){var n=new URLSearchParams(window.location.search);return n.get("envoyPrefix")}function tb(){var n=eb();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function nb(n){var{children:e}=n,t=c.useContext(Go);return t?h.jsx(h.Fragment,{children:e}):h.jsx(Ce,{"data-testid":"fonts-loaded-loading"})}function pa(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 rb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){pa(a,r,i,o,s,"next",l)}function s(l){pa(a,r,i,o,s,"throw",l)}o(void 0)})}}var Vs=c.createContext(null);function ib(n){var{children:e}=n,t=Ze(),[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=rb(function*(){try{var m=yield t.getServerConfigValues();u||i(new Map(m))}catch(p){u||o(p)}}),f.apply(this,arguments)}return d(),()=>{u=!0}},[t]);var s=r==null;return s||a!=null?h.jsx(Ce,{isLoading:s&&a==null,errorMessage:pt(a)}):h.jsx(Vs.Provider,{value:r,children:e})}function ab(){return vt(Vs,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function ob(n){var{children:e}=n,t=ab(),r=c.useContext(Ga),i=c.useContext(on),a=us(t,r,i);return h.jsx(za.Provider,{value:a,children:e})}function sb(n){var{children:e}=n,t=c.useContext(xt),r=c.useMemo(()=>t==null?null:Jo(t),[t]);return h.jsx(ja,{themes:r,children:h.jsx(hs,{children:h.jsx(Sg,{children:h.jsx(Ka,{children:e})})})})}function gb(n){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:r,serverUrl:i,children:a}=n,o=c.useMemo(()=>tb(),[]),[s,l]=c.useState(0),u=c.useCallback(()=>{},[]),d=c.useCallback(()=>{l(f=>f+1)},[]);return cn(u,d),h.jsx(Lf,{fontClassNames:e,children:h.jsx(Gg,{getCorePlugins:r,pluginsUrl:t,children:h.jsx(sb,{children:h.jsx(Oo,{serverUrl:i,options:o,children:h.jsx(Uo,{children:h.jsx(qg,{children:h.jsx(ib,{children:h.jsx(ob,{children:h.jsx(Qg,{children:h.jsx(nb,{children:a})})})})})})},s)})})})}export{gb as AppBootstrap,qg as AuthBootstrap,Qg as ConnectionBootstrap,Lf as FontBootstrap,nb as FontsLoaded,Go as FontsLoadedContext,Gg as PluginsBootstrap,pb as RemoteComponent,sb as ThemeBootstrap,Ug as getAuthHandlers,Wg as getAuthPluginComponent,vb as getBaseUrl,tb as getConnectOptions,eb as getEnvoyPrefix,$g as loadJson,kg as loadModulePlugin,Bg as loadModulePlugins,ab as useServerConfig,_b as useUser};
5
- //# sourceMappingURL=index-4f84b414.js.map
5
+ //# sourceMappingURL=index-1198a790.js.map