@deephaven/embed-grid 0.64.0 → 0.64.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,29 +1,29 @@
1
- import{C as u,$ as Hm,H as sc,I as yo,F as ne,J as oc,r as v,K as Le,L as ye,M as Vm,N as lc,O as Bm,P as dc,Q as Wm,S as Gm,T as zl,U as ot,G as X,E as Y,V as _,W as zm,D as Hn,X as ar,Y as Km,Z as qm,_ as Ym,a0 as Xm,a1 as uc,a2 as Zm,a3 as Qm,a4 as Er,a5 as hc,a6 as se,a7 as Mt,a8 as Z,R as xa,a9 as Kl,aa as Jm,ab as Eo,ac as eg,ad as tg,ae as ng,af as rg,ag as gi,ah as cc,ai as bi,aj as ig,ak as ai,al as Pt,am as ag,an as sg,ao as og,ap as lg,aq as dg,ar as vc}from"./vendor-c87e2acb.js";import{L as B,i as ug,v as Wn,M as Ci,b as Si,c as Na,d as cr,e as hg,a as He,f as wo,g as cg,h as vg,r as Po,j as z,k as fg,l as pg,m as mg,T as Vn,C as gg,D as bg,n as Cg,o as Sg,p as yg,q as Ma,N as Eg,S as wg,s as Pg,t as _g,W as Tg,u as Og,w as Dg,x as Ig,y as xg,z as Ng,A as Mg,B as fc,E as pc,F as Lg,G as Fg,H as Ag,I as Rg,J as jg,K as kg,O as $g,P as Ug,Q as La,R as Hg,U as mc,V as Vg,X as ql,Y as Bg,Z as Wg,_ as gc,$ as _o,a0 as To,a1 as sr,a2 as Gg,a3 as Yl,a4 as zg,a5 as Kg,a6 as qg,a7 as Yg,a8 as Oo,a9 as bc,aa as Rs,ab as Xg,ac as Zg,ad as Xl,ae as Cc,af as Zl,ag as Sc,ah as Qg,ai as Fa,aj as Jg,ak as eb,al as tb,am as nb,an as rb,ao as ib,ap as ab,aq as yc,ar as sb,as as Ec,at as wc,au as Ql,av as ob,aw as lb,ax as db,ay as ub,az as hb,aA as cb,aB as vb,aC as fb}from"./index-885889f7.js";import{T as wt,g as pb,c as Rr,d as mb,e as gb,h as Pc,P as yi,B as K,i as vr,M as Do,D as _c,j as En,k as bb,S as Ei,R as ua,l as wr,m as ha,n as ae,o as js,p as jr,q as Cb,r as Sb,s as yb,C as Tc,t as Io,v as Eb,w as wb,G as Pr,x as Pb,K as fe,y as pe,z as _b,A as Tb,O as Ob,E as Db,F as Oc,H as ks,J as Bn,L as Dc,N as Ib,Q as qe,U as xb,V as Nb,W as Ic,X as xc,Y as Mb,Z as Lb,_ as Fb,$ as Ve,a0 as Ab,a1 as Rb,a2 as jb,a3 as xo,a4 as No,a5 as kb,a6 as $b,a7 as Ub,a8 as _r,a9 as wn,aa as Hb,ab as Vb,ac as Bb,ad as Ne,ae as Wb,af as Mo,ag as Gb,ah as Nc,ai as Mc,aj as Lo,ak as Fo,al as Lc,am as Fc,an as Ac,f as zb,ao as Rc,ap as Kb,aq as qb,ar as Ao,as as ca,at as Yb,au as jc,av as Se,aw as Xb,ax as Zb,ay as Qb,az as kc,aA as Aa,aB as $c,aC as Uc,aD as Hc,aE as vt,aF as Jb,aG as Ot,aH as Vc,aI as Tn,aJ as eC,aK as Bc,aL as tC,aM as nC,I as Tr,aN as Wc,aO as rC,aP as iC,aQ as aC,aR as sC,aS as oC,aT as lC,aU as dC,aV as uC,aW as hC,aX as cC,aY as vC,aZ as fC,a_ as pC,a$ as mC,b0 as Yt,b as Ra,b1 as gC,b2 as bC,b3 as Gc,b4 as CC,b5 as SC,b6 as zc,b7 as yC,b8 as Ze,b9 as EC,ba as wC,bb as PC,bc as _C,bd as TC,be as OC,bf as DC,bg as IC,bh as xC,bi as NC,bj as aa,bk as MC,bl as LC,bm as FC,bn as AC,bo as si,bp as RC,bq as jC,br as kC,bs as Qr,bt as Kc,u as $C,a as UC}from"./useUser-75ea4bfc.js";import{c as ps,P as Ro,b as HC,h as VC,p as BC,o as WC,s as GC,t as zC}from"./plotly-37fd1df1.js";import{e as jo,l as ki,K as oi,a as qc,_ as Yc}from"./monaco-0b69f16f.js";function Or(r){var e=r;r instanceof CustomEvent&&(e=r.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}var Xc=24,KC=32,qC=33,YC=150,$s=200,Zc=500,Qc=250,XC={spellCheck:!1},ZC=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange","tooltip"];function Jl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ed(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jl(Object(t),!0).forEach(function(n){QC(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Jl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function QC(r,e,t){return e=JC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JC(r){var e=eS(r,"string");return typeof e=="symbol"?e:String(e)}function eS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function tS(r,e){if(r==null)return{};var t=nS(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function nS(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Jc(r){var{ariaLabel:e,icon:t,isQuiet:n,labelText:i,children:a,onOpenChange:s,tooltip:o}=r,l=tS(r,ZC),d=i==null&&o!=null?"action-button-icon-with-tooltip":void 0;return u.jsxs(Hm,{type:"popover",onOpenChange:s,children:[u.jsxs(sc,ed(ed({},l),{},{"aria-label":e??i,isQuiet:n,children:[u.jsx(yo,{UNSAFE_className:d,children:u.jsx(ne,{icon:t})}),i==null?null:u.jsx(oc,{children:i}),o==null?null:u.jsx(wt,{children:o})]})),a]})}function rS(r,e){return r===0?0:e==="all"||r===e.size?"all":e.size}function ev(r,e){return r===e?!0:r==="all"||e==="all"||r.size!==e.size?!1:[...r.keys()].every(t=>e.has(t))}function tv(r,e){return r.isInverted===e.isInverted&&ev(r.selection,e.selection)}function nv(r,e,t){if(r==="all")return"all";var n=[...r.keys()];return new Set(n.map(i=>t(e(i))))}function rv(r,e){var t=r==="all"||r.size>e/2,n=r;return t&&(n=r==="all"?new Set:new Set([...pb(0,e-1)].filter(i=>!r.has(String(i))).map(i=>String(i)))),{selection:n,isInverted:t}}function iS(r,e){return r?{}:{errorMessage:e,validationState:"invalid"}}function iv(r){var e;return(e=r==null?void 0:r.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function aS(r){var e=r==null?void 0:r.UNSAFE_getDOMNode().lastElementChild;return av(e)}function sS(r){var e=r==null?void 0:r.UNSAFE_getDOMNode(),t=e==null?void 0:e.querySelector("input"),n=t==null?void 0:t.getAttribute("aria-controls"),i=n==null?null:document.getElementById(n);return i}function av(r){return r instanceof HTMLElement?r:null}function ko(){var r=v.useRef(!1);return v.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function td(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function oS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){td(a,n,i,s,o,"next",l)}function o(l){td(a,n,i,s,o,"throw",l)}s(void 0)})}}var lS=B.module("useAsyncInterval");function sv(r,e){var t=ko(),n=v.useRef(0),i=v.useRef(0),a=v.useRef(null),s=v.useCallback(oS(function*(){var o=Date.now();i.current+=1;var l=a.current==null?e:o-a.current;a.current=o;try{yield r()}catch(c){lS.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-a.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);n.current=window.setTimeout(s,h)}}),[r,t,e]);v.useEffect(()=>(a.current=null,s(),()=>{window.clearTimeout(n.current)}),[e,s])}function dS(r,e){return v.useCallback(function(){var t=r(...arguments);return e(),t},[e,r])}function va(r,e){var t=v.useMemo(()=>Le(r,e),[r,e]);return v.useEffect(()=>()=>t.cancel(),[t]),t}function uS(r){var[e,t]=v.useState(r);return v.useEffect(()=>{t(r)},[r]),[e,t]}function hS(r,e,t,n){var i=v.useRef(0);v.useEffect(()=>{i.current>=t||n&&(i.current+=1,r())},[t,n,...e])}function ov(r,e){var t=v.useRef(r),n=e(t.current,r)?t.current:r;return t.current=n,n}function cS(r){r.preventDefault()}function lv(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=v.useMemo(()=>"useSubmitButtonRef-".concat(ye()),[]),t=v.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),n=v.useMemo(()=>({id:e,onSubmit:r?void 0:cS}),[e,r]),i=v.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:n,submitButtonProps:i}}function dv(r,e){return v.useCallback(t=>{typeof r=="function"?r(e(t)):r.current=e(t)},[e,r])}function uv(r,e){var{getItem:t,selectedKeys:n,items:i}=r;return v.useMemo(()=>{var{selection:a,isInverted:s}=rv(n,i.length);return{selection:nv(a,t,e),isInverted:s}},[n,i.length,t,e])}function vS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ug,t=v.useRef();return v.useEffect(()=>()=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t)},[]),v.useCallback(n=>{var i;(i=t.current)===null||i===void 0||i.call(t);var a=e(n);a&&(a.addEventListener("scroll",r),t.current=()=>{a.removeEventListener("scroll",r),t.current=void 0})},[e,r])}function nd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function fS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){nd(a,n,i,s,o,"next",l)}function o(l){nd(a,n,i,s,o,"throw",l)}s(void 0)})}}function pS(r,e,t){var n=v.useRef(null),[i,a]=v.useState(null),s=v.useCallback(fS(function*(){if(!(i==null||t==null)){var l=yield t();i.scroll(0,l)}}),[t,i]);v.useEffect(()=>(i==null||i.addEventListener("scroll",e),s(),()=>{i==null||i.removeEventListener("scroll",e)}),[e,i,s]);var o=v.useCallback(l=>{l&&setTimeout(()=>{a(r(n.current))},0)},[r]);return{ref:n,onOpenChange:o}}function rd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function mS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){rd(a,n,i,s,o,"next",l)}function o(l){rd(a,n,i,s,o,"throw",l)}s(void 0)})}}function hi(r,e){var{autoLoad:t=!0}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},[n,i]=v.useState(null),[a,s]=v.useState(null),[o,l]=v.useState(!1),d=v.useCallback(mS(function*(){l(!0);try{var h=yield r(...e);i(h),s(null)}catch(c){i(null),s(c)}finally{l(!1)}}),[r,...e]);return v.useEffect(()=>{t&&d()},[t,d]),{data:n,error:a,isError:a!=null,isLoading:o,reload:d}}function id(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ad(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?id(Object(t),!0).forEach(function(n){gS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):id(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function gS(r,e,t){return e=bS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bS(r){var e=CS(r,"string");return typeof e=="symbol"?e:String(e)}function CS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function SS(r,e,t,n){var i=arguments.length===4;return v.useCallback(a=>{var s=i?a??n:a;t(ad(ad({},r),{},{[e]:s}))},[t,r,e,i,n])}function hv(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=v.useRef(),i=v.useRef(0);return v.useCallback(a=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var s=Math.floor(a.target.scrollTop/r);i.current!==s&&(i.current=s,e(s))},t)},[t,r,e])}function wi(r,e){var[t,n]=v.useState(!0),[i,a]=v.useState(r),[s,o]=v.useState(r),[l,d]=v.useState(e);return(r!==s||e!==l)&&(n(!0),o(r),d(e)),v.useEffect(()=>{var h=!1,c=setTimeout(()=>{h||(n(!1),a(r))},e);return()=>{h=!0,clearTimeout(c)}},[r,e]),{isDebouncing:t,value:i}}function cv(r,e){return v.useCallback(t=>{if(t!=null){var n=e==null?[t]:t.querySelectorAll(e);n.forEach(i=>{Object.entries(r).forEach(a=>{var[s,o]=a;i.setAttribute(s,o)})})}},[r,e])}function yS(r){var e=cv(XC,r);return dv(e,iv)}function vv(){var{getKey:r=fv}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=v.useState([]),[n,i]=v.useState(()=>new Set),a=v.useCallback(m=>b=>r(b)===m,[r]),s=v.useCallback(m=>{var b;return(b=e.find(a(m)))!==null&&b!==void 0?b:null},[e,a]),o=v.useCallback(m=>{var b=s(m);if(b==null)throw new Error("No item found matching key: ".concat(m));return b},[s]),l=v.useCallback(m=>{t(b=>[...b,...m])},[]),d=v.useCallback((m,b)=>{t(g=>[...g.slice(0,m),...b,...g.slice(m)])},[]),h=v.useCallback(m=>{var b=new Set(m);t(g=>g.filter(C=>!b.has(r(C))))},[r]),c=v.useCallback((m,b)=>{var g=e.findIndex(a(m));g!==-1&&t(C=>[...C.slice(0,g),b,...C.slice(g+1)])},[e,a]),f=v.useCallback(m=>{if(m.size!==0){var b=[],g=new Map;for(var C of m.keys()){var y=e.findIndex(a(C));b.push(y),g.set(y,C)}b.sort((E,w)=>E-w);var S=[];e.forEach((E,w)=>{if(b[0]===w){var I=g.get(b.shift()),O=m.get(I);S.push(O)}else S.push(E)}),t(S)}},[e,a]),p=v.useMemo(()=>({items:e,selectedKeys:n,append:l,bulkUpdate:f,findItem:s,getItem:o,insert:d,remove:h,setItems:t,setSelectedKeys:i,update:c}),[l,f,s,o,d,e,h,t,n,c]);return p}function fv(r){var e=r!=null&&typeof r=="object"&&"key"in r;if(!e)throw new Error("Item does not have a `key` prop.");return r.key}function $o(r,e){v.useEffect(()=>{if(r!=null){var t=new window.ResizeObserver(e);return t.observe(r),()=>{r!=null&&t.unobserve(r)}}},[r,e])}const ES=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:iS,defaultGetKey:fv,extractSpectrumHTMLElement:iv,extractSpectrumLastChildHTMLElement:aS,findSpectrumComboBoxScrollArea:sS,getSelectedItemCountOrAll:rS,identityExtractHTMLElement:av,isSelectionEqual:ev,isSelectionMaybeInvertedEqual:tv,mapSelection:nv,optimizeSelection:rv,useAsyncInterval:sv,useCallbackWithAction:dS,useContextOrThrow:Rr,useCopyToClipboard:mb,useDebouncedCallback:va,useDebouncedValue:wi,useDependentState:uS,useEffectNTimesWhen:hS,useFormWithDetachedSubmitButton:lv,useForwardedRef:gb,useIsEqualMemo:ov,useIsMountedRef:ko,useMappedRef:dv,useMappedSelection:uv,useOnScrollOffsetChangeCallback:hv,useOnScrollRef:vS,usePopoverOnScrollRef:pS,usePrevious:Pc,usePromiseFactory:hi,usePropChangeCallback:SS,useResizeObserver:$o,useSetAttributesCallback:cv,useSpectrumDisableSpellcheckRef:yS,useWindowedListData:vv},Symbol.toStringTag,{value:"Module"})),wS="_spectrumActionBar_tmmkp_5",PS="_spectrumDialogComponentHeading_tmmkp_9",_S="_spectrumEllipsis_tmmkp_14",Uo={spectrumActionBar:wS,spectrumDialogComponentHeading:PS,spectrumEllipsis:_S};function sd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $i(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sd(Object(t),!0).forEach(function(n){TS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function TS(r,e,t){return e=OS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function OS(r){var e=DS(r,"string");return typeof e=="symbol"?e:String(e)}function DS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function pv(r){var{heading:e,confirmationButtonLabel:t,children:n,onCancel:i,onConfirm:a}=r,{formProps:s,submitButtonProps:o}=lv();return u.jsxs(Vm,{children:[u.jsx(lc,{level:3,UNSAFE_className:Uo.spectrumDialogComponentHeading,children:e}),u.jsx(Bm,{}),u.jsx(dc,{children:u.jsx(Wm,$i($i({},s),{},{children:n}))}),u.jsxs(Gm,{children:[u.jsx(zl,{variant:"secondary",onPress:i,children:"Cancel"}),u.jsx(zl,$i($i({},o),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function IS(r){var{ariaLabel:e,heading:t,confirmationButtonLabel:n,isHidden:i,children:a,tooltip:s,onConfirm:o}=r,l=v.useCallback(d=>u.jsx(pv,{heading:t,confirmationButtonLabel:n,onCancel:d,onConfirm:()=>{d(),o()},children:a}),[a,n,t,o]);return u.jsx(Jc,{ariaLabel:e,icon:Wn,isHidden:i,isQuiet:!0,height:Xc,tooltip:s,children:l})}var xS=["icon","label","tooltip"];function od(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ld(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?od(Object(t),!0).forEach(function(n){NS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):od(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function NS(r,e,t){return e=MS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MS(r){var e=LS(r,"string");return typeof e=="symbol"?e:String(e)}function LS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function FS(r,e){if(r==null)return{};var t=AS(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function AS(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function mv(r){var{icon:e,label:t,tooltip:n}=r,i=FS(r,xS);return u.jsxs(sc,ld(ld({},i),{},{"aria-label":t,isQuiet:!0,height:Xc,children:[u.jsx(yo,{UNSAFE_className:n==null?void 0:"action-button-icon-with-tooltip",children:u.jsx(ne,{icon:e})}),n==null?null:u.jsx(wt,{children:n})]}))}mv.displayName="IconActionButton";function dd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function RS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dd(Object(t),!0).forEach(function(n){Qt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qt(r,e,t){return e=jS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jS(r){var e=kS(r,"string");return typeof e=="symbol"?e:String(e)}function kS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var $S=100,Us;(function(r){r.UP="UP",r.DOWN="DOWN"})(Us||(Us={}));class xt extends v.Component{constructor(e){super(e),Qt(this,"popper",void 0),Qt(this,"cbContainer",void 0),Qt(this,"menuContainer",void 0),Qt(this,"input",void 0),Qt(this,"getCachedFilteredOptions",ot((n,i)=>n.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=RS({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=Le(this.updateInputValue,$S),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=X.createRef(),this.cbContainer=X.createRef(),this.menuContainer=X.createRef(),this.input=X.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,n=t.filter(i=>i.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){var{menuIsOpen:t}=this.state,{value:n,isValid:i}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,i)}fireOnChange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{onChange:n}=this.props;n(e,t)}processFilterChange(e){var t,{options:n}=this.props,{menuIsOpen:i}=this.state,a=e?this.getCachedFilteredOptions(n,e):n,s=a.length===1&&a[0].title===e;if(this.setState({filteredOptions:a,keyboardOptionIndex:0}),s&&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:n,keyboardOptionIndex:i}=this.state,a=n[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(xt.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(xt.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(xt.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(xt.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){var{filteredOptions:t,keyboardOptionIndex:n}=this.state,i=n;e===xt.MENU_NAVIGATION_DIRECTION.UP?n>0?(i=(i-1)%t.length,this.setState({keyboardOptionIndex:i})):n===0&&(i=t.length-1,this.setState({keyboardOptionIndex:i})):e===xt.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(i=(i+1)%t.length,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i)}handleInputKeyDown(e){var{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){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 n;(n=this.input.current)===null||n===void 0||n.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 u.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:n}=this.state;return t&&n.length===0?u.jsx("div",{className:"no-match",children:e}):n.map((i,a)=>this.renderOption(i,a))}renderOption(e,t){var{keyboardOptionIndex:n}=this.state,i="option-".concat(t,"-").concat(e.value);return u.jsx("button",{type:"button",className:Y("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},i)}render(){var{options:e,inputPlaceholder:t,disabled:n,className:i,defaultTitle:a,spellCheck:s,"data-testid":o}=this.props,{title:l,menuIsOpen:d,popperOptions:h,invalid:c}=this.state;return u.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[u.jsx("input",{value:l||a,className:Y("form-control",i,"aci-input",{"is-invalid":c&&!d}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:s,"data-testid":o}),u.jsx(yi,{ref:this.popper,options:h,className:Y("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}Qt(xt,"propTypes",{options:_.arrayOf(_.shape({title:_.string.isRequired,value:_.string.isRequired})).isRequired,popperOptions:_.shape({}),onChange:_.func,inputPlaceholder:_.string,disabled:_.bool,className:_.string,defaultTitle:_.string,spellCheck:_.bool,onEnter:_.func,noMatchText:_.string,"data-testid":_.string});Qt(xt,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});Qt(xt,"MENU_NAVIGATION_DIRECTION",Us);const US=xt;function Ho(r){var{className:e="",value:t,onChange:n,spellCheck:i=!1,placeholder:a="",disabled:s=!1,delimiter:o="",id:l="","data-testid":d}=r,[h,c]=v.useState(t),[f,p]=v.useState(!1),m=v.useRef(null);v.useEffect(function(){c(t)},[t]);function b(O){return O.trim().split(o).filter(T=>T).join(`
1
+ import{C as u,$ as Hm,H as sc,I as yo,F as ne,J as oc,r as c,K as Le,L as ye,M as Vm,N as lc,O as Bm,P as dc,Q as Wm,S as Gm,T as zl,U as ot,G as X,E as Y,V as _,W as zm,D as Hn,X as ar,Y as Km,Z as qm,_ as Ym,a0 as Xm,a1 as uc,a2 as Zm,a3 as Qm,a4 as Er,a5 as hc,a6 as se,a7 as Mt,a8 as Z,R as xa,a9 as Kl,aa as Jm,ab as Eo,ac as eg,ad as tg,ae as ng,af as rg,ag as gi,ah as cc,ai as bi,aj as ig,ak as ai,al as Pt,am as ag,an as sg,ao as og,ap as lg,aq as dg,ar as vc}from"./vendor-c87e2acb.js";import{L as B,i as ug,v as Wn,M as Ci,b as Si,c as Na,d as cr,e as hg,a as He,f as wo,g as cg,h as vg,r as Po,j as z,k as fg,l as pg,m as mg,T as Vn,C as gg,D as bg,n as Cg,o as Sg,p as yg,q as Ma,N as Eg,S as wg,s as Pg,t as _g,W as Tg,u as Og,w as Dg,x as Ig,y as xg,z as Ng,A as Mg,B as fc,E as pc,F as Lg,G as Fg,H as Ag,I as Rg,J as jg,K as kg,O as $g,P as Ug,Q as La,R as Hg,U as mc,V as Vg,X as ql,Y as Bg,Z as Wg,_ as gc,$ as _o,a0 as To,a1 as sr,a2 as Gg,a3 as Yl,a4 as zg,a5 as Kg,a6 as qg,a7 as Yg,a8 as Oo,a9 as bc,aa as Rs,ab as Xg,ac as Zg,ad as Xl,ae as Cc,af as Zl,ag as Sc,ah as Qg,ai as Fa,aj as Jg,ak as eb,al as tb,am as nb,an as rb,ao as ib,ap as ab,aq as yc,ar as sb,as as Ec,at as wc,au as Ql,av as ob,aw as lb,ax as db,ay as ub,az as hb,aA as cb,aB as vb,aC as fb}from"./index-4e0b0d8e.js";import{T as wt,g as pb,c as Rr,d as mb,e as gb,h as Pc,P as yi,B as K,i as vr,M as Do,D as _c,j as En,k as bb,S as Ei,R as ua,l as wr,m as ha,n as ae,o as js,p as jr,q as Cb,r as Sb,s as yb,C as Tc,t as Io,v as Eb,w as wb,G as Pr,x as Pb,K as fe,y as pe,z as _b,A as Tb,O as Ob,E as Db,F as Oc,H as ks,J as Bn,L as Dc,N as Ib,Q as qe,U as xb,V as Nb,W as Ic,X as xc,Y as Mb,Z as Lb,_ as Fb,$ as Ve,a0 as Ab,a1 as Rb,a2 as jb,a3 as xo,a4 as No,a5 as kb,a6 as $b,a7 as Ub,a8 as _r,a9 as wn,aa as Hb,ab as Vb,ac as Bb,ad as Ne,ae as Wb,af as Mo,ag as Gb,ah as Nc,ai as Mc,aj as Lo,ak as Fo,al as Lc,am as Fc,an as Ac,f as zb,ao as Rc,ap as Kb,aq as qb,ar as Ao,as as ca,at as Yb,au as jc,av as Se,aw as Xb,ax as Zb,ay as Qb,az as kc,aA as Aa,aB as $c,aC as Uc,aD as Hc,aE as vt,aF as Jb,aG as Ot,aH as Vc,aI as Tn,aJ as eC,aK as Bc,aL as tC,aM as nC,I as Tr,aN as Wc,aO as rC,aP as iC,aQ as aC,aR as sC,aS as oC,aT as lC,aU as dC,aV as uC,aW as hC,aX as cC,aY as vC,aZ as fC,a_ as pC,a$ as mC,b0 as Yt,b as Ra,b1 as gC,b2 as bC,b3 as Gc,b4 as CC,b5 as SC,b6 as zc,b7 as yC,b8 as Ze,b9 as EC,ba as wC,bb as PC,bc as _C,bd as TC,be as OC,bf as DC,bg as IC,bh as xC,bi as NC,bj as aa,bk as MC,bl as LC,bm as FC,bn as AC,bo as si,bp as RC,bq as jC,br as kC,bs as Qr,bt as Kc,u as $C,a as UC}from"./useUser-206f2c8e.js";import{c as ps,P as Ro,b as HC,h as VC,p as BC,o as WC,s as GC,t as zC}from"./plotly-37fd1df1.js";import{e as jo,l as ki,K as oi,a as qc,_ as Yc}from"./monaco-0b69f16f.js";function Or(r){var e=r;r instanceof CustomEvent&&(e=r.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}var Xc=24,KC=32,qC=33,YC=150,$s=200,Zc=500,Qc=250,XC={spellCheck:!1},ZC=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange","tooltip"];function Jl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ed(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jl(Object(t),!0).forEach(function(n){QC(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Jl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function QC(r,e,t){return e=JC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JC(r){var e=eS(r,"string");return typeof e=="symbol"?e:String(e)}function eS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function tS(r,e){if(r==null)return{};var t=nS(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function nS(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Jc(r){var{ariaLabel:e,icon:t,isQuiet:n,labelText:i,children:a,onOpenChange:s,tooltip:o}=r,l=tS(r,ZC),d=i==null&&o!=null?"action-button-icon-with-tooltip":void 0;return u.jsxs(Hm,{type:"popover",onOpenChange:s,children:[u.jsxs(sc,ed(ed({},l),{},{"aria-label":e??i,isQuiet:n,children:[u.jsx(yo,{UNSAFE_className:d,children:u.jsx(ne,{icon:t})}),i==null?null:u.jsx(oc,{children:i}),o==null?null:u.jsx(wt,{children:o})]})),a]})}function rS(r,e){return r===0?0:e==="all"||r===e.size?"all":e.size}function ev(r,e){return r===e?!0:r==="all"||e==="all"||r.size!==e.size?!1:[...r.keys()].every(t=>e.has(t))}function tv(r,e){return r.isInverted===e.isInverted&&ev(r.selection,e.selection)}function nv(r,e,t){if(r==="all")return"all";var n=[...r.keys()];return new Set(n.map(i=>t(e(i))))}function rv(r,e){var t=r==="all"||r.size>e/2,n=r;return t&&(n=r==="all"?new Set:new Set([...pb(0,e-1)].filter(i=>!r.has(String(i))).map(i=>String(i)))),{selection:n,isInverted:t}}function iS(r,e){return r?{}:{errorMessage:e,validationState:"invalid"}}function iv(r){var e;return(e=r==null?void 0:r.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function aS(r){var e=r==null?void 0:r.UNSAFE_getDOMNode().lastElementChild;return av(e)}function sS(r){var e=r==null?void 0:r.UNSAFE_getDOMNode(),t=e==null?void 0:e.querySelector("input"),n=t==null?void 0:t.getAttribute("aria-controls"),i=n==null?null:document.getElementById(n);return i}function av(r){return r instanceof HTMLElement?r:null}function ko(){var r=c.useRef(!1);return c.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function td(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function oS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){td(a,n,i,s,o,"next",l)}function o(l){td(a,n,i,s,o,"throw",l)}s(void 0)})}}var lS=B.module("useAsyncInterval");function sv(r,e){var t=ko(),n=c.useRef(0),i=c.useRef(0),a=c.useRef(null),s=c.useCallback(oS(function*(){var o=Date.now();i.current+=1;var l=a.current==null?e:o-a.current;a.current=o;try{yield r()}catch(v){lS.error("A tick error occurred:",v)}if(t.current){l+=Date.now()-a.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);n.current=window.setTimeout(s,h)}}),[r,t,e]);c.useEffect(()=>(a.current=null,s(),()=>{window.clearTimeout(n.current)}),[e,s])}function dS(r,e){return c.useCallback(function(){var t=r(...arguments);return e(),t},[e,r])}function va(r,e){var t=c.useMemo(()=>Le(r,e),[r,e]);return c.useEffect(()=>()=>t.cancel(),[t]),t}function uS(r){var[e,t]=c.useState(!0);return c.useEffect(()=>{var n=setTimeout(()=>{t(!1)},r);return()=>{clearTimeout(n)}},[r]),e}function hS(r){var[e,t]=c.useState(r);return c.useEffect(()=>{t(r)},[r]),[e,t]}function cS(r,e,t,n){var i=c.useRef(0);c.useEffect(()=>{i.current>=t||n&&(i.current+=1,r())},[t,n,...e])}function ov(r,e){var t=c.useRef(r),n=e(t.current,r)?t.current:r;return t.current=n,n}function vS(r){r.preventDefault()}function lv(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=c.useMemo(()=>"useSubmitButtonRef-".concat(ye()),[]),t=c.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),n=c.useMemo(()=>({id:e,onSubmit:r?void 0:vS}),[e,r]),i=c.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:n,submitButtonProps:i}}function dv(r,e){return c.useCallback(t=>{typeof r=="function"?r(e(t)):r.current=e(t)},[e,r])}function uv(r,e){var{getItem:t,selectedKeys:n,items:i}=r;return c.useMemo(()=>{var{selection:a,isInverted:s}=rv(n,i.length);return{selection:nv(a,t,e),isInverted:s}},[n,i.length,t,e])}function fS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ug,t=c.useRef();return c.useEffect(()=>()=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t)},[]),c.useCallback(n=>{var i;(i=t.current)===null||i===void 0||i.call(t);var a=e(n);a&&(a.addEventListener("scroll",r),t.current=()=>{a.removeEventListener("scroll",r),t.current=void 0})},[e,r])}function nd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function pS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){nd(a,n,i,s,o,"next",l)}function o(l){nd(a,n,i,s,o,"throw",l)}s(void 0)})}}function mS(r,e,t){var n=c.useRef(null),[i,a]=c.useState(null),s=c.useCallback(pS(function*(){if(!(i==null||t==null)){var l=yield t();i.scroll(0,l)}}),[t,i]);c.useEffect(()=>(i==null||i.addEventListener("scroll",e),s(),()=>{i==null||i.removeEventListener("scroll",e)}),[e,i,s]);var o=c.useCallback(l=>{l&&setTimeout(()=>{a(r(n.current))},0)},[r]);return{ref:n,onOpenChange:o}}function rd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function gS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){rd(a,n,i,s,o,"next",l)}function o(l){rd(a,n,i,s,o,"throw",l)}s(void 0)})}}function hi(r,e){var{autoLoad:t=!0}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},[n,i]=c.useState(null),[a,s]=c.useState(null),[o,l]=c.useState(!1),d=c.useCallback(gS(function*(){l(!0);try{var h=yield r(...e);i(h),s(null)}catch(v){i(null),s(v)}finally{l(!1)}}),[r,...e]);return c.useEffect(()=>{t&&d()},[t,d]),{data:n,error:a,isError:a!=null,isLoading:o,reload:d}}function id(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ad(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?id(Object(t),!0).forEach(function(n){bS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):id(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bS(r,e,t){return e=CS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function CS(r){var e=SS(r,"string");return typeof e=="symbol"?e:String(e)}function SS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function yS(r,e,t,n){var i=arguments.length===4;return c.useCallback(a=>{var s=i?a??n:a;t(ad(ad({},r),{},{[e]:s}))},[t,r,e,i,n])}function hv(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=c.useRef(),i=c.useRef(0);return c.useCallback(a=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var s=Math.floor(a.target.scrollTop/r);i.current!==s&&(i.current=s,e(s))},t)},[t,r,e])}function wi(r,e){var[t,n]=c.useState(!0),[i,a]=c.useState(r),[s,o]=c.useState(r),[l,d]=c.useState(e);return(r!==s||e!==l)&&(n(!0),o(r),d(e)),c.useEffect(()=>{var h=!1,v=setTimeout(()=>{h||(n(!1),a(r))},e);return()=>{h=!0,clearTimeout(v)}},[r,e]),{isDebouncing:t,value:i}}function cv(r,e){return c.useCallback(t=>{if(t!=null){var n=e==null?[t]:t.querySelectorAll(e);n.forEach(i=>{Object.entries(r).forEach(a=>{var[s,o]=a;i.setAttribute(s,o)})})}},[r,e])}function ES(r){var e=cv(XC,r);return dv(e,iv)}function vv(){var{getKey:r=fv}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=c.useState([]),[n,i]=c.useState(()=>new Set),a=c.useCallback(m=>b=>r(b)===m,[r]),s=c.useCallback(m=>{var b;return(b=e.find(a(m)))!==null&&b!==void 0?b:null},[e,a]),o=c.useCallback(m=>{var b=s(m);if(b==null)throw new Error("No item found matching key: ".concat(m));return b},[s]),l=c.useCallback(m=>{t(b=>[...b,...m])},[]),d=c.useCallback((m,b)=>{t(g=>[...g.slice(0,m),...b,...g.slice(m)])},[]),h=c.useCallback(m=>{var b=new Set(m);t(g=>g.filter(C=>!b.has(r(C))))},[r]),v=c.useCallback((m,b)=>{var g=e.findIndex(a(m));g!==-1&&t(C=>[...C.slice(0,g),b,...C.slice(g+1)])},[e,a]),f=c.useCallback(m=>{if(m.size!==0){var b=[],g=new Map;for(var C of m.keys()){var y=e.findIndex(a(C));b.push(y),g.set(y,C)}b.sort((E,w)=>E-w);var S=[];e.forEach((E,w)=>{if(b[0]===w){var I=g.get(b.shift()),O=m.get(I);S.push(O)}else S.push(E)}),t(S)}},[e,a]),p=c.useMemo(()=>({items:e,selectedKeys:n,append:l,bulkUpdate:f,findItem:s,getItem:o,insert:d,remove:h,setItems:t,setSelectedKeys:i,update:v}),[l,f,s,o,d,e,h,t,n,v]);return p}function fv(r){var e=r!=null&&typeof r=="object"&&"key"in r;if(!e)throw new Error("Item does not have a `key` prop.");return r.key}function $o(r,e){c.useEffect(()=>{if(r!=null){var t=new window.ResizeObserver(e);return t.observe(r),()=>{r!=null&&t.unobserve(r)}}},[r,e])}const wS=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:iS,defaultGetKey:fv,extractSpectrumHTMLElement:iv,extractSpectrumLastChildHTMLElement:aS,findSpectrumComboBoxScrollArea:sS,getSelectedItemCountOrAll:rS,identityExtractHTMLElement:av,isSelectionEqual:ev,isSelectionMaybeInvertedEqual:tv,mapSelection:nv,optimizeSelection:rv,useAsyncInterval:sv,useCallbackWithAction:dS,useContextOrThrow:Rr,useCopyToClipboard:mb,useDebouncedCallback:va,useDebouncedValue:wi,useDelay:uS,useDependentState:hS,useEffectNTimesWhen:cS,useFormWithDetachedSubmitButton:lv,useForwardedRef:gb,useIsEqualMemo:ov,useIsMountedRef:ko,useMappedRef:dv,useMappedSelection:uv,useOnScrollOffsetChangeCallback:hv,useOnScrollRef:fS,usePopoverOnScrollRef:mS,usePrevious:Pc,usePromiseFactory:hi,usePropChangeCallback:yS,useResizeObserver:$o,useSetAttributesCallback:cv,useSpectrumDisableSpellcheckRef:ES,useWindowedListData:vv},Symbol.toStringTag,{value:"Module"})),PS="_spectrumActionBar_tmmkp_5",_S="_spectrumDialogComponentHeading_tmmkp_9",TS="_spectrumEllipsis_tmmkp_14",Uo={spectrumActionBar:PS,spectrumDialogComponentHeading:_S,spectrumEllipsis:TS};function sd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $i(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sd(Object(t),!0).forEach(function(n){OS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function OS(r,e,t){return e=DS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function DS(r){var e=IS(r,"string");return typeof e=="symbol"?e:String(e)}function IS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function pv(r){var{heading:e,confirmationButtonLabel:t,children:n,onCancel:i,onConfirm:a}=r,{formProps:s,submitButtonProps:o}=lv();return u.jsxs(Vm,{children:[u.jsx(lc,{level:3,UNSAFE_className:Uo.spectrumDialogComponentHeading,children:e}),u.jsx(Bm,{}),u.jsx(dc,{children:u.jsx(Wm,$i($i({},s),{},{children:n}))}),u.jsxs(Gm,{children:[u.jsx(zl,{variant:"secondary",onPress:i,children:"Cancel"}),u.jsx(zl,$i($i({},o),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function xS(r){var{ariaLabel:e,heading:t,confirmationButtonLabel:n,isHidden:i,children:a,tooltip:s,onConfirm:o}=r,l=c.useCallback(d=>u.jsx(pv,{heading:t,confirmationButtonLabel:n,onCancel:d,onConfirm:()=>{d(),o()},children:a}),[a,n,t,o]);return u.jsx(Jc,{ariaLabel:e,icon:Wn,isHidden:i,isQuiet:!0,height:Xc,tooltip:s,children:l})}var NS=["icon","label","tooltip"];function od(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ld(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?od(Object(t),!0).forEach(function(n){MS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):od(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function MS(r,e,t){return e=LS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function LS(r){var e=FS(r,"string");return typeof e=="symbol"?e:String(e)}function FS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function AS(r,e){if(r==null)return{};var t=RS(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function RS(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function mv(r){var{icon:e,label:t,tooltip:n}=r,i=AS(r,NS);return u.jsxs(sc,ld(ld({},i),{},{"aria-label":t,isQuiet:!0,height:Xc,children:[u.jsx(yo,{UNSAFE_className:n==null?void 0:"action-button-icon-with-tooltip",children:u.jsx(ne,{icon:e})}),n==null?null:u.jsx(wt,{children:n})]}))}mv.displayName="IconActionButton";function dd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function jS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dd(Object(t),!0).forEach(function(n){Qt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qt(r,e,t){return e=kS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kS(r){var e=$S(r,"string");return typeof e=="symbol"?e:String(e)}function $S(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var US=100,Us;(function(r){r.UP="UP",r.DOWN="DOWN"})(Us||(Us={}));class xt extends c.Component{constructor(e){super(e),Qt(this,"popper",void 0),Qt(this,"cbContainer",void 0),Qt(this,"menuContainer",void 0),Qt(this,"input",void 0),Qt(this,"getCachedFilteredOptions",ot((n,i)=>n.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=jS({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=Le(this.updateInputValue,US),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=X.createRef(),this.cbContainer=X.createRef(),this.menuContainer=X.createRef(),this.input=X.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,n=t.filter(i=>i.title.toLowerCase()===e.toLowerCase());return n.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:n[0].value,isValid:!0})}updateInputValue(e){var{menuIsOpen:t}=this.state,{value:n,isValid:i}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(n,i)}fireOnChange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{onChange:n}=this.props;n(e,t)}processFilterChange(e){var t,{options:n}=this.props,{menuIsOpen:i}=this.state,a=e?this.getCachedFilteredOptions(n,e):n,s=a.length===1&&a[0].title===e;if(this.setState({filteredOptions:a,keyboardOptionIndex:0}),s&&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:n,keyboardOptionIndex:i}=this.state,a=n[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(xt.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(xt.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(xt.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(xt.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){var{filteredOptions:t,keyboardOptionIndex:n}=this.state,i=n;e===xt.MENU_NAVIGATION_DIRECTION.UP?n>0?(i=(i-1)%t.length,this.setState({keyboardOptionIndex:i})):n===0&&(i=t.length-1,this.setState({keyboardOptionIndex:i})):e===xt.MENU_NAVIGATION_DIRECTION.DOWN&&n<t.length&&(i=(i+1)%t.length,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i)}handleInputKeyDown(e){var{onEnter:t}=this.props,{menuIsOpen:n}=this.state;n?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){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 n;(n=this.input.current)===null||n===void 0||n.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 u.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:n}=this.state;return t&&n.length===0?u.jsx("div",{className:"no-match",children:e}):n.map((i,a)=>this.renderOption(i,a))}renderOption(e,t){var{keyboardOptionIndex:n}=this.state,i="option-".concat(t,"-").concat(e.value);return u.jsx("button",{type:"button",className:Y("aci-option-btn",{"keyboard-active":n===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},i)}render(){var{options:e,inputPlaceholder:t,disabled:n,className:i,defaultTitle:a,spellCheck:s,"data-testid":o}=this.props,{title:l,menuIsOpen:d,popperOptions:h,invalid:v}=this.state;return u.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[u.jsx("input",{value:l||a,className:Y("form-control",i,"aci-input",{"is-invalid":v&&!d}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:n,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:s,"data-testid":o}),u.jsx(yi,{ref:this.popper,options:h,className:Y("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}Qt(xt,"propTypes",{options:_.arrayOf(_.shape({title:_.string.isRequired,value:_.string.isRequired})).isRequired,popperOptions:_.shape({}),onChange:_.func,inputPlaceholder:_.string,disabled:_.bool,className:_.string,defaultTitle:_.string,spellCheck:_.bool,onEnter:_.func,noMatchText:_.string,"data-testid":_.string});Qt(xt,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});Qt(xt,"MENU_NAVIGATION_DIRECTION",Us);const HS=xt;function Ho(r){var{className:e="",value:t,onChange:n,spellCheck:i=!1,placeholder:a="",disabled:s=!1,delimiter:o="",id:l="","data-testid":d}=r,[h,v]=c.useState(t),[f,p]=c.useState(!1),m=c.useRef(null);c.useEffect(function(){v(t)},[t]);function b(O){return O.trim().split(o).filter(T=>T).join(`
2
2
  `.concat(o.trim()))}function g(O){return O.split(`
3
- `).map(T=>T.trim()).join(" ")}function C(){if(m.current){m.current.style.height="0";var O=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);O>0&&(m.current.style.height="".concat(O,"px"))}}function y(O){var T=O.target.value;f&&(o&&(T=b(T)),p(!1)),c(T),n(T)}function S(){m.current&&(o&&(c(b(h)),C()),m.current.scrollLeft=0)}function E(){m.current&&document.activeElement!==m.current&&m.current.focus()}function w(){o&&(c(g(h)),n(g(h)))}function I(){p(!0)}return v.useEffect(function(){C()},[h]),u.jsx("textarea",{ref:m,id:l,className:Y(e,"auto-resize-textarea form-control"),placeholder:a,value:h,rows:1,onChange:y,onFocus:S,onMouseDown:E,onBlur:w,onPaste:I,spellCheck:i,disabled:s,"data-testid":d})}Ho.propTypes={value:_.string.isRequired,onChange:_.func.isRequired,className:_.string,placeholder:_.string,spellCheck:_.bool,disabled:_.bool,delimiter:_.string,id:_.string,"data-testid":_.string};Ho.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function Pi(r){var{children:e,className:t,style:n,"data-testid":i}=r;return u.jsx("div",{className:Y("btn-group",t),style:n,role:"group","data-testid":i,children:e})}Pi.displayName="ButtonGroup";Pi.propTypes={children:_.node.isRequired,className:_.string,style:_.object,"data-testid":_.string};Pi.defaultProps={className:null,style:{},"data-testid":void 0};function HS(r){var{blockInteraction:e=!0,children:t,debounceMs:n,isOpen:i=!1}=r,{value:a}=wi(i,n);return u.jsxs(u.Fragment,{children:[e&&i&&u.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),X.cloneElement(t,{isOpen:i&&a})]})}function VS(r){var{className:e,icon:t,isOpen:n=!1,subtitle:i,title:a}=r;return u.jsx(Ci,{isOpen:n,className:e,children:u.jsx(Si,{children:u.jsxs("div",{className:"info-modal",children:[t!=null&&u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:t})}),u.jsx("div",{className:"message-header",children:a}),i!=null&&u.jsx("div",{className:"message-content",children:i})]})})})}function ja(r){var{className:e="modal-footer",children:t,"data-testid":n}=r;return u.jsx("div",{className:e,"data-testid":n,children:t})}function _n(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:a,onDiscard:s,onModalDisable:o,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:f,"data-testid":p}=r,m=v.useRef(null),b=v.useRef(null),g=v.useCallback(()=>{b.current!==null&&b.current.checked&&o&&o(),a()},[a,o]),C=v.useCallback(()=>{var S;(S=m.current)===null||S===void 0||S.focus()},[]),y="";return e&&(y=typeof n=="function"?n():n),u.jsxs(Ci,{isOpen:e,onOpened:C,children:[u.jsx(Na,{closeButton:!1,children:t}),u.jsx(Si,{children:y}),u.jsxs(ja,{children:[o&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:b,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),s&&u.jsx(K,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:s,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:h}),i&&u.jsx(K,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),u.jsxs(Pi,{children:[u.jsx(K,{kind:c?"danger":"primary",onClick:g,ref:m,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:d}),f]})]})]})}_n.propTypes={isOpen:_.bool.isRequired,headerText:_.string.isRequired,bodyText:_.oneOfType([_.string,_.func]).isRequired,onCancel:_.func,onConfirm:_.func.isRequired,onDiscard:_.func,onModalDisable:_.func,cancelButtonText:_.string,confirmButtonText:_.string,discardButtonText:_.string,children:_.node,"data-testid":_.string};_n.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var ka=X.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,onClick:a,style:s,id:o}=r;return u.jsx("button",{ref:e,type:"button",className:Y("btn",n),onClick:a,style:s,disabled:i,id:o,children:t})});ka.displayName="Button";ka.propTypes={children:_.node,className:_.string,disabled:_.bool,onClick:_.func,style:_.shape({}),id:_.string};ka.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Hs=ka;function ud(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ud(Object(t),!0).forEach(function(n){BS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ud(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function BS(r,e,t){return e=WS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WS(r){var e=GS(r,"string");return typeof e=="symbol"?e:String(e)}function GS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function zS(r){var{styleProps:e,selectedItemCount:t,onClearSelection:n}=r;return u.jsx(zm,hd(hd({UNSAFE_className:Uo.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:n}))}function $a(r){var{className:e,isFlipped:t,children:n,"data-testid":i}=r,a=d=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[d]},s=v.useRef(null),o=v.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=v.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return v.useEffect(function(){if(!s.current)throw Error("ref undefined");s.current.addEventListener("transitionstart",o);var h=s.current;return function(){if(h!=null)return h.removeEventListener("transitionstart",o)}},[o]),u.jsxs("div",{className:Y(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[u.jsx("div",{className:"card-flip--back",children:a(0)}),u.jsx("div",{ref:s,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}function gv(r,e,t){return e=KS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function KS(r){var e=qS(r,"string");return typeof e=="symbol"?e:String(e)}function qS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ut extends v.Component{static handleEnter(e){var t=e;t.style.height="0"}static handleEntering(e){var t=e;t.style.height="".concat(Ut.getHeight(t),"px")}static handleExiting(e){var t=e;t.style.height="0"}static handleExit(e){var t=e;t.style.height="".concat(Ut.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:n}=this.props;if(n!==void 0&&n){var i=t.querySelector("input, select, textarea");i!=null&&i.focus()}}render(){var{children:e,className:t,in:n,"data-testid":i}=this.props;return u.jsx(Hn,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ut.handleEnter,onEntering:Ut.handleEntering,onEntered:this.handleEntered,onExit:Ut.handleExit,onExiting:Ut.handleExiting,timeout:350,children:a=>u.jsx("div",{className:Y({collapse:a==="exited"},t),"data-testid":i,children:e})})}}gv(Ut,"propTypes",{className:_.string,in:_.bool.isRequired,children:_.node.isRequired,autoFocusOnShow:_.bool,"data-testid":_.string});gv(Ut,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const YS=Ut;var XS=B.module("TimeInput"),ZS="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",QS=["00:00:00","12:34:56","23:59:59"];function cd(r){return r!=null?"".concat(r.substring(0,8).replace(/\u2007/g,"0")).concat("00:00:00".substring(r.length)):r}var bv=X.forwardRef((r,e)=>{var{allowValueWrapping:t=!0,className:n="",onChange:i=()=>!1,value:a=0,onFocus:s=()=>!1,onBlur:o=()=>!1,onSelect:l=()=>!1,"data-testid":d}=r,[h,c]=v.useState(vr.formatTime(a)),f=v.useRef(a),[p,m]=v.useState(),b=v.useRef(null);v.useImperativeHandle(e,()=>({focus:()=>{var w;(w=b.current)===null||w===void 0||w.focus()},setSelection:w=>{var I;(I=b.current)===null||I===void 0||I.focus(),m(w)}}),[]),v.useEffect(function(){f.current!==a&&(c(vr.formatTime(a)),f.current=a)},[f,a]);function g(w,I,O){var T=w.selectionStart===0?24:60,N=parseInt(O,10)-I;return Number.isNaN(N)?N=0:t?N=(N%T+T)%T:N=Math.min(Math.max(0,N),T-1),"".concat(N).padStart(2,"0")}function C(w,I,O,T,N){return T===0&&N===2&&I===1&&parseInt(O,10)>1?"0".concat(O).concat(w.substring(2)):_c(w,I,O)}var y=v.useCallback(w=>{XS.debug("handleChange",w),c(w),f.current=vr.parseTime(cd(w)),i(f.current)},[i]),S=v.useCallback(()=>{var w=cd(h);w!==h&&c(w),o()},[h,o]),E=v.useCallback(w=>{m(w),l(w)},[l]);return u.jsx(Do,{ref:b,className:n,example:QS,getNextSegmentValue:g,getPreferredReplacementString:C,onChange:y,onSelect:E,pattern:ZS,selection:p,value:h,onFocus:s,onBlur:S,"data-testid":d})});bv.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const fa=bv;function vd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function JS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vd(Object(t),!0).forEach(function(n){Sn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Sn(r,e,t){return e=ey(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ey(r){var e=ty(r,"string");return typeof e=="symbol"?e:String(e)}function ty(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fd=-1,Vs;(function(r){r.UP="UP",r.DOWN="DOWN"})(Vs||(Vs={}));class ut extends v.Component{constructor(e){super(e),Sn(this,"csContainer",void 0),Sn(this,"menuContainer",void 0),Sn(this,"button",void 0),Sn(this,"input",void 0);var{value:t,valueToTime:n}=e;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=X.createRef(),this.menuContainer=X.createRef(),this.button=X.createRef(),this.input=X.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}getSelectedText(){var{options:e,value:t,placeholder:n}=this.props,{customTime:i}=this.state;if(t===null)return n;for(var a=0;a<e.length;a+=1){var s=e[a];if(s.value===t)return s.title}return vr.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:n,inputFocused:i}=this.state,{options:a}=this.props;switch(e.key){case"Enter":case" ":i?this.updateFromCustom():this.updateInputValue(a[n].value),this.closeMenu(),(t=this.button.current)===null||t===void 0||t.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){var{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:i}=this.props,a=i.length,s=t;switch(e){case ut.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(s=(s-1)%a,this.setState({keyboardOptionIndex:s})):t===0&&(s=a-1,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s);break;case ut.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===a-1){this.focusInput();break}else n&&this.focusOption(t);t<a&&!(n&&t===0)&&(s=(s+1)%a,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s);break}}handleOptionClick(e){var t=Number(e.currentTarget.value),{options:n,timeToValue:i}=this.props,{customTime:a}=this.state;if(t===fd){var s=i(a);this.updateAndClose(s)}else this.updateAndClose(n[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:n}=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(),n!==null){var s=t.map(o=>o.value).indexOf(n);s<0&&this.focusInput()}}focusInput(){var e;(e=this.input.current)===null||e===void 0||e.focus()}focusOption(e){var t,n=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(n&&n.children!=null){var i=n.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,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){var{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}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 n=e.map(i=>i.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}}scrollOptionIntoView(e){var t,n=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(n&&n.children!=null){var i=n.children.item(e);i instanceof HTMLElement&&i.offsetTop>ut.DROP_DOWN_MENU_HEIGHT?n.scrollTop=i.offsetTop-ut.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(n.scrollTop=0)}}renderMenuElement(){var{inputWidth:e}=this.state;return u.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:u.jsx("div",{className:"cs-options-container",children:u.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){for(var{options:e,value:t,icon:n,customText:i}=this.props,{keyboardOptionIndex:a,customTime:s,inputFocused:o}=this.state,l=!1,d=[],h=0;h<e.length;h+=1){var c=e[h],f="option-".concat(h,"-").concat(c.value);l=l||c.value===t,d.push(u.jsxs("button",{type:"button",value:h,className:Y("cs-option-btn",{"keyboard-active":a===h&&!o}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[c.value===t&&u.jsx(ne,{icon:n,className:"mr-2"}),c.value!==t&&u.jsx("span",{className:"mr-4"}),c.title]},f))}return d.push(u.jsx("hr",{className:"cs-divider"},"option-divider")),d.push(u.jsxs("button",{type:"button",value:fd,className:Y("cs-option-btn",{"keyboard-active":o}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?u.jsx(ne,{icon:n,className:"mr-2"}):u.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),d.push(u.jsxs("div",{className:"cs-custom-container",children:[u.jsx("span",{className:"mr-2"}),u.jsx(fa,{ref:this.input,onChange:this.handleCustomInput,value:s,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),u.jsx("span",{className:"ml-2"})]},"cs-custom-container")),d.push(u.jsx("hr",{className:"mb-2"},"option-end")),d}render(){var{disabled:e,invalid:t,value:n,"data-testid":i}=this.props,{menuIsOpen:a}=this.state,{popperOptions:s}=this.props;return s=JS({placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}}},s),u.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:u.jsx("div",{className:Y("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:u.jsxs("button",{type:"button",className:Y("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[u.jsx("span",{className:Y({"text-muted":n===null}),children:this.getSelectedText()}),u.jsx("span",{className:"cs-caret"}),u.jsx(En,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:s,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}Sn(ut,"MENU_NAVIGATION_DIRECTION",Vs);Sn(ut,"DROP_DOWN_MENU_HEIGHT",125);Sn(ut,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:cr,customText:"Custom",placeholder:"Select a time",valueToTime:r=>r===null?0:Math.round(r/1e3),timeToValue:r=>r*1e3,invalid:!1,"data-testid":void 0});const ny=ut;var ry=B.module("DateInput"),iy="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",ay=["2000-01-01","2022-12-31"],sy="YYYY-MM-DD",Cv=X.forwardRef((r,e)=>{var{className:t="",onChange:n=()=>{},defaultValue:i="",onFocus:a=()=>{},onBlur:s=()=>{},"data-testid":o}=r,[l,d]=v.useState(i),[h,c]=v.useState(),f=v.useCallback(p=>{ry.debug("handleChange",p),d(p),n(p)},[n]);return u.jsx("div",{className:"d-flex flex-row align-items-center",children:u.jsx(Do,{ref:e,className:Y(t),example:ay,getNextSegmentValue:bb,onChange:f,onSelect:c,pattern:iy,placeholder:sy,selection:h,value:l,onFocus:a,onBlur:s,"data-testid":o})})});Cv.displayName="DateInput";const oy=Cv;function Sv(r,e,t){return e=ly(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ly(r){var e=dy(r,"string");return typeof e=="symbol"?e:String(e)}function dy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yv extends v.PureComponent{constructor(e){super(e),Sv(this,"searchInput",void 0),this.searchInput=X.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Le(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:n,id:i,"data-testid":a}=this.props,{value:s}=this.state;return u.jsx(Ei,{value:s,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":a})}}Sv(yv,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Ev=yv;function uy(r){var{isInvalid:e=!1,items:t,onAdd:n=()=>{},onDelete:i=()=>{},validate:a=()=>null}=r,[s,o]=v.useState(null),[l,d]=v.useState([]),[h,c]=v.useState(""),f=v.useCallback(S=>{d(S)},[]),p=v.useCallback(()=>{i(ua.getItemsInRanges(t,l)),d([])},[t,l,i]),m=v.useCallback(()=>{if(h!==""){var S=a(h);S==null?(n(h),c("")):o(S)}},[h,n,a]),b=v.useCallback(S=>{var{value:E}=S.target;c(E),o(E===""?null:a(E))},[a]),g=v.useCallback(()=>{d([])},[]),C=v.useCallback(S=>{S.key==="Enter"&&m()},[m]),y=v.useMemo(()=>14+ar(t.length,1,6)*wr.DEFAULT_ROW_HEIGHT,[t.length]);return u.jsxs("div",{className:Y("editable-item-list-container",{"is-invalid":e}),children:[u.jsx("div",{style:{height:y},children:u.jsx(wr,{itemCount:t.length,items:t.map((S,E)=>({value:S,isSelected:ua.isSelected(l,E)})),offset:0,selectedRanges:l,onSelectionChange:f,isMultiSelect:!0})}),u.jsxs("div",{className:"d-flex flex-row pt-2",children:[u.jsx("div",{className:"d-flex flex-grow-1",children:u.jsx("input",{className:Y("form-control",{"is-invalid":s!=null}),placeholder:"Enter value",type:"text",value:h,onChange:b,onFocus:g,onKeyDown:C})}),u.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[u.jsx(K,{kind:"ghost",onClick:m,disabled:s!=null||h==="",icon:hg,tooltip:"Add new item","data-testid":"add-item-button"}),u.jsx(K,{kind:"ghost",onClick:p,disabled:l.length===0,icon:Wn,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}var hy=B.module("ErrorBoundary");class cy extends v.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:n}=this.props;hy.error("Error caught by ErrorBoundary",e,t),n==null||n(e,t)}render(){var{children:e,className:t,fallback:n}=this.props,{error:i}=this.state;return i!=null?n??u.jsx("div",{className:t,children:u.jsx(He,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function vy(r,e,t){return e=fy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fy(r){var e=py(r,"string");return typeof e=="symbol"?e:String(e)}function py(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fr extends v.Component{static isParentSelected(e,t){var n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;var i=Array.from(n.values()).includes(!0),a=Array.from(n.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:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){var{valueMap:n,onUpdateValueMap:i}=this.props,a=new Map(n),s=a.get(e);if(s instanceof Map){var o=new Map(s);if(t!=null)o.set(t,s.get(t)===void 0);else{var l=fr.isParentSelected(e,a),d=l==null||!l;s.forEach((f,p)=>o.set(p,d))}a.set(e,o)}else a.set(e,s==null||!s);var h=a.get(e);if(t===void 0&&h!==void 0&&typeof h!="boolean"){var c=fr.isParentSelected(e,n);c!=null&&c?h.forEach((f,p)=>h.set(p,!1)):h.forEach((f,p)=>h.set(p,!0))}i(a)}setAllValues(e){var{valueMap:t,onUpdateValueMap:n}=this.props,i=new Map;t.forEach((a,s)=>{if(typeof a=="boolean")i.set(s,e);else{var o=new Map;a.forEach((l,d)=>o.set(d,e)),i.set(s,o)}}),n(i)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){var{valueMap:e,"data-testid":t}=this.props;return u.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(n=>{var[i,a]=n;return u.jsxs("div",{children:[u.jsx(ha,{className:"hcm-parent",checked:fr.isParentSelected(i,e),onChange:()=>this.toggleValueFor(i),children:i}),a!==void 0&&typeof a!="boolean"&&Array.from(a.entries()).map(s=>{var[o,l]=s;return u.jsx(ha,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(i,o),children:o},o)})]},i)}),u.jsx(K,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?"".concat(t,"-btn-select-all"):void 0,children:"Select All"}),u.jsx(K,{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:n,id:i,"data-testid":a}=this.props,{menuIsOpen:s}=this.state;return u.jsxs("button",{type:"button",className:Y("btn hcm-btn",t),onClick:this.toggleMenu,id:i,"data-testid":a,children:[u.jsxs("span",{children:[n&&u.jsx(ne,{icon:n,className:"hcm-icon mr-1"}),e]}),u.jsx("span",{className:"cs-caret"}),u.jsx(yi,{options:{placement:"bottom"},isShown:s,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}vy(fr,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const my=fr;function pd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ms(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pd(Object(t),!0).forEach(function(n){gy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function gy(r,e,t){return e=by(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function by(r){var e=Cy(r,"string");return typeof e=="symbol"?e:String(e)}function Cy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wv=v.memo(r=>{var{tab:e,onClose:t,onSelect:n,isActive:i,activeRef:a,index:s,isDraggable:o,contextActions:l}=r,{key:d,isClosable:h=t!=null,title:c}=e;return u.jsx(Km,{draggableId:d,index:s,isDragDisabled:!o,children:(f,p)=>u.jsxs("div",{className:"context-menu-wrapper",ref:i?a:null,children:[u.jsxs("div",ms(ms(ms({ref:f.innerRef},f.draggableProps),f.dragHandleProps),{},{className:Y("btn btn-link btn-nav-tab",{active:i},{dragging:p.isDragging}),"data-testid":"btn-nav-tab-".concat(c),role:"tab",tabIndex:0,onClick:m=>{m.target.focus(),n(d)},onKeyPress:m=>{m.key==="Enter"&&n(d)},children:[c,h&&u.jsx(K,{kind:"ghost",className:"btn-nav-tab-close",onClick:m=>{t==null||t(d),m.stopPropagation(),m.preventDefault()},icon:wo,tooltip:"Close"})]})),u.jsx(ae,{actions:l})]})},d)});wv.displayName="NavTab";const Sy=wv;function md(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?md(Object(t),!0).forEach(function(n){yy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):md(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yy(r,e,t){return e=Ey(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r){var e=wy(r,"string");return typeof e=="symbol"?e:String(e)}function wy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Py=500,_y=.01,Ty=5e-4;function bd(r){return r.scrollLeft===0}function Cd(r){return r.scrollLeft+r.clientWidth===r.scrollWidth||r.scrollWidth===0}function Oy(r,e,t){var{isClosable:n=!1,key:i}=r,a=[];if(n&&t!=null){a.push({title:"Close",order:10,group:20,action:()=>{t(i)}});for(var s=!0,o=e.length-1;o>0&&e[o].key!==r.key;o-=1)if(e[o].isClosable===!0){s=!1;break}a.push({title:"Close to the Right",order:20,group:20,action:()=>{for(var l=e.length-1;l>0&&e[l].key!==i;l-=1)e[l].isClosable===!0&&t(e[l].key)},disabled:s}),a.push({title:"Close All",order:30,group:20,action:()=>{e.forEach(l=>{l.isClosable===!0&&t(l.key)})}})}return a}function Dy(r){var{activeKey:e,tabs:t,onSelect:n,onReorder:i,onClose:a,makeContextActions:s}=r,o=v.useRef(),[l,d]=v.useState(!0),[h,c]=v.useState(!0),[f,p]=v.useState(!0),m=v.useCallback(()=>{o.current!=null&&(o.current.clientWidth<o.current.scrollWidth&&t.length>0?d(!0):d(!1),c(bd(o.current)),p(Cd(o.current)))},[t]);$o(o.current,m);var b=v.useCallback(D=>{js.stopDragging(),D.destination&&(i==null||i(D.source.index,D.destination.index))},[i]),g=v.useCallback(()=>{if(o.current!=null){var D=bd(o.current);D!==h&&c(D);var M=Cd(o.current);M!==f&&p(M)}},[h,f]),C=v.useRef({cancelClick:!1}),y=v.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:D}=o.current,M=D.length-1;M>=0;M-=1){var F=D[M];if(F.offsetLeft<o.current.scrollLeft-5){F.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"});return}}},[]),S=v.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:D}=o.current,M=0;M<D.length;M+=1){var F=D[M];if(F.offsetLeft+5>o.current.scrollLeft+o.current.offsetWidth){F.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"});return}}},[]),E=v.useCallback(function(D,M){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3?arguments[3]:void 0,H=o.current;H!=null&&(C.current.cancelClick=!0,D==="left"?H.scrollLeft=M-F:D==="right"&&(H.scrollLeft=M+F),C.current.rAF=requestAnimationFrame(q=>{var re=k??q,V=q-re,x=_y*V+.5*Ty*V**2;x=Math.min(x,H.scrollWidth),E(D,M,x,re)}))},[]),w=v.useCallback(()=>{var{holdTimer:D,rAF:M}=C.current;D!=null&&(clearTimeout(D),C.current.holdTimer=void 0),M!=null&&(cancelAnimationFrame(M),C.current.rAF=void 0),window.removeEventListener("mouseup",w)},[]);v.useEffect(()=>()=>window.removeEventListener("mouseup",w),[w]);var I=v.useCallback(D=>{o.current!=null&&(C.current.holdTimer=window.setTimeout(E,Py,D,o.current.scrollLeft)),C.current.cancelClick=!1,window.addEventListener("mouseup",w)},[w,E]),O=v.useCallback(()=>{I("left")},[I]),T=v.useCallback(()=>{I("right")},[I]);v.useEffect(function(){var M,F=k=>{k.stopPropagation(),k.preventDefault();var H=k.currentTarget,q=Math.abs(k.deltaY)>Math.abs(k.deltaX)?k.deltaY:k.deltaX;H.scrollLeft+=ar(q,-30,30)};return(M=o.current)===null||M===void 0||M.addEventListener("wheel",F),()=>{var k;(k=o.current)===null||k===void 0||k.removeEventListener("wheel",F)}},[]);var N=v.useMemo(()=>{var D=new Map;return t.forEach(M=>{var{key:F}=M,k=[()=>Oy(M,t,a),()=>{var H;return(H=s==null?void 0:s(M))!==null&&H!==void 0?H:[]}];D.set(F,k)}),D},[s,t,a]),R=v.useRef(null),W=t.find(D=>D.key===e),L=t.map((D,M)=>{var{key:F}=D,k=D===W;return u.jsx(Sy,{tab:D,index:M,isActive:k,activeRef:R,onSelect:n,onClose:a,isDraggable:i!=null,contextActions:N.get(F)},F)});return v.useEffect(function(){R.current!=null&&R.current.scrollIntoView({block:"nearest",inline:"nearest"})},[e]),u.jsxs("nav",{className:"nav-container",children:[l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:cg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-left",tooltip:"Scroll left",onClick:y,onMouseDown:O,disabled:h}),u.jsx(qm,{onDragStart:js.startDragging,onDragEnd:b,children:u.jsx(Ym,{droppableId:"droppable-tab-navigation",direction:"horizontal",children:(D,M)=>u.jsxs("div",gd(gd({ref:F=>{F!=null&&(o.current=F,D.innerRef(F))}},D.droppableProps),{},{className:Y("nav nav-tabs",{dragging:M.draggingFromThisWith}),role:"tablist",onScroll:g,children:[L,D.placeholder]}))})}),l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:vg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-right",tooltip:"Scroll right",onClick:S,onMouseDown:T,disabled:f})]})}function Iy(){var{selectedThemeKey:r,setSelectedThemeKey:e,themes:t}=jr(),n=v.useCallback(i=>{e(i)},[e]);return u.jsx(Xm,{label:"Pick a color scheme",items:t,selectedKey:r,onSelectionChange:n,children:i=>u.jsx(uc,{children:i.name},i.themeKey)})}function xy(r){var{className:e,style:t}=r;return u.jsx("div",{className:Y("dh-logo",e),style:t})}var Ny=.025,My=.9,Ly=.1,Fy=.618,Sd=80,Jn={SIZE:8,DOT_SIZE:2},sn=18,Ay=250,Ry=60*1e3,jy={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 ky(){return Po(jy)}var $y=X.memo(()=>{var{activeThemes:r}=jr(),e=v.useMemo(ky,[r]),t=v.useRef(null),n=v.useRef(null),[i,a]=v.useState(!1),s=window.devicePixelRatio,o,l,d,h,c,f=null,p=[];function m(){var L;n.current!=null&&(d=n.current.offsetWidth,h=n.current.offsetHeight),t.current!=null&&(t.current.style.width="".concat(d,"px"),t.current.style.height="".concat(h,"px"),t.current.width=d*s,t.current.height=h*s),(L=o)===null||L===void 0||L.scale(s,s)}function b(){var{foregroundFill:L,foregroundStroke:D}=e,M=document.createElement("canvas");M.width=Jn.SIZE,M.height=Jn.SIZE;var F=M.getContext("2d");return F!=null&&(F.fillStyle=D,F.fillRect(0,0,Jn.DOT_SIZE,Jn.DOT_SIZE),F.fillStyle=L,F.fillRect(0,0,Jn.SIZE,Jn.SIZE)),F==null?void 0:F.createPattern(M,"repeat")}function g(L){var D=Math.random()-.5,M=Ny*D;return L<Ly?M=Math.abs(M):L>My&&(M=-Math.abs(M)),L+M}function C(){for(var L=[],D=Fy,M=0;M<d+sn;M+=1)D=g(D),L.push(D);return L}function y(){for(;p.length>=d+sn;)p.pop();for(;p.length<d+sn;)p.push(g(p[p.length-1]))}function S(L,D){D.beginPath(),D.moveTo(-1,h+1),D.lineTo(-1,h*L[0]);for(var M=0;M<L.length;M+=1)D.lineTo(M,h*L[M]);D.lineTo(d+sn,h*L[L.length-1]),D.lineTo(d+sn,h+1),D.closePath()}function E(L){L.beginPath();for(var D=1;D<d;D+=Sd)L.moveTo(D,0),L.lineTo(D,h);for(var M=1;M<h;M+=Sd)L.moveTo(0,M),L.lineTo(d,M)}function w(L){var D,M,F;f=(D=f)!==null&&D!==void 0?D:L;var{background:k,foregroundStroke:H,gridColor:q}=e;z(o),o.fillStyle=k,o.fillRect(0,0,d,h),E(o),o.lineWidth=1,o.strokeStyle=q,o.stroke();var re=(((M=f)!==null&&M!==void 0?M:0)-(L??0))/(1e3/sn);if(o.translate(re,0),S(p,o),o.lineWidth=2,o.strokeStyle=H,o.stroke(),o.translate(-re,0),l!=null&&(o.fillStyle=l),o.fill(),o.setTransform(s,0,0,s,0,0),(L??0)-((F=f)!==null&&F!==void 0?F:0)>1e3/sn){for(var V,x=Math.floor(((L??0)-((V=f)!==null&&V!==void 0?V:0))/(1e3/sn)),P=0;P<x;P+=1)p.shift(),p.push(g(p[p.length-1]));f=L}c!=null&&cancelAnimationFrame(c),c=requestAnimationFrame(w)}var I=Le(()=>{c=requestAnimationFrame(L=>{m(),y(),a(!1),w(L)})},Ay,{leading:!0});function O(){a(!0),c!=null&&cancelAnimationFrame(c),c=null,f=null}var T=Le(()=>{O()},Ry);function N(){c==null&&(a(!1),m(),y(),c=requestAnimationFrame(w)),T()}function R(){document.hasFocus()&&N()}function W(){c!=null&&cancelAnimationFrame(c),T(),I()}return v.useEffect(()=>{var L;return o=(L=t.current)===null||L===void 0?void 0:L.getContext("2d",{alpha:!1}),m(),p=C(),l=b(),w(),T(),window.addEventListener("resize",W),window.addEventListener("focus",N),window.addEventListener("blur",O),window.addEventListener("mousemove",R),window.addEventListener("keydown",R),()=>{c!=null&&cancelAnimationFrame(c),window.removeEventListener("resize",W),window.removeEventListener("focus",N),window.removeEventListener("blur",O),window.removeEventListener("mousemove",R),window.removeEventListener("keydown",R),T.cancel(),I.cancel()}},[e]),u.jsx("div",{className:"random-area-plot-animation-container",ref:n,children:u.jsx("canvas",{ref:t,className:i?"shade":""})})});const Pv=$y;function _v(r){var{text:e,placement:t="top-start"}=r,n=v.useMemo(()=>({placement:t}),[t]);return u.jsxs(u.Fragment,{children:[u.jsx(oc,{UNSAFE_className:Uo.spectrumEllipsis,children:e??u.jsx(u.Fragment,{children:" "})}),e==null||e===""?null:u.jsx(wt,{options:n,children:e})]})}var Uy=["scrollRef","getItemDisplayText","getKey"];function yd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ed(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yd(Object(t),!0).forEach(function(n){Hy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hy(r,e,t){return e=Vy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vy(r){var e=By(r,"string");return typeof e=="symbol"?e:String(e)}function By(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Wy(r,e){if(r==null)return{};var t=Gy(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function Gy(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function zy(r){var{scrollRef:e,getItemDisplayText:t,getKey:n}=r,i=Wy(r,Uy),a=v.useCallback(s=>{var o=n(s),l=t(s);return u.jsx(uc,{textValue:l??String(o),children:u.jsx(_v,{text:l})},o)},[t,n]);return u.jsx(Zm,Ed(Ed({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var Vo=X.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,id:a,isLinked:s,isLinkedSource:o,isInvalid:l,onClick:d,onMouseEnter:h,onMouseLeave:c,style:f,"data-testid":p}=r;return u.jsxs("button",{ref:e,type:"button",className:Y("btn-socketed",{"btn-socketed-linked":s!==void 0&&s||o},{"btn-socketed-linked-source":o},{"is-invalid":l},n),id:a,onClick:d,onMouseEnter:h,onMouseLeave:c,style:f,disabled:i,"data-testid":p,children:[t,u.jsx(ne,{icon:fg,className:"linked btn-socketed-icon",transform:"down-1"}),u.jsx(ne,{icon:pg,className:"is-invalid btn-socketed-icon"})]})});Vo.displayName="SocketedButton";Vo.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 Bo=Vo;var Ky=500;function qy(r){var{heading:e,content:t,delayMs:n=Ky}=r,[i,a]=v.useState(!1);return v.useEffect(()=>{window.setTimeout(()=>{a(!0)},n)},[n]),i?u.jsxs(Qm,{children:[u.jsx(yo,{size:"XXL",children:u.jsx(ne,{icon:mg})}),u.jsx(lc,{children:e}),t==null?null:u.jsx(dc,{children:t})]}):null}const Yy="_modified_5rbci_24",Xy="_track_5rbci_35",Zy="_handle_5rbci_15",Qy="_ticks_5rbci_103",Tv={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_5rbci_5","time-slider-popovers":"_time-slider-popovers_5rbci_10","handle-popper":"_handle-popper_5rbci_15",modified:Yy,"flex-spacer":"_flex-spacer_5rbci_31",track:Xy,"track-fills":"_track-fills_5rbci_42","track-fill":"_track-fill_5rbci_42","track-fill-start":"_track-fill-start_5rbci_60","track-fill-middle":"_track-fill-middle_5rbci_61","track-fill-end":"_track-fill-end_5rbci_64","handle-track":"_handle-track_5rbci_67",handle:Zy,ticks:Qy,"tick-labels":"_tick-labels_5rbci_121","tick-label":"_tick-label_5rbci_121","tick-label-wrapper":"_tick-label-wrapper_5rbci_137"};var Ui=parseInt(Tv["handle-size"],10),wd=parseInt(Tv["popover-width"],10),ft=24*60*60-1,Pd=5*60;function Jy(r){var{startTime:e,endTime:t,onChange:n,isStartModified:i=!1,isEndModified:a=!1,"data-testid":s}=r,[o,l]=v.useState(e),[d,h]=v.useState(t),c=v.useRef(null);v.useEffect(function(){l(e),h(t)},[e,t]);var f=v.useCallback((b,g)=>{var C=b,y=g;C===y&&(y<ft?y+=1:C-=1),l(C),h(y),n({startTime:C,endTime:y})},[l,h,n]),p=v.useCallback(b=>{f(b,d)},[f,d]),m=v.useCallback(b=>{f(o,b)},[f,o]);return u.jsxs("div",{className:"time-slider","data-testid":s,children:[u.jsx(eE,{startTime:o,endTime:d,onStartTimeChange:p,onEndTimeChange:m,isStartModified:i,isEndModified:a}),u.jsxs("div",{className:"track",ref:c,children:[u.jsx(tE,{startTime:o,endTime:d}),u.jsx("div",{className:"ticks",children:Array(24).fill(null).map((b,g)=>u.jsx("div",{className:"tick"},g))}),u.jsx(_d,{track:c,time:o,setTime:p}),u.jsx(_d,{track:c,time:d,setTime:m})]}),u.jsxs("div",{className:"tick-labels",children:[u.jsx("div",{className:"tick-label",children:"0:00"}),u.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((b,g)=>u.jsx("div",{className:"tick-label",children:"".concat(g+1,":00")},g))})]})]})}function eE(r){var{startTime:e,endTime:t,onStartTimeChange:n,onEndTimeChange:i,isStartModified:a,isEndModified:s,"data-testid":o}=r,l=e>t,[d,h]=v.useState(l?t:e),[c,f]=v.useState(l?e:t),p=v.useRef(null),m=v.useRef(null),b=v.useRef(null),g=v.useRef(null);v.useEffect(function(){h(e>t?t:e),f(e>t?e:t)},[e,t]),v.useEffect(function(){if(b.current!==null){var I;(I=m.current)===null||I===void 0||I.setSelection(b.current)}if(g.current!==null){var O;(O=p.current)===null||O===void 0||O.setSelection(g.current)}},[l]);function C(w){e<=t?n(w):i(w)}function y(w){e<=t?i(w):n(w)}var S=v.useCallback(w=>{b.current=w,g.current=null},[]),E=v.useCallback(w=>{b.current=null,g.current=w},[]);return u.jsxs("div",{className:"time-slider-popovers",children:[u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(d/ft*100,"% - ").concat(wd/2,"px)")}}),u.jsxs("div",{className:"handle-popper",children:[u.jsx("label",{className:Y({modified:l?s:a}),children:l?"End Time":"Start Time"}),u.jsx(fa,{ref:p,allowValueWrapping:!1,value:d,onChange:C,onSelect:S,"data-testid":o!==void 0?"".concat(o,"-input-1"):void 0})]}),u.jsx("div",{className:"flex-spacer"}),u.jsxs("div",{className:"handle-popper",children:[u.jsx("label",{className:Y({modified:l?a:s}),children:l?"Start Time":"End Time"}),u.jsx(fa,{ref:m,allowValueWrapping:!1,value:c,onChange:y,onSelect:E,"data-testid":o!==void 0?"".concat(o,"-input-2"):void 0})]}),u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat((ft-c)/ft*100,"% - ").concat(wd/2,"px)")}})]})}function tE(r){var{startTime:e,endTime:t,"data-testid":n}=r;return u.jsxs("div",{className:"track-fills","data-testid":n,children:[e>t&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"track-fill track-fill-start",style:{transform:"scaleX(".concat(t/ft,")")}}),u.jsx("div",{className:"track-fill track-fill-end",style:{transform:"scaleX(".concat((ft-e)/ft,")")}})]}),e<t&&u.jsx("div",{className:"track-fill track-fill-middle",style:{transform:"translateX(".concat(e/ft*100,"%) scaleX(").concat((t-e)/ft,")")}})]})}function _d(r){var{track:e,time:t,setTime:n,"data-testid":i}=r,a=v.useMemo(()=>{var f=3600,p=Ui/2;return t<f?p=t/f*(Ui/2):t>23*f&&(p=Ui/2+1/(ft-23*f)*(t-23*f)*(Ui/2)),"translateX(calc(".concat(t/ft*100,"% - ").concat(p,"px))")},[t]),s=v.useCallback(f=>{if(!e.current)return 0;var p=e.current.getBoundingClientRect(),m=Math.max(f-p.left,0),b=ft*Math.min(1,m/p.width),g=Pd*Math.round(b/Pd),C=Math.min(ft,g);return C},[e]),o=v.useCallback(f=>{var{clientX:p}=f;n(s(p))},[n,s]),l=v.useCallback(f=>{var{clientX:p}=f;n(s(p)),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[n,s,o]),d=v.useCallback(()=>{window.addEventListener("mousemove",o),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[o,l]),h=v.useCallback(()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[o,l]),c=v.useCallback(()=>{d()},[d]);return v.useEffect(function(){return()=>{h()}},[h]),u.jsx("div",{className:"handle-track",style:{transform:a},children:u.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:c,"data-testid":i})})}function Ov(r){var{buttons:e,isShown:t=!1,classNames:n,message:i,type:a,onClick:s,onDismiss:o,"data-testid":l}=r,d=e&&e.length!==0;return u.jsx(Hn,{in:t,timeout:Vn.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:u.jsxs("div",{className:Y("toast-notification",n,a),role:"presentation",onClick:s,onKeyPress:s,"data-testid":l,children:[u.jsx("div",{className:"message-container",children:u.jsx("span",{className:"message",children:i})}),u.jsx(Hn,{in:d,timeout:Vn.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx("div",{className:"buttons-container",children:e})}),o&&u.jsx(K,{kind:"ghost",icon:wo,tooltip:"Close notification",className:"my-2",onClick:o})]})})}Ov.TYPE=Object.freeze({ERROR:"error"});function nE(r){var{children:e,className:t,labelText:n,hintText:i,isModified:a,validationError:s,showValidationError:o=!0,"data-testid":l,id:d}=r,{current:h}=v.useRef(d??ye());return u.jsxs(u.Fragment,{children:[u.jsx("label",{className:Y("validate-label",t,{modified:a}),htmlFor:h,"data-testid":l,children:n}),X.Children.toArray(e).map(c=>X.isValidElement(c)?X.cloneElement(c,{className:Y(c.props.className,{"is-invalid":s})}):u.jsx("div",{className:Y(t),children:c})),i!==void 0&&u.jsx("small",{className:"form-text text-muted",children:i}),s!==void 0&&o&&u.jsx("p",{className:"validate-label-error text-danger",children:s})]})}const rE=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:Jc,AutoCompleteInput:US,AutoResizeTextarea:Ho,BasicModal:_n,BulkActionBar:zS,Button:K,ButtonGroup:Pi,ButtonOld:Hs,CSS_VAR_EXPRESSION_PREFIX:gg,CardFlip:$a,Checkbox:ha,Collapse:YS,ComboBox:Cb,ConfirmActionButton:IS,ConfirmationDialog:pv,ContextActionUtils:Sb,ContextActions:ae,ContextMenuItem:yb,ContextMenuRoot:Tc,CopyButton:Io,CustomTimeSelect:ny,DEFAULT_DARK_THEME_KEY:bg,DEFAULT_DARK_THEME_PALETTE:Cg,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:_c,DEFAULT_LIGHT_THEME_KEY:Sg,DEFAULT_PRELOAD_DATA_VARIABLES:yg,DateInput:oy,DateTimeInput:Eb,DebouncedModal:HS,DebouncedSearchInput:Ev,DragUtils:js,DraggableItemList:wb,DropdownMenu:En,EditableItemList:uy,ErrorBoundary:cy,GLOBAL_SHORTCUTS:Pr,HierarchicalCheckboxMenu:my,IconActionButton:mv,InfoModal:VS,ItemList:wr,ItemListItem:Pb,get KEY(){return fe},LoadingOverlay:He,LoadingSpinner:Ma,Logo:xy,get MODIFIER(){return pe},MaskedInput:Do,Menu:_b,MenuItem:Tb,Modal:Ci,ModalBody:Si,ModalFooter:ja,ModalHeader:Na,NON_WHITESPACE_REGEX:Eg,NavTabList:Dy,Option:Ob,Page:Db,Popper:yi,RadioGroup:Oc,RadioItem:ks,RandomAreaPlotAnimation:Pv,SVG_ICON_MANUAL_COLOR_MAP:wg,SearchInput:Ei,SearchableCombobox:zy,Select:Bn,SelectValueList:Dc,Shortcut:Ib,ShortcutRegistry:qe,SocketedButton:Bo,Stack:xb,THEME_CACHE_LOCAL_STORAGE_KEY:Pg,TMP_CSS_PROP_PREFIX:_g,TableViewEmptyState:qy,TextWithTooltip:_v,ThemeContext:Nb,ThemeExport:Vn,ThemePicker:Iy,ThemeProvider:Ic,TimeInput:fa,TimeSlider:Jy,ToastNotification:Ov,Tooltip:wt,UISwitch:xc,ValidateLabelInput:nE,WHITESPACE_REGEX:Tg,calculatePreloadStyleContent:Og,createCssVariableResolver:Dg,createPreloadStyleElement:Ig,extractDistinctCssVariableExpressions:xg,fillToLength:Mb,getActiveThemes:Ng,getDefaultBaseThemes:Mg,getExpressionRanges:fc,getThemeKey:pc,getThemePreloadData:Lg,overrideSVGFillColors:Fg,preloadTheme:Ag,replaceSVGFillColor:Rg,resolveCssVariablesInRecord:Po,resolveCssVariablesInString:jg,setThemePreloadData:kg,themeDHDefault:Lb,themeDark:$g,themeLight:Ug,trimTrailingMask:Fb,useTheme:jr},Symbol.toStringTag,{value:"Module"}));function iE(r,e){var t=Ve(),n=v.useMemo(()=>new t.CoreClient(r,e),[t,r,e]);return v.useEffect(()=>()=>{n.disconnect()},[n]),n}var Wo=v.createContext(null);function Dv(r){var{serverUrl:e,options:t,children:n}=r,i=iE(e,t);return u.jsx(Wo.Provider,{value:i,children:n})}function Td(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function aE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Td(a,n,i,s,o,"next",l)}function o(l){Td(a,n,i,s,o,"throw",l)}s(void 0)})}}var Iv=v.createContext(null);function xv(r){var[e,t]=v.useState(null),[n,i]=v.useState(null),a=v.useContext(Iv),s=v.useContext(La);return v.useEffect(()=>{if(a==null){if(s!=null){t(s),i(null);return}t(null),i(new Error("No API available in useDeferredApi. Was code wrapped in ApiBootstrap or DeferredApiContext.Provider?"));return}var o=!1;function l(){return d.apply(this,arguments)}function d(){return d=aE(function*(){if(typeof a=="function")try{var h=yield a(r);o||(t(h),i(null))}catch(c){o||(t(null),i(c))}else t(a)}),d.apply(this,arguments)}return l(),()=>{o=!0}},[s,a,r]),[e,n]}var Nv=X.memo(r=>{var{children:e,onError:t,widget:n}=r,[i,a]=xv(n);return a!=null?(t==null||t(a),null):i==null?null:u.jsx(La.Provider,{value:i,children:e})});Nv.displayName="DeferredApiBootstrap";function Gn(){return Rr(Wo,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}function Go(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function zo(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function sE(r){return Go(r)||zo(r)}var Ko=v.createContext(null);function Mv(r){if(zo(r))return{id:r.id,type:r.type};if(Go(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function Lv(r){var e,t;return{type:(e=r.type)!==null&&e!==void 0?e:"",name:(t=r.title)!==null&&t!==void 0?t:r.name,id:r.id}}function Fv(){return Rr(Ko,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}const oE=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Hg,ApiContext:La,ClientBootstrap:Dv,ClientContext:Wo,DeferredApiBootstrap:Nv,DeferredApiContext:Iv,ObjectFetcherContext:Ko,getVariableDescriptor:Lv,isIdVariableDescriptor:zo,isNameVariableDescriptor:Go,isVariableDescriptor:sE,sanitizeVariableDescriptor:Mv,useApi:Ve,useClient:Gn,useDeferredApi:xv,useObjectFetcher:Fv},Symbol.toStringTag,{value:"Module"}));function lE(r){return function(t){var{children:n}=t;return u.jsx(La.Provider,{value:r,children:n})}}function Od(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function dE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Od(a,n,i,s,o,"next",l)}function o(l){Od(a,n,i,s,o,"throw",l)}s(void 0)})}}var gs=B.module("MessageUtils"),Av="io.deephaven.message.LoginOptions.request",Rv="io.deephaven.message.SessionDetails.request",jv="io.deephaven.broadcast",qo="io.deephaven.broadcast.Login",kv="io.deephaven.broadcast.Logout";function Ua(r){var e=r;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function $v(r){return Ua(r)&&r.message===qo}function Uv(r){return Ua(r)&&r.message===kv}function Hv(r){var e=r;return e!=null&&typeof e.id=="string"}function Yo(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye(),t=arguments.length>2?arguments[2]:void 0;return{message:r,id:e,payload:t}}function uE(r,e){return{id:r,payload:e}}function Xo(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function Zo(r){return Bs.apply(this,arguments)}function Bs(){return Bs=dE(function*(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=Xo();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((n,i)=>{var a,s=ye(),o=l=>{var{data:d}=l;if(!Hv(d)){gs.debug("Ignoring non-deephaven response",d);return}if(gs.debug("Received message",d),(d==null?void 0:d.id)!==s){gs.debug("Ignore message, id doesn't match",d);return}window.clearTimeout(a),window.removeEventListener("message",o),n(d.payload)};window.addEventListener("message",o),a=window.setTimeout(()=>{window.removeEventListener("message",o),i(new Ab("Request timed out"))},e),t.postMessage(Yo(r,s),"*")})}),Bs.apply(this,arguments)}function hE(r,e,t){return e=cE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cE(r){var e=vE(r,"string");return typeof e=="symbol"?e:String(e)}function vE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vv extends Error{constructor(){super(...arguments),hE(this,"isNoConsolesError",!0)}}function Bv(r){return r.isNoConsolesError}function Dd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Ha(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Dd(a,n,i,s,o,"next",l)}function o(l){Dd(a,n,i,s,o,"throw",l)}s(void 0)})}}var or=B.module("SessionUtils");function fE(r,e){return or.info("Starting connection to '".concat(e,"'...")),new r.IdeConnection(e)}function Wv(r,e,t){return Ws.apply(this,arguments)}function Ws(){return Ws=Ha(function*(r,e,t){or.info("Getting console types...");var n=yield e.getConsoleTypes();if(n.length===0)throw new Vv("No console types available");or.info("Available types:",n);var i=n[0];or.info("Starting session with type",i);var a=yield e.startSession(i),s={type:i,id:ye.generate()};return or.info("Console session established",s),{session:a,config:s,connection:e,details:t,dh:r}}),Ws.apply(this,arguments)}function pE(r,e,t){return or.info("createCoreClient",e),new r.CoreClient(e,t)}function mE(r){return r!=null&&typeof r=="object"}function gE(){return Gs.apply(this,arguments)}function Gs(){return Gs=Ha(function*(){var r=yield Zo(Rv);if(!mE(r))throw new Error("Unexpected session details response: ".concat(r));return r}),Gs.apply(this,arguments)}function bE(){return zs.apply(this,arguments)}function zs(){return zs=Ha(function*(){var r=new URLSearchParams(window.location.search);switch(r.get("authProvider")){case"parent":return gE()}return{}}),zs.apply(this,arguments)}function CE(r,e,t){return Ks.apply(this,arguments)}function Ks(){return Ks=Ha(function*(r,e,t){var n;try{n=yield Wv(r,e,t)}catch(i){if(!Bv(i))throw i}return n}),Ks.apply(this,arguments)}const SE=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:jv,BROADCAST_LOGIN_MESSAGE:qo,BROADCAST_LOGOUT_MESSAGE:kv,BooleanColumnFormatter:Rb,CharColumnFormatter:jb,DateTimeColumnFormatter:xo,DateUtils:No,DecimalColumnFormatter:kb,DefaultColumnFormatter:$b,FETCH_TIMEOUT:Ub,Formatter:_r,FormatterUtils:wn,IntegerColumnFormatter:Hb,LOGIN_OPTIONS_REQUEST:Av,NoConsolesError:Vv,SESSION_DETAILS_REQUEST:Rv,StringColumnFormatter:Vb,TableColumnFormatter:Bb,TableUtils:Ne,createComboboxFilterArgs:Wb,createConnection:fE,createCoreClient:pE,createFilterConditionFactory:Mo,createKeyFromOffsetRow:Gb,createNotNullOrEmptyFilterCondition:Nc,createOnTableUpdatedHandler:Mc,createSearchTextFilter:Lo,createSelectedValuesFilter:Fo,createSessionWrapper:Wv,createShowOnlyEmptyFilterCondition:Lc,createValueFilter:Fc,defaultRowDeserializer:Ac,fetchVariableDefinition:zb,generateEmptyKeyedItems:Rc,getColumnFormats:Kb,getDateTimeFormatterOptions:qb,getSessionDetails:bE,getSize:Ao,getWindowParent:Xo,isBroadcastLoginMessage:$v,isBroadcastLogoutMessage:Uv,isClosed:ca,isCustomColumnFormatDefined:Yb,isMessage:Ua,isNoConsolesError:Bv,isResponse:Hv,loadSessionWrapper:CE,makeMessage:Yo,makeResponse:uE,padFirstAndLastRow:jc,requestParentResponse:Zo},Symbol.toStringTag,{value:"Module"}));var Id=B.module("useTableListener"),yE=(r,e,t)=>v.useEffect(function(){if(r==null){Id.debug2("Emitter undefined, skipping addEventListener",e);return}return Id.debug2("Adding listener",e),r.addEventListener(e,t)},[r,e,t]);const pr=yE;function EE(r,e,t){return e=wE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wE(r){var e=PE(r,"string");return typeof e=="symbol"?e:String(e)}function PE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _E extends Error{constructor(){super(...arguments),EE(this,"isColumnNameError",!0)}}const TE=_E;function OE(r,e,t){return e=DE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function DE(r){var e=IE(r,"string");return typeof e=="symbol"?e:String(e)}function IE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class xE extends Error{constructor(){super(...arguments),OE(this,"isTableDisconnectError",!0)}}const NE=xE;var Hi=B.module("useTable"),ME=(r,e,t,n)=>{var i=Ve(),[a,s]=v.useState(void 0),[o,l]=v.useState([]),[d,h]=v.useState(null),[c,f]=v.useState(null);v.useEffect(()=>{if(n===void 0){s(r==null?void 0:r.columns),h(null);return}try{s(r==null?void 0:r.findColumns(n)),h(null)}catch(g){Hi.error("Column not found",g,n),h(new TE("Invalid columnNames argument"))}},[r,n]),v.useEffect(()=>{if(!a||!r){Hi.debug2("Table or column not initialized, skip viewport update.");return}Hi.debug2("Setting viewport",e,t),r.setViewport(e,t,a)},[a,r,e,t]);var p=v.useCallback(g=>{var{detail:C}=g;if(!a){Hi.error("Columns not initialized.");return}var y=a.map(S=>C.rows.map(E=>E.get(S)));l(y)},[a]),m=v.useCallback(()=>{f(new NE("Table disconnected"))},[]),b=v.useCallback(()=>{f(null)},[]);return pr(r,i.Table.EVENT_UPDATED,p),pr(r,i.Table.EVENT_DISCONNECT,m),pr(r,i.Table.EVENT_RECONNECT,b),{columns:a,data:o,error:c??d}};const Gv=ME;var LE=(r,e,t,n)=>{var i=v.useMemo(()=>[n],[n]),{columns:a=[],data:s=[],error:o}=Gv(r,e,t,i);return{column:a[0],data:s[0],error:o}};const zv=LE;function xd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function FE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){xd(a,n,i,s,o,"next",l)}function o(l){xd(a,n,i,s,o,"throw",l)}s(void 0)})}}var Gt=B.module("TableInput"),bs=250;function Qo(r){var e,t,{className:n=void 0,columnName:i,settings:a,defaultValue:s=[],isInvalid:o=!1,onChange:l=()=>!1,onBlur:d=()=>!1,table:h}=r,c=v.useRef(null),f=Ve(),p=v.useMemo(()=>{var V=wn.getColumnFormats(a),x=wn.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:P={},defaultIntegerFormatOptions:j={}}=a;return new _r(f,V,x,P,j)},[f,a]),[m,b]=v.useState(""),[g,C]=v.useState(new Set(s)),[y,S]=v.useState(),E=v.useRef(null),w=Math.min((e=y==null?void 0:y.size)!==null&&e!==void 0?e:0,bs),{column:I,data:O,error:T}=zv(y,0,bs-1,i),N=v.useCallback(V=>I?p.getFormattedString(V,I.type,I.name):"".concat(V),[I,p]),[R,W]=v.useMemo(()=>{var V=new Set(g),x=[];if(O==null)return[x,null];if(O.forEach(j=>{var U="".concat(j),Q=g.has(U);Q&&V.delete(U),x.push({value:U,displayValue:N(j),isSelected:Q})}),V.size>0){Gt.debug2("Selection has items that are missing from the viewport");var P=new Set(g);return Array.from(V).forEach(j=>{P.delete(j)}),[x,P]}return[x,null]},[O,g,N]);v.useEffect(()=>{W!==null&&(C(W),l(Array.from(W)))},[l,W]);var L=v.useCallback(function(){var V=FE(function*(x){try{var P=yield x;Gt.debug("Table resolved",P),S(P)}catch(j){if(Se.isCanceled(j))return;Gt.error(j)}});return function(x){return V.apply(this,arguments)}}(),[]);v.useEffect(()=>{var V=Se.makeCancelable(h);return L(V),()=>{Gt.debug2("Cancel table promise"),V.cancel()}},[h,L]);var D=v.useCallback(V=>{var{value:x}=V.target;b(x);var P=R.findIndex(U=>U.displayValue.includes(x));if(P>-1){var j;Gt.debug2("Found ".concat(x," at index ").concat(P)),(j=E.current)===null||j===void 0||j.scrollIntoView(P)}else Gt.debug2("".concat(x," not found"))},[R,E]),M=v.useCallback(V=>{if(Gt.debug("handleSelect",V),V>=R.length){Gt.error("Invalid index",V);return}var x=R[V].value,P=new Set(g);R[V].isSelected?P.delete(x):P.add(x),C(P),l(Array.from(P))},[l,R,g]),F=v.useCallback(()=>{var V=R.map(P=>P.value),x=new Set(V);C(x),l(V)},[R,l]),k=v.useCallback(()=>{C(new Set),l([])},[l]),H=v.useCallback(()=>{},[]),q=v.useCallback(V=>{var x,{relatedTarget:P}=V;Gt.debug("handleChildBlur",P,P instanceof HTMLElement,c.current,(x=c.current)===null||x===void 0?void 0:x.contains(P)),(!P||c.current&&P instanceof HTMLElement&&!c.current.contains(P))&&d()},[d]),re=R.length===0;return u.jsxs("div",{ref:c,className:Y("table-input-container d-flex flex-column position-relative",n),children:[u.jsx(Ei,{disabled:!!T||re,value:m,placeholder:"Search",onChange:D,className:"mb-2 d-flex",onBlur:q}),u.jsx(Dc,{className:"table-input-list",disabled:y===void 0||re,isInvalid:o,items:re?[{value:"Empty",isSelected:!1}]:R,itemCount:w,offset:0,onSelect:M,onViewportChange:H,ref:E,onBlur:q}),y&&u.jsxs("div",{className:"meta-row",children:[u.jsx("div",{className:"d-flex align-items-center text-muted small",children:y!=null&&y.size>w&&u.jsxs(u.Fragment,{children:["Table is too large, showing the first ",bs," items."]})}),u.jsxs("div",{children:[u.jsx("button",{type:"button",className:"btn btn-link",onBlur:q,onClick:F,children:"Select All"}),u.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:q,onClick:k,children:"Clear"})]})]}),y==null||T&&u.jsx("div",{className:"h-100 w-100 position-absolute",children:u.jsx(He,{isLoaded:y!=null,isLoading:y==null&&T==null,errorMessage:(t=T==null?void 0:T.message)!==null&&t!==void 0?t:null})})]})}Qo.displayName="TableInput";Qo.defaultProps={isInvalid:!1,className:void 0};var Nd=B.module("useBroadcastChannel");function Jo(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xb,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jv,t=v.useMemo(()=>new BroadcastChannel(e),[e]);return v.useEffect(()=>()=>{t.close()},[t]),v.useEffect(()=>{function n(i){var{data:a}=i;if(!Ua(a)){Nd.debug("Ignoring non-deephaven message",a);return}Nd.debug("event received",a),r(i)}return t.addEventListener("message",n),()=>{t.removeEventListener("message",n)}},[t,r]),t}function Va(r,e){var t=v.useCallback(n=>{$v(n.data)?r==null||r(n.data):Uv(n.data)&&(e==null||e(n.data))},[r,e]);Jo(t)}var pa="io.deephaven.web.client.auth.refreshToken",Kv=v.createContext(null),AE=B.module("RefreshTokenUtils");function qs(){var r=Er.get(pa);try{if(r!=null)return JSON.parse(r)}catch(e){AE.error("Error parsing refresh token",r,e)}return null}function Ys(r){if(r==null){Er.remove(pa);return}var e=JSON.stringify({bytes:r.bytes,expiry:r.expiry}),t=new Date(r.expiry);Er.set(pa,e,{secure:!0,sameSite:"strict",expires:t})}function qv(r){var{children:e}=r,t=Ve(),n=Gn(),[i,a]=v.useState(qs());v.useEffect(function(){var d=n.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,h=>{var{detail:c}=h;Ys(c),a(c)});return d},[t,n,i]);var s=v.useCallback(()=>{a(qs())},[]),o=v.useCallback(()=>{Ys(null),a(null)},[]);return Va(s,o),u.jsx(Kv.Provider,{value:i,children:e})}function nn(){var r=Ve();return v.useMemo(()=>new Ne(r),[r])}function RE(r,e,t,n){var i=nn(),[a,s]=v.useState(""),{value:o}=wi(a,t),l=v.useCallback(f=>{s(f.trim())},[]),{data:d,isLoading:h}=hi(i.doesColumnValueExist,[r,e,o,n]),c=h||a!==o?null:d;return{valueTrimmed:a,valueTrimmedDebounced:o,valueExists:c,trimAndUpdateValue:l}}var Md=B.module("useDebouncedViewportSearch"),jE=200;function kE(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jE,n=nn(),{table:i,applyFiltersAndRefresh:a}=r,s=v.useMemo(()=>Le(o=>{if(Md.debug("Applying debounced searchText '".concat(o,"'")),i!=null){var l=o.trim();if(l===""){a([]);return}var d=i.findColumn(e),h=n.makeFilterValue(d.type,l),c=[d.filter().contains(h)];a(c)}},t),[a,e,t,i,n]);return v.useEffect(()=>()=>{Md.debug("Cancelling debounced search function"),s.cancel()},[s]),s}var Yv=300;function $E(r){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:n,mapItemToValue:i}=r,a=nn(),s=uv(e,i),{value:o}=wi(s,Yv),l=ov(o,tv);return v.useMemo(()=>Fo(a,t,l.selection,n,l.isInverted),[t,l,n,a])}function el(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return v.useMemo(()=>Zb(...t.map(i=>i(r))),[r,...t])}function UE(r,e,t,n){var i=v.useRef("");return i.current=t,v.useMemo(()=>{var a=r.length>0&&r[0].item==null;return!a&&n!=null&&(i.current===""||n.toLowerCase().includes(i.current.toLowerCase()))?[{key:n,item:{[e]:n}},...r]:r},[n,e,r])}function Ld(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function HE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ld(a,n,i,s,o,"next",l)}function o(l){Ld(a,n,i,s,o,"throw",l)}s(void 0)})}}function VE(r){var{table:e,columnName:t,defaultValue:n,itemHeight:i,topOffset:a=0,value:s}=r;return v.useCallback(HE(function*(){if(e==null||s===""||s===n)return a;var o=e.findColumn(t),l=yield e.seekRow(0,o,"String",s),d=n==null?0:1;return(l+d)*i+a}),[t,n,i,e,a,s])}function tl(r){var[,e]=v.useState(0),t=Ve();return pr(r,t.Table.EVENT_SIZECHANGED,()=>{e(n=>n+1)}),Ao(r)}var BE=B.module("useInitializeViewportData");function Xv(r){var e=vv({}),t=Math.max(0,tl(r));return v.useEffect(()=>{var n=e.items.length;t!==n&&(BE.debug("size changed:",{currentSize:n,targetSize:t}),e.setItems(Array.from(Rc(0,t-1))))},[t,r]),e}function Zv(r,e,t){return v.useCallback(function(i){var[a,s]=jc(i,e,t,Ao(r));r==null||r.setViewport(a,s)},[r,t,e])}var Fd=B.module("useViewportData");function nl(r){var{table:e,itemHeight:t=1,scrollDebounce:n=YC,viewportSize:i=10,viewportPadding:a=50,deserializeRow:s=Ac}=r,o=Xv(e),l=Zv(e,i,a),d=v.useCallback(b=>{e&&!ca(e)?l(b):Fd.debug("setViewport called on closed table.",e)},[e,l]),h=v.useCallback(b=>{e&&!ca(e)?(e.applyFilter(b),d(0)):Fd.debug("applyFiltersAndRefresh called on closed table.",e)},[d,e]),c=Ve(),f=v.useMemo(()=>Mc(o,s),[s,o]);pr(e,c.Table.EVENT_UPDATED,f);var p=tl(e);v.useEffect(()=>{d(0)},[e,d,p]);var m=hv(t,d,n);return v.useMemo(()=>({viewportData:o,size:p,table:e,applyFiltersAndRefresh:h,setViewport:d,onScroll:m}),[h,m,d,p,e,o])}function rl(r,e){var{applyFiltersAndRefresh:t}=r;v.useEffect(()=>{t(e)},[t,e])}function WE(r,e){for(var t=nn(),[n,i]=v.useState(""),a=v.useMemo(()=>Lo(t,e,n),[e,n,t]),s=va(i,$s),o=nl({table:r,itemHeight:qC,viewportSize:Zc,viewportPadding:Qc}),l=arguments.length,d=new Array(l>2?l-2:0),h=2;h<l;h++)d[h-2]=arguments[h];var c=el(o.table,a,...d);return rl(o,c),{list:o,onSearchTextChange:s}}function GE(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=nn(),n=v.useMemo(()=>Nc(t),[t]);return v.useMemo(()=>Mo(r,n,e),[r,e,n])}function Qv(r){v.useEffect(()=>()=>{r!=null&&(ca(r)||r.close())},[r])}function zE(r){var{maybeTable:e,columnName:t,mapItemToValue:n,filterConditionFactories:i=[],trimSearchText:a=!1}=r,s=nn(),[o,l]=v.useState(""),[d,h]=v.useState(""),c=v.useCallback(q=>{h(a?q.trim():q)},[a]),f=v.useMemo(()=>a?o.trim():o,[o,a]),[p,m]=v.useState(null),[b,g]=v.useState(()=>new Map),{data:C,isLoading:y}=hi(s.doesColumnValueExist,[e,t,d,!1]),{isDebouncing:S}=wi(d,$s),E=S||y?null:C,w=v.useMemo(()=>Lo(s,t,d),[d,t,s]),I=v.useMemo(()=>Fo(s,t,new Set(b.keys()),!1,!0),[t,b,s]),{data:O}=hi(s.createDistinctSortedColumnTable,[e,t,"asc",...i]);Qv(O);var T=nl({table:O,itemHeight:KC,viewportSize:Zc,viewportPadding:Qc}),N=f.length>0&&T.size===0,R=b.has(f),W=va(c,$s),L=v.useCallback(q=>{l(q),W(q)},[W]),D=va(m,0),M=v.useCallback(q=>{if(l(""),c(""),m(q),D(null),q!=null){var re=T.viewportData.findItem(q);if(re!=null){var V=n(re);g(x=>{var P=new Map(x);return P.set(V,{value:V}),P})}}},[c,D,T.viewportData,n]),F=v.useCallback(q=>{g(re=>{if(q.size===0)return re;var V=new Map(re);for(var x of q)V.set(x,{value:x});return V})},[]),k=v.useCallback(q=>{g(re=>{if(q==="all")return new Map;var V=new Map(re);for(var x of q)V.delete(x);return V})},[]),H=el(T.table,w,I);return rl(T,H),v.useMemo(()=>({list:T,hasSearchTextWithZeroResults:N,searchText:o,searchTextExists:E,searchTextIsInSelectedValues:R,selectedKey:p,selectedValueMap:b,onSearchTextChange:L,onSelectKey:M,onAddValues:F,onRemoveValues:k}),[N,T,F,k,L,M,o,E,R,p,b])}function Ad(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function KE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ad(a,n,i,s,o,"next",l)}function o(l){Ad(a,n,i,s,o,"throw",l)}s(void 0)})}}function qE(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];var i=v.useCallback(KE(function*(){var d;return(d=r==null?void 0:r.selectDistinct(r.findColumns(t)))!==null&&d!==void 0?d:null}),[r,...t]),{data:a,error:s,isError:o,isLoading:l}=hi(i,[]);return v.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:s,isError:o,isLoading:l}}function YE(r,e){var t=nn(),n=v.useMemo(()=>Lc(t,r),[r,t]);return v.useMemo(()=>Mo(e,n),[e,n])}function XE(r,e,t){var n=nn();return v.useMemo(()=>Fc(n,r,e,t),[r,t,n,e])}const ZE=Object.freeze(Object.defineProperty({__proto__:null,DEBOUNCE_MS:Yv,REFRESH_TOKEN_KEY:pa,RefreshTokenBootstrap:qv,RefreshTokenContext:Kv,TableDropdown:Qb,TableInput:Qo,makeApiContextWrapper:lE,readRefreshToken:qs,storeRefreshToken:Ys,useBroadcastChannel:Jo,useBroadcastLoginListener:Va,useCheckIfExistsValue:RE,useDebouncedViewportSearch:kE,useDebouncedViewportSelectionFilter:$E,useFilterConditionFactories:el,useFilteredItemsWithDefaultValue:UE,useGetItemPosition:VE,useInitializeViewportData:Xv,useNotNullOrEmptyFilter:GE,usePickerWithSelectedValues:zE,useSearchableViewportData:WE,useSelectDistinctTable:qE,useSetPaddedViewportCallback:Zv,useShowOnlyEmptyFilter:YE,useTable:Gv,useTableClose:Qv,useTableColumn:zv,useTableListener:pr,useTableSize:tl,useTableUtils:nn,useValueFilter:XE,useViewportData:nl,useViewportFilter:rl},Symbol.toStringTag,{value:"Module"}));var il=v.createContext(!1);function Jv(r){var{fontClassNames:e=["fira-sans-regular","fira-sans-semibold","fira-mono"],children:t}=r,[n,i]=v.useState(!1);return v.useEffect(function(){document.fonts.ready.then(()=>{i(!0)})},[]),u.jsxs(u.Fragment,{children:[u.jsx(il.Provider,{value:n,children:t}),u.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:e.map(a=>u.jsx("p",{className:a,children:"preload"},a))})]})}var _i=v.createContext(null),nt=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function ef(r){return"DashboardPlugin"in r}function ma(r){return"AuthPlugin"in r}function al(r){return"TablePlugin"in r}function tf(r){return ef(r)||ma(r)||al(r)}function QE(r){return"type"in r&&r.type===nt.DASHBOARD_PLUGIN}function Ti(r){return"type"in r&&r.type===nt.WIDGET_PLUGIN}function nf(r){return"type"in r&&r.type===nt.TABLE_PLUGIN}function rf(r){return"type"in r&&r.type===nt.AUTH_PLUGIN}function af(r){return"type"in r&&r.type===nt.THEME_PLUGIN}var JE=B.module("@deephaven/plugin.PluginUtils");function Xs(r,e){return r==null||!Ti(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function sf(r){var e=u.jsx(ne,{icon:mc});if(!Ti(r))return e;var{icon:t}=r;return t==null?e:v.isValidElement(t)?t:u.jsx(ne,{icon:t})}function of(r){var e=[...r.entries()].filter(t=>af(t[1]));return JE.debug("Getting theme data from plugins",e),e.map(t=>{var[n,i]=t,a=Array.isArray(i.themes)?i.themes:[i.themes];return a.map(s=>{var{name:o,baseTheme:l,styleContent:d}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:pc(n,o),name:o,styleContent:d}})}).flat()}function Ba(){return Rr(_i,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function ew(r){var{fetch:e,type:t}=r,n=Ba(),i=v.useMemo(()=>[...n.values()].filter(Ti).find(s=>[s.supportedTypes].flat().includes(t)),[n,t]);if(i!=null){var a=i.component;return u.jsx(a,{fetch:e})}throw new Error("Unknown widget type '".concat(t,"'"))}const tw=Object.freeze(Object.defineProperty({__proto__:null,PluginType:nt,PluginsContext:_i,WidgetView:ew,getIconForPlugin:sf,getThemeDataFromPlugins:of,isAuthPlugin:rf,isDashboardPlugin:QE,isLegacyAuthPlugin:ma,isLegacyDashboardPlugin:ef,isLegacyPlugin:tf,isLegacyTablePlugin:al,isTablePlugin:nf,isThemePlugin:af,isWidgetPlugin:Ti,pluginSupportsType:Xs,usePlugins:Ba},Symbol.toStringTag,{value:"Module"}));function nw(r){if(r==null)return!1;var e=r;return e.Component!==void 0&&typeof e.isAvailable=="function"}var lf="io.deephaven.auth.AnonymousAuthenticationHandler",rw="io.deephaven.authentication.psk.PskAuthenticationHandler";function Rd(r,e,t){return e=iw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iw(r){var e=aw(r,"string");return typeof e=="symbol"?e:String(e)}function aw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class sw extends Error{constructor(){super(...arguments),Rd(this,"name","AuthenticationError"),Rd(this,"isAuthenticationError",!0)}}const df=sw;function jd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function ow(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){jd(a,n,i,s,o,"next",l)}function o(l){jd(a,n,i,s,o,"throw",l)}s(void 0)})}}var kd=B.module("AuthPluginBase");function sl(r){var{children:e,getLoginOptions:t}=r,n=Gn(),[i,a]=v.useState(),[s,o]=v.useState(!1);return v.useEffect(()=>{var l=!1;function d(){if(l)throw new kc("Login canceled.")}function h(){return c.apply(this,arguments)}function c(){return c=ow(function*(){try{var f=yield t();d(),kd.info("Logging in..."),yield n.login(f),d(),o(!0)}catch(b){if(!l){var p;kd.error("Unable to login:",b);var m=(p=Or(b))!==null&&p!==void 0?p:"Unable to login. Verify credentials.";a(new df(m)),o(!1)}}}),c.apply(this,arguments)}return h(),()=>{l=!0}},[n,t]),s?u.jsx(u.Fragment,{children:e}):u.jsx(He,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:Or(i)})}var lw={canLogout:!1};function dw(r){var{children:e}=r,t=Ve(),n=v.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return u.jsx(sl,{getLoginOptions:n,children:u.jsx(Aa.Provider,{value:lw,children:e})})}var uw={Component:dw,isAvailable:r=>r.includes(lf)};const uf=uw;function $d(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function hw(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){$d(a,n,i,s,o,"next",l)}function o(l){$d(a,n,i,s,o,"throw",l)}s(void 0)})}}var cw=B.module("AuthPluginParent"),vw={canLogout:!1};function fw(r){return r!=null&&typeof r.type=="string"}function pw(){return Zs.apply(this,arguments)}function Zs(){return Zs=hw(function*(){cw.info("Logging in by delegating to parent window...");var r=yield Zo(Av);if(!fw(r))throw new Error("Unexpected login options response: ".concat(r));return r}),Zs.apply(this,arguments)}function mw(){var r;return(r=new URLSearchParams(window.location.search).get("authProvider"))!==null&&r!==void 0?r:""}function gw(r){var{children:e}=r;return u.jsx(sl,{getLoginOptions:pw,children:u.jsx(Aa.Provider,{value:vw,children:e})})}var bw={Component:gw,isAvailable:()=>Xo()!=null&&mw()==="parent"};const hf=bw;function cf(r){var{children:e,errorMessage:t,isLoggingIn:n=!1,onSubmit:i}=r;return u.jsxs("form",{className:"login-form",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),i==null||i(a)},children:[u.jsx("div",{className:"flex-spacer"}),u.jsxs("div",{className:"flex-wrapper",children:[u.jsx("fieldset",{disabled:n,className:"container-fluid",children:e}),u.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:u.jsxs("button",{type:"submit",className:Y("btn btn-primary",{"btn-spinner":n},{"btn-cancelable":n}),"data-testid":"btn-login",children:[n&&u.jsxs("span",{children:[u.jsx(Ma,{className:"mr-2 loading-spinner-vertical-align"}),u.jsx("span",{className:"btn-normal-content",children:"Logging in"}),u.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!n&&"Login"]})})]}),u.jsx("div",{className:"flex-spacer",children:t!=null&&u.jsx("p",{className:"error-message mb-0",role:"alert",children:"".concat(t)})})]})}function vf(r){var{children:e,logoPath:t="./logo.png"}=r;return u.jsxs("div",{className:"login-container",children:[u.jsx(Pv,{}),u.jsxs("div",{className:"login-box",children:[u.jsx("div",{className:"logo",children:u.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),e,u.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}function Ud(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Cs(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ud(a,n,i,s,o,"next",l)}function o(l){Ud(a,n,i,s,o,"throw",l)}s(void 0)})}}var Qs="io.deephaven.authentication.psk.PskAuthenticationHandler",ff="psk",Js="io.deephaven.web.client.auth.psk.token",lr=B.module("AuthPluginPsk");function Cw(){return new URLSearchParams(window.location.search).get(ff)}function Sw(){lr.debug2("clearWindowToken");var r=new URL(window.location.href);r.searchParams.delete(ff),window.history.replaceState(null,"",r.href)}function Hd(){var r;return(r=Er.get(Js))!==null&&r!==void 0?r:null}function Ss(r){lr.debug2("Storing token in cookie",r),r!=null?Er.set(Js,r,{secure:!0,sameSite:"strict"}):Er.remove(Js)}function yw(r){var{children:e,logoPath:t}=r,n=Gn(),i=v.useRef(null),a=v.useRef(null),[s,o]=v.useState(),[l,d]=v.useState(!1),[h,c]=v.useState(!1),[f,p]=v.useState(!1),[m,b]=v.useState(""),g=v.useCallback(function(){var w=Cs(function*(I){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;lr.info("Logging in..."),p(!0);var T=null;try{if(T=n.login({type:Qs,token:I}),a.current=T,yield T,lr.info("Logged in successfully"),a.current!==T)return;Ss(I),c(!0)}catch(W){if(a.current!==T)return;if(d(!0),O){var N;lr.error("Unable to login",W);var R=(N=Or(W))!==null&&N!==void 0?N:"Unable to login: Verify credentials.";o(new df(R))}}p(!1)});return function(I){return w.apply(this,arguments)}}(),[n]),C=v.useCallback(()=>{a.current=null,p(!1)},[]),y=v.useCallback(Cs(function*(){lr.debug("onLogin");var w=Hd();h||f||w==null||g(w,!1)}),[h,f,g]),S=v.useCallback(()=>{Ss(null)},[]);Va(y,S),v.useEffect(()=>{var w=!1;function I(){return O.apply(this,arguments)}function O(){return O=Cs(function*(){var T,N=(T=Cw())!==null&&T!==void 0?T:Hd();if(Sw(),N==null){d(!0);return}p(!0);try{yield n.login({type:Qs,token:N}),w||(Ss(N),c(!0),p(!1))}catch{w||(d(!0),p(!1))}}),O.apply(this,arguments)}return I(),()=>{w=!0}},[n]);var E=v.useCallback(()=>{f?C():g(m)},[C,f,g,m]);return v.useEffect(function(){var I;(I=i.current)===null||I===void 0||I.focus()},[i,l]),u.jsxs(u.Fragment,{children:[h&&e,l&&u.jsx(Hn,{in:!h,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(vf,{logoPath:t,children:u.jsx(cf,{errorMessage:Or(s),isLoggingIn:f,onSubmit:E,children:u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),u.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:i,value:m,onChange:w=>{o(void 0),b(w.target.value)}})]})})})}),u.jsx(He,{"data-testid":"auth-psk-loading",isLoaded:h||l,isLoading:!h&&!l})]})}var Ew={Component:yw,isAvailable:r=>r.includes(Qs)};const pf=Ew;function Vd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ys(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vd(Object(t),!0).forEach(function(n){ww(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Vd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ww(r,e,t){return e=Pw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pw(r){var e=_w(r,"string");return typeof e=="symbol"?e:String(e)}function _w(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Tw=B.module("UserUtils");function mf(r,e){return r.get("internal.webClient.appInit.".concat(e))}function gf(r){var e,t,n,i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};function o(g){return mf(r,g)}function l(g,C){var y=o(g);return y==="true"?!0:y==="false"?!1:(y!==void 0&&Tw.warn("Unexpected value for ".concat(g,": ").concat(y)),C)}var d=(e=o("name"))!==null&&e!==void 0?e:"",h=(t=o("operateAs"))!==null&&t!==void 0?t:d,c=(n=(i=o("groups"))===null||i===void 0?void 0:i.split(","))!==null&&n!==void 0?n:[],f=l("canCopy",!0),p=l("canDownloadCsv",!0),m=l("canUsePanels",!0),b=l("canLogout",!0);return ys(ys({name:d,operateAs:h,groups:c},a),{},{permissions:ys({canUsePanels:m,canCopy:f,canDownloadCsv:p,canLogout:b},s)})}const Ow=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:lf,AUTH_HANDLER_TYPE_PSK:rw,AuthPluginAnonymous:uf,AuthPluginBase:sl,AuthPluginParent:hf,AuthPluginPsk:pf,Login:vf,LoginForm:cf,UserContext:$c,UserOverrideContext:Uc,UserPermissionsOverrideContext:Aa,getAppInitValue:mf,getUserFromConfig:gf,isAuthPlugin:nw},Symbol.toStringTag,{value:"Module"})),bf=typeof ps=="function"?ps:ps.default;Ro.register([HC,VC,BC,WC,GC,zC]);function tt(r,e,t){return e=Dw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dw(r){var e=Iw(r,"string");return typeof e=="symbol"?e:String(e)}function Iw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class De{constructor(e){tt(this,"dh",void 0),tt(this,"listeners",void 0),tt(this,"formatter",void 0),tt(this,"rect",void 0),tt(this,"isDownsamplingDisabled",void 0),tt(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(De.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(De.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(De.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(De.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(De.EVENT_ERROR,{detail:e}))}}tt(De,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");tt(De,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");tt(De,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");tt(De,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");tt(De,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");tt(De,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");tt(De,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");tt(De,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");tt(De,"EVENT_ERROR","ChartModel.EVENT_ERROR");const St=De;function Bd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Vi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bd(Object(t),!0).forEach(function(n){Ue(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ue(r,e,t){return e=xw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xw(r){var e=Nw(r,"string");return typeof e=="symbol"?e:String(e)}function Nw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Wr=B.module("ChartUtils"),Wd="io.deephaven.time.DateTime",Mw=36e5,Lw=1e6;function Fw(r){return r.asDate!==void 0}function Aw(r){return r.asNumber!==void 0}function Gd(r){return r.dhTimeZone!==void 0}function Rw(r){return r!=null&&r.range!=null&&(r.autorange===!1||r.autorange===void 0)}class G{static getPlotlyErrorBars(e,t,n){var i=n.map((s,o)=>s-e[o]),a=t.map((s,o)=>e[o]-s);return{type:"data",symmetric:!1,array:i,arrayminus:a}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;var i=n.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);z(a);var[,s,o,l,,d,h,c,f,p]=a,m=l.replace(",","").length,b=o.indexOf(",")>=0||l.indexOf(",")>=0,g=b?",":"",C=c!=null&&c!==""?"e":"f",y=f!==""?f:C,S=d.length+h.length,E="",w="0".concat(m).concat(g,".").concat(S).concat(E).concat(y),I=G.convertNumberPrefix(s),O=G.convertNumberPrefix(p);return{tickformat:w,tickprefix:I,ticksuffix:O,automargin:!0}}static addTickSpacing(e,t,n){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},s=i;return n&&(s=i/Lw),t.log&&(s=Math.log(s)),a.tickmode="linear",a.dtick=s,a}return e}static getSourceForAxis(e,t){for(var n=0;n<e.series.length;n+=1)for(var i=e.series[n],a=0;a<i.sources.length;a+=1){var s=i.sources[a];if(s.axis===t)return s}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,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:G.ORIENTATION.VERTICAL;return{type:e,mode:t,name:n,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,n)=>[...t,...n.axes],[])}static getAxisTypeMap(e){var t=G.getAllAxes(e);return G.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:n}=e,i=0;i<n.length;i+=1)for(var a=n[i],s=0;s<a.series.length;s+=1)if(t===a.series[s])return a;return null}static getLayoutRanges(e){for(var t={},n=Object.keys(e).filter(o=>o.indexOf("axis")>=0),i=0;i<n.length;i+=1){var a=n[i],s=e[a];Rw(s)&&(t[a]=[...s.range])}return t}static getAxisLayoutProperty(e,t){var n=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(n)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((n,i)=>{var a,s=i[t],o=(a=n.get(s))!==null&&a!==void 0?a:[];return o.push(i),n.set(s,o),n},new Map)}static normalizeColorway(e){if(e!=null){if(Array.isArray(e))return e;if(typeof e=="string")return e.split(" ");Wr.warn("Unexpected colorway format: ".concat(e))}}static titleFromSettings(e){var{series:t,xAxis:n,title:i="".concat((t??[]).join(", ")," by ").concat(n)}=e;return i}constructor(e){Ue(this,"dh",void 0),Ue(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values()),Hc(this)}getAxisFormats(e,t){for(var n=this,i=new Map,a={tickformat:null,ticksuffix:null},s=G.getAllAxes(e),o=G.groupArray(s,"type"),{charts:l}=e,d=0;d<l.length;d+=1)for(var h=l[d],c=0;c<h.series.length;c+=1)for(var f=h.series[c],{sources:p}=f,m=p.filter(y=>y.axis),b=function(){var S=m[g],{axis:E}=S,{type:w}=E,I=o.get(w);z(I);var O=I.indexOf(E),T=n.getAxisPropertyName(w);if(T!=null){var N=G.getAxisLayoutProperty(T,O);if(i.has(N))Wr.debug("".concat(N," already added."));else{Wr.debug("Adding ".concat(N," to axisFormats."));var R=n.getPlotlyAxisFormat(S,t);if(R===null)i.set(N,a);else{i.set(N,R);var{businessCalendar:W}=E;if(W!=null){var L=[],{businessPeriods:D,businessDays:M,holidays:F,timeZone:k}=W,H=t==null?void 0:t.getColumnTypeFormatter(Wd),q;Gd(H)&&(q=H.dhTimeZone);var re=q?(k.standardOffset-q.standardOffset)/60:0;F.length>0&&L.push(...n.createRangeBreakValuesFromHolidays(F,k,q)),D.forEach(V=>L.push({pattern:"hour",bounds:[G.periodToDecimal(V.close)+re,G.periodToDecimal(V.open)+re]})),M.length<n.daysOfWeek.length&&n.createBoundsFromDays(M).forEach(V=>L.push({pattern:"day of week",bounds:V})),R.rangebreaks=L}if(i.size===h.axes.length)return{v:i}}}}},g=0;g<m.length;g+=1){var C=b();if(typeof C=="object")return C.v}return i}getPlotlyChartType(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case n.plot.SeriesPlotStyle.LINE:return"scatter";case n.plot.SeriesPlotStyle.BAR:case n.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case n.plot.SeriesPlotStyle.PIE:return"pie";case n.plot.SeriesPlotStyle.TREEMAP:return"treemap";case n.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case n.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,n){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(G.MODE_LINES),(n??!0)&&a.add(G.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(G.MODE_LINES),(n??!1)&&a.add(G.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.PIE:switch(t){case n.plot.SourceType.X:return"labels";case n.plot.SourceType.Y:return"values"}break;case n.plot.SeriesPlotStyle.OHLC:switch(t){case n.plot.SourceType.TIME:return"x"}break;case n.plot.SeriesPlotStyle.TREEMAP:switch(t){case n.plot.SourceType.X:return"ids";case n.plot.SourceType.Y:return"values";case n.plot.SourceType.LABEL:return"labels";case n.plot.SourceType.PARENT:return"parents";case n.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case n.plot.SourceType.X:return"x";case n.plot.SourceType.Y:return"y";case n.plot.SourceType.Z:return"z";case n.plot.SourceType.X_LOW:return"xLow";case n.plot.SourceType.X_HIGH:return"xHigh";case n.plot.SourceType.Y_LOW:return"yLow";case n.plot.SourceType.Y_HIGH:return"yHigh";case n.plot.SourceType.TIME:return"time";case n.plot.SourceType.OPEN:return"open";case n.plot.SourceType.HIGH:return"high";case n.plot.SourceType.LOW:return"low";case n.plot.SourceType.CLOSE:return"close";case n.plot.SourceType.SHAPE:return"shape";case n.plot.SourceType.SIZE:return"size";case n.plot.SourceType.LABEL:return"label";case n.plot.SourceType.COLOR:return"color";case n.plot.SourceType.PARENT:return"parent";case n.plot.SourceType.HOVER_TEXT:return"hovertext";case n.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,n,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(n=t.axis)===null||n===void 0?void 0:n.type)===i.plot.AxisType.Y?G.ORIENTATION.HORIZONTAL:G.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,{name:a,isLinesVisible:s,isShapesVisible:o,plotStyle:l,lineColor:d,shapeColor:h,sources:c,shape:f,shapeSize:p}=e,m=c.some(S=>{var E;return(E=S.axis)===null||E===void 0?void 0:E.businessCalendar}),b=this.getChartType(l,m),g=this.getPlotlyChartMode(l,s??void 0,o??void 0),C=this.getPlotlySeriesOrientation(e),y=G.makeSeriesData(b,g,a,i,C);return this.addSourcesToSeriesData(y,l,c,t),this.addStylingToSeriesData(y,l,d,h,f,p,n),y}addSourcesToSeriesData(e,t,n,i){for(var a=e,s=0;s<n.length;s+=1){var o=n[s],{axis:l,type:d}=o,h=this.getPlotlyProperty(t,d);hc(a,h,[]);var c=l!=null?this.getAxisPropertyName(l.type):null;if(c!=null){var f=i.get(l.type);if(f){var p=f.indexOf(l),m=p>0?"".concat(p+1):"";a["".concat(c,"axis")]="".concat(c).concat(m)}}}}addStylingToSeriesData(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,{dh:l}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===l.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===l.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===l.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===l.plot.SeriesPlotStyle.HISTOGRAM?d.width=[]:t===l.plot.SeriesPlotStyle.PIE?d.textinfo="label+percent":t===l.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center"),n!=null&&(t===l.plot.SeriesPlotStyle.BAR?d.marker.color=n:d.line.color=n),i!=null&&(d.marker.color=i),a!=null&&a.length>0)try{d.marker.symbol=G.getMarkerSymbol(a)}catch(h){Wr.warn("Unable to handle shape",a,":",h)}s!=null&&(d.marker.size=s*G.DEFAULT_MARKER_SIZE),o!=null&&t!==l.plot.SeriesPlotStyle.PIE&&(d.visible=o)}getChartType(e,t){var{dh:n}=this;switch(e){case n.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,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=e,o=G.getAllAxes(t),l=0;l<t.charts.length;l+=1){var d=t.charts[l],h=n==null?void 0:n(d),c=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(s,d.axes,o,i,a,c,h)}this.removeStaleAxes(s,o)}getChartBounds(e,t,n,i){var a,{dh:s}=this,{cols:o,rows:l}=e,{column:d,colspan:h,row:c,rowspan:f}=t,p=d+h,m=c+f,b=1/o,g=1/l,C=G.AXIS_SIZE_PX/n,y=G.AXIS_SIZE_PX/i,S={bottom:(l-m)*g+(m<l?y/2:0),top:(l-c)*g-(c>0?y/2:0),left:d*b+(d>0?C/2:0),right:p*b-(p<o?C/2:0)},E=G.groupArray(t.axes,"position"),w=(a=E.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return w.length>0&&(n>0?S.right-=(S.right-S.left)*Math.max(0,Math.min(G.LEGEND_WIDTH_PX/n,G.MAX_LEGEND_SIZE)):S.right-=(S.right-S.left)*G.DEFAULT_AXIS_SIZE),S}getPlotlyDateFormat(e,t,n){var{dh:i}=this,a=n==null?void 0:n.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",""),s,o=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&Gd(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(s=i.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:a,ticksuffix:s,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:n}=this,{axis:i,columnType:a}=e,{formatPattern:s}=i,o=null;return Ne.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=G.addTickSpacing(o,i,!0)):Ne.isNumberType(a)&&(o=G.getPlotlyNumberFormat(t,a,s),o=G.addTickSpacing(o,i,!1)),i.formatType===n.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}updateLayoutAxes(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},o=arguments.length>6?arguments[6]:void 0,{dh:l}=this,d=i>0?Math.max(G.MIN_AXIS_SIZE,Math.min(G.AXIS_SIZE_PX/a,G.MAX_AXIS_SIZE)):G.DEFAULT_AXIS_SIZE,h=a>0?Math.max(G.MIN_AXIS_SIZE,Math.min(G.AXIS_SIZE_PX/i,G.MAX_AXIS_SIZE)):G.DEFAULT_AXIS_SIZE,c=e,f=G.groupArray(t,"position"),p=G.groupArray(t,"type"),m=[...p.keys()],b=G.groupArray(n,"type"),g=0;g<m.length;g+=1){var C=m[g],y=this.getAxisPropertyName(C);if(y!=null){var S=p.get(C),E=b.get(C),w=C===l.plot.AxisType.Y,I=w?a:i;z(S),z(E);for(var O=0;O<S.length;O+=1){var T=S[O],N=E.indexOf(T),R=G.getAxisLayoutProperty(y,N);c[R]==null&&(c[R]={});var W=c[R];if(W!=null){this.updateLayoutAxis(W,T,O,f,d,h,s);var{range:L,autorange:D}=W;if(o!=null&&L!==void 0&&(D===void 0||D===!1)){var M=o(T),[F,k]=M(L);Wr.debug("Setting downsample range",I,F,k),T.range(I,F,k)}else T.range(I)}}}}}removeStaleAxes(e,t){for(var n=e,i=G.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);z(l);var d=l.length,h=this.getAxisPropertyName(o);if(h!=null)for(var c=G.getAxisLayoutProperty(h,d);n[c]!=null;)delete n[c],d+=1,c=G.getAxisLayoutProperty(h,d)}}updateLayoutAxis(e,t,n,i,a,s,o){var l,{dh:d}=this,h=t.type===d.plot.AxisType.Y,c=h?s:a,f=e,p=(l=t.label)!==null&&l!==void 0?l:"";if(f.title!==void 0&&typeof f.title!="string"?f.title.text=p:f.title={text:p},t.log&&(f.type="log"),f.side=this.getAxisSide(t.position),n>0){var m,b;f.overlaying=(m=this.getAxisPropertyName(t.type))!==null&&m!==void 0?m:void 0;var g=(b=i.get(t.position))!==null&&b!==void 0?b:[],C=g.indexOf(t);C>0&&(f.anchor="free",t.position===d.plot.AxisPosition.RIGHT?f.position=o.right+(C-g.length+1)*c:t.position===d.plot.AxisPosition.TOP?f.position=o.top+(C-g.length+1)*c:t.position===d.plot.AxisPosition.BOTTOM?f.position=o.bottom+(g.length-C+1)*c:t.position===d.plot.AxisPosition.LEFT&&(f.position=o.left+(g.length-C+1)*c))}else if(t.type===d.plot.AxisType.X){var y=i.get(d.plot.AxisPosition.LEFT)||[],S=i.get(d.plot.AxisPosition.RIGHT)||[],E=Math.max(o.left,o.left+(y.length-1)*s),w=Math.min(o.right-(S.length-1)*s,o.right);f.domain=[E,w]}else if(t.type===d.plot.AxisType.Y){var I=i.get(d.plot.AxisPosition.BOTTOM)||[],O=i.get(d.plot.AxisPosition.TOP)||[],T=Math.max(o.bottom,o.bottom+(I.length-1)*a),N=Math.min(o.top-(O.length-1)*a,o.top);f.domain=[T,N]}}createBoundsFromDays(e){var t=e.map(s=>this.daysOfWeek.indexOf(s)),n=this.daysOfWeek.filter(s=>!e.includes(s)).map(s=>this.daysOfWeek.indexOf(s)),i=new Set;n.forEach(s=>{for(var o=s+1;o<s+this.daysOfWeek.length;o+=1){var l=o%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(s=>{for(var o=s-1;o>s-this.daysOfWeek.length;o-=1){var l=o<0?o+this.daysOfWeek.length:o;if(t.includes(l)){var d=(l+1)%7;a.push([d,s]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,n){var i=[],a=[];return e.forEach(s=>{s.businessPeriods.length>0?a.push(...this.createPartialHoliday(s,t,n)):i.push(this.createFullHoliday(s,t,n))}),[{values:i},...a]}createFullHoliday(e,t,n){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,n)}createPartialHoliday(e,t,n){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(f=>{a.push(f.open),a.push(f.close)}),a.push("24:00");for(var s=[],o=0;o<a.length;o+=2){var l=a[o],d=a[o+1];if(l!==d){var h=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,n)],c=Mw*(G.periodToDecimal(d)-G.periodToDecimal(l));s.push({values:h,dvalue:c})}}return s}adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Wd,t),n):e}makeFigureSettings(e,t){var{dh:n}=this,{series:i,xAxis:a,type:s}=e,o=G.titleFromSettings(e),l={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.X),position:"".concat(n.plot.AxisPosition.BOTTOM)},d={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.Y),position:"".concat(n.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(n.plot.ChartType.XY),axes:[l,d],series:(i??[]).map(h=>({plotStyle:"".concat(s),name:h,dataSources:[{type:"".concat(n.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(n.plot.SourceType.Y),columnName:h,axis:d,table:t}]}))}],title:o}}unwrapValue(e,t){var{dh:n}=this;if(e!=null){if(Fw(e))return n.i18n.DateTimeFormat.format(G.DATE_FORMAT,e,t);if(Aw(e))return e.asNumber()}return e}wrapValue(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(Ne.isDateType(t)&&typeof e=="string"){var a=e,s=G.DATE_FORMAT.substr(0,e.length),o=i.i18n.DateTimeFormat.parse(s,a);if(!n)return o;var l="".concat(s," Z"),d=i.i18n.DateTimeFormat.format("Z",o,n),h=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d)),c=i.i18n.DateTimeFormat.format("Z",h,n);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(c))}return e}makeLayoutAxis(e,t){var{dh:n}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticks:"outside",ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}},legend:{font:{color:t.legend_color}}};return e===n.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===n.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultTemplate(e){var{error_band_line_color:t,ohlc_increasing:n,ohlc_decreasing:i,title_color:a}=e;return{data:{bar:[{marker:{line:{color:"transparent"}}}],scatter:[{error_x:{color:t},error_y:{color:t}}],ohlc:[{increasing:{line:{color:n}},decreasing:{line:{color:i}}}],pie:[{outsidetextfont:{color:a}}],treemap:[{outsidetextfont:{color:a}}]},layout:this.makeDefaultLayout(e)}}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:n,plot_bgcolor:i,title_color:a,coastline_color:s,land_color:o,ocean_color:l,lake_color:d,river_color:h}=e,c={paper_bgcolor:n,plot_bgcolor:i,autosize:!0,colorway:G.normalizeColorway(e==null?void 0:e.colorway),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},xanchor:"center",xref:"paper",yanchor:"top",pad:Vi({},G.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:Vi({},G.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:n,coastlinecolor:s,landcolor:o,oceancolor:l,lakecolor:d,rivercolor:h}};return c.datarevision=0,c}hydrateSettings(e){var{dh:t}=this;return Vi(Vi({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}Ue(G,"DEFAULT_AXIS_SIZE",.15);Ue(G,"MIN_AXIS_SIZE",.025);Ue(G,"MAX_AXIS_SIZE",.2);Ue(G,"AXIS_SIZE_PX",75);Ue(G,"LEGEND_WIDTH_PX",50);Ue(G,"MAX_LEGEND_SIZE",.25);Ue(G,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));Ue(G,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");Ue(G,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));Ue(G,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));Ue(G,"SUBTITLE_LINE_HEIGHT",25);Ue(G,"DEFAULT_MARKER_SIZE",6);Ue(G,"MODE_MARKERS","markers");Ue(G,"MODE_LINES","lines");const xe=G;function jw(r,e,t){return e=kw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kw(r){var e=$w(r,"string");return typeof e=="symbol"?e:String(e)}function $w(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Cf extends Error{constructor(){super(...arguments),jw(this,"isDownsamplingError",!0)}}const Uw="var(--dh-color-chart-colorway)",Hw="var(--dh-color-chart-grid)",Vw="var(--dh-color-chart-axis-line)",Bw="var(--dh-color-chart-axis-line-zero)",zd={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:Uw,gridcolor:Hw,linecolor:Vw,zerolinecolor:Bw,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var Kd=B.module("ChartTheme");function ol(){var r,e=Po(zd);return e.colorway=fc((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Vg.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),Kd.debug2("Chart theme:",zd),Kd.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}var ll=v.createContext(null);function Sf(r){var{children:e}=r,{activeThemes:t}=jr(),n=v.useMemo(ol,[t]);return u.jsx(ll.Provider,{value:n,children:e})}function dl(){return Rr(ll,"No ChartThemeContext value found.")}function qd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qd(Object(t),!0).forEach(function(n){Ge(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ge(r,e,t){return e=Ww(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ww(r){var e=Gw(r,"string");return typeof e=="symbol"?e:String(e)}function Gw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var on=B.module("Chart");class bn extends v.Component{static convertIcon(e){var[t,,,,n]=e.icon,i="".concat(n);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),Ge(this,"currentSeries",void 0),Ge(this,"PlotComponent",void 0),Ge(this,"plot",void 0),Ge(this,"plotWrapper",void 0),Ge(this,"columnFormats",void 0),Ge(this,"dateTimeFormatterOptions",void 0),Ge(this,"decimalFormatOptions",void 0),Ge(this,"integerFormatOptions",void 0),Ge(this,"rect",void 0),Ge(this,"ranges",void 0),Ge(this,"isSubscribed",void 0),Ge(this,"isLoadedFired",void 0),Ge(this,"resizeObserver",void 0),Ge(this,"getCachedConfig",se((n,i,a,s,o,l)=>{var d=[],h=!!n;h&&d.push({name:"Downsampling failed: ".concat(n),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(n))},icon:bn.convertIcon(ql),attr:"fill-warning"});var c=!!l;if(c&&d.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:bn.convertIcon(ql),attr:"fill-warning"}),i||a||s||h){var f=bn.downsampleButtonTitle(a,s),p=bn.downsampleButtonAttr(a,s),m=a?Bg:Wg;d.push({name:f,title:"Downsampling status",icon:bn.convertIcon(m),click:this.handleDownsampleClick,attr:p})}var b=o.some(S=>{var{type:E}=S;return E!=null&&!E.includes("3d")}),g=o.some(S=>{var{type:E}=S;return E!=null&&E.includes("3d")}),C=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],y=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||h||c?!0:"hover",modeBarButtons:[d,["toImage"],["zoom2d","pan2d"],[...b?C:[],...g?y:[]]]}})),Hc(this),this.PlotComponent=bf(e.Plotly),this.plot=X.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:X.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),this.handleThemeChange()}componentDidUpdate(e){var{isActive:t,model:n,settings:i,theme:a}=this.props;this.updateFormatterSettings(i),n!==e.model&&(this.unsubscribe(e.model),this.subscribe(n)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(n)):this.unsubscribe(n)),a!==e.theme&&this.handleThemeChange()}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;this.setState(t=>{var{layout:n}=t;return{data:e.getData(),layout:dr(dr({},n),e.getLayout())}})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){on.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:n}=e;switch(on.debug2("Received data update",t,n),t){case St.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:m,revision:b}=p;return typeof m.datarevision=="number"&&(m.datarevision+=1),{data:n,layout:m,revision:b+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case St.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case St.EVENT_DISCONNECT:{var{onDisconnect:s}=this.props;s();break}case St.EVENT_RECONNECT:{var{onReconnect:o}=this.props;o();break}case St.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case St.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case St.EVENT_DOWNSAMPLENEEDED:case St.EVENT_DOWNSAMPLEFAILED:{var l,d=(l=n.message)!==null&&l!==void 0?l:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:d});var{onError:h}=this.props;h(new Cf(d));break}case St.EVENT_ERROR:{var c="".concat(n);this.setState({error:c});var{onError:f}=this.props;f(new Error(c));break}default:on.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,n=xe.getLayoutRanges(t),i=!Mt(n,this.ranges);i&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(on.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,n]=e;if(on.debug("handleRestyle",t,n),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var s=i.reduce((o,l)=>{var{name:d,visible:h}=l;return d!=null&&h==="legendonly"?[...o,d]:o},[]);a({hiddenSeries:s})}}}handleThemeChange(){var{theme:e,model:t}=this.props,{dh:n}=t,i=new xe(n);this.setState(a=>{var{layout:s}=a;return{layout:dr(dr({},s),{},{template:i.makeDefaultTemplate(e)})}})}toggleErrorMessage(e){this.setState(t=>{var{shownError:n}=t;return{shownError:n===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){on.warn("Unable to get plotting rect");return}var n=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(n||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=wn.getColumnFormats(e),n=wn.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!Mt(this.columnFormats,t)||!Mt(this.dateTimeFormatterOptions,n)||!Mt(this.decimalFormatOptions,i)||!Mt(this.integerFormatOptions,a))&&(this.columnFormats=wn.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new _r(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(n=>{on.debug("Unable to resize, promise rejected",n)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:n,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:s,error:o,shownError:l,layout:d,revision:h}=this.state,c=this.getCachedConfig(n,i,a,s,t??[],o),f=t!=null;return u.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[f&&u.jsx(e,{ref:this.plot,data:t,layout:d,revision:h,config:c,onAfterPlot:this.handleAfterPlot,onError:on.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),u.jsx(yi,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"chart-error",children:l}),u.jsx(Io,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}Ge(bn,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:No.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:Ro,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});function ul(r){var e=dl();return u.jsx(bn,dr(dr({},r),{},{theme:e}))}function Yd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Xd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yd(Object(t),!0).forEach(function(n){Pe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Yd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pe(r,e,t){return e=zw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zw(r){var e=Kw(r,"string");return typeof e=="symbol"?e:String(e)}function Kw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fe=B.module("FigureChartModel");class Wa extends St{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(e),n=this,Pe(this,"chartUtils",void 0),Pe(this,"dh",void 0),Pe(this,"figure",void 0),Pe(this,"settings",void 0),Pe(this,"data",void 0),Pe(this,"layout",void 0),Pe(this,"seriesDataMap",void 0),Pe(this,"pendingSeries",void 0),Pe(this,"oneClicks",void 0),Pe(this,"filterColumnMap",void 0),Pe(this,"lastFilter",void 0),Pe(this,"isConnected",void 0),Pe(this,"seriesToProcess",void 0),Pe(this,"addPendingSeries",Le(()=>{for(var a=xe.getAxisTypeMap(this.figure),{pendingSeries:s}=this,o=function(){var h,c=s[l],f=n.figure.charts.find(p=>p.series.includes(c));n.addSeries(c,a,(h=f==null?void 0:f.showLegend)!==null&&h!==void 0?h:null),c.subscribe()},l=0;l<s.length;l+=1)o();this.pendingSeries=[]},Wa.ADD_SERIES_DEBOUNCE)),Pe(this,"getTimeZone",ot((a,s)=>{if(s!=null){var o=s.getColumnTypeFormatter(a);if(o!=null)return o.dhTimeZone}})),Pe(this,"getValueTranslator",ot((a,s)=>{var o=this.getTimeZone(a,s);return l=>this.chartUtils.unwrapValue(l,o)})),Pe(this,"getValueParser",ot((a,s)=>{var o=this.getTimeZone(a,s);return l=>this.chartUtils.wrapValue(l,a,o)})),Pe(this,"getRangeParser",ot((a,s)=>o=>{var[l,d]=o,h=this.getValueParser(a,s);return l=h(l),d=h(d),[l,d]})),Pe(this,"getAxisRangeParser",ot((a,s)=>o=>{var l=xe.getSourceForAxis(a,o);return l!=null?this.getRangeParser(l.columnType,s):d=>d})),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 xe(e),this.figure=t,this.settings=i,this.data=[],this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"}},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,n=xe.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var f=t[s],p=0;p<f.series.length;p+=1){var m=f.series[p];i.push(m.name),e.addSeries(m,n,f.showLegend)}var{axes:b,title:g}=f;if(g!=null&&g.length>0&&(t.length>1||e.figure.title!=null)){var C=b.find(R=>R.type===e.dh.plot.AxisType.X),y=b.find(R=>R.type===e.dh.plot.AxisType.Y);if(C==null||y==null)Fe.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",f);else{var S,E,w,I,O=((S=(E=n.get(C.type))===null||E===void 0?void 0:E.findIndex(R=>R===C))!==null&&S!==void 0?S:0)+1,T=((w=(I=n.get(y.type))===null||I===void 0?void 0:I.findIndex(R=>R===y))!==null&&w!==void 0?w:0)+1,N={align:"center",x:.5,y:1,yshift:17,text:g,showarrow:!1,xref:"x".concat(O," domain"),yref:"y".concat(T," domain")};e.layout.annotations==null?e.layout.annotations=[N]:e.layout.annotations.push(N)}}},s=0;s<t.length;s+=1)a();for(var o=[...this.seriesDataMap.keys()],l=o.filter(c=>i.indexOf(c)<0),d=0;d<l.length;d+=1){var h=l[d];this.seriesDataMap.delete(h)}}addSeries(e,t,n){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,xe.getSeriesVisibility(e.name,this.settings),n);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=xe.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?n??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,l=0;l<o.length;l+=1)this.filterColumnMap.set(o[l].name,o[l]);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){Fe.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&&(Fe.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){Fe.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){Fe.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){Fe.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){Fe.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:n}=t;Fe.debug2("handleFigureUpdated",n);for(var i=0;i<n.length;i+=1){var a=n[i];Fe.debug2("handleFigureUpdated updating series",a.name);for(var{sources:s}=a,o=0;o<s.length;o+=1){var l=s[o],{columnType:d,type:h}=l,c=this.getValueTranslator(d,this.formatter),f=t.getArray(a,h,c);this.setDataArrayForSeries(a,h,f)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){Fe.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){Fe.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){Fe.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;Fe.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,n;super.setTitle(e);var i=(t=(n=(e??"").match(/<br>/g))===null||n===void 0?void 0:n.length)!==null&&t!==void 0?t:0,a=xe.DEFAULT_MARGIN.t+i*xe.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=Xd({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=Xd({},this.layout.title.pad),this.layout.title.pad.t=xe.DEFAULT_TITLE_PADDING.t+i*xe.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,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)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&n!==void 0?n:0),0)}getPlotHeight(){var e,t,n,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)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&n!==void 0?n:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,n)=>{Fe.debug("Assigning ".concat(n),this.layout[n],t);var i=this.layout[n];i!=null?Object.assign(i,t):Fe.debug("Ignoring null layout.".concat(n))})}}setDataArrayForSeries(e,t,n){var{name:i,plotStyle:a}=e,s=this.seriesDataMap.get(i),o=this.chartUtils.getPlotlyProperty(a,t);s&&hc(s,o,n)}cleanSeries(e){var{dh:t}=this,{name:n,plotStyle:i}=e,a=this.seriesDataMap.get(n);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:s,xHigh:o}=a;if(s&&o&&s.length===o.length){for(var l=[],d=0;d<s.length;d+=1)l.push(o[d]-s[d]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:h,xLow:c,xHigh:f,y:p,yLow:m,yHigh:b}=a;c&&f&&c!==h&&(a.error_x=xe.getPlotlyErrorBars(h,c,f)),m&&b&&m!==p&&(a.error_y=xe.getPlotlyErrorBars(p,m,b))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:g,labels:C}=a;g!==void 0&&C===void 0&&(a.labels=g)}}}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){Fe.warn("Trying to set a filter, but no one click!");return}Fe.debug("setFilter",e);for(var n=function(){var s=t.oneClicks[i],{columns:o}=s,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(d=>{var h=e.get(d);t.lastFilter.get(d)!==h&&o.find(c=>c.name===d)!=null&&s.setValueForColumn(d,h)})},i=0;i<this.oneClicks.length;i+=1)n();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}}Pe(Wa,"ADD_SERIES_DEBOUNCE",50);const eo=Wa;function Zd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Es(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Zd(a,n,i,s,o,"next",l)}function o(l){Zd(a,n,i,s,o,"throw",l)}s(void 0)})}}class hl{static makeModelFromSettings(e,t,n){return Es(function*(){var i=yield hl.makeFigureFromSettings(e,t,n);return new eo(e,i,t)})()}static makeFigureFromSettings(e,t,n){return Es(function*(){var i=yield n.copy();return i.applyCustomColumns(n.customColumns),i.applyFilter(n.filter),i.applySort(n.sort),e.plot.Figure.create(new xe(e).makeFigureSettings(t,i))})()}static makeModel(e,t,n){return Es(function*(){return new eo(e,n,t)})()}}const mr=hl;function gr(r,e,t){return e=qw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qw(r){var e=Yw(r,"string");return typeof e=="symbol"?e:String(e)}function Yw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class be extends St{static get theme(){return be._theme==null&&(be._theme=ol()),be._theme}static makeRandomSeries(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,i=[],a=[],s=[],o=[],l=new Date("2018-06-01"),d=0;d<n;d+=1){var h=new Date(l.getFullYear(),l.getMonth(),l.getDate()+d-n);i.push("".concat(h.getFullYear(),"-").concat(h.getMonth()+1,"-").concat(h.getDate()));var c=(Math.sin(d/n*e)*n/3+Math.cos(d*.2)*n/6+Math.sin(d*.5)*n/10+be.random()*n/5+d*be.smoothing)*t;c=Math.round(c*100)/100,a.push(c),o.push(40+d*be.smoothing),s.push(Math.sin(d/n*e)*n/3+be.random()*n/10+d*be.smoothing)}return{x:i,y:a,s,l:o}}static makeScatter(e){return{name:"SCTR",x:e.x,y:e.y,type:"scatter",mode:"markers",hoverinfo:"skip",marker:{size:5}}}static makeArea(e){return{name:"AREA",x:e.x,y:e.s,type:"scatter",mode:"line",fill:"tozeroy",hoverinfo:"all",line:{width:3}}}static makeTrendline(e){return{name:"Trendline <br>R<sup>2</sup> = 0.91",x:e.x,y:e.l,type:"scatter",mode:"line",hoverinfo:"skip",line:{width:3,dash:"dot"}}}static makeErrorBand(e){for(var t=[],n=[],i=0;i<e.y.length;i+=1){var a=e.y[i];t[i]=Math.round((a+18)*100)/100,n[i]=Math.round((a-18)*100)/100}var s=t.concat(n.reverse());return{name:"error",x:e.x.concat(e.x.slice().reverse()),y:s,type:"scatter",mode:"line",hoverinfo:"skip",fill:"toself",line:{width:0,color:be.theme.error_band_line_color,shape:"spline"}}}static makeLine(e){return{name:"LINE",x:e.x,y:e.y,type:"scatter",mode:"line",hoverinfo:"x+y+text+name",line:{width:3}}}static makeRandomData(){var e=be.makeRandomSeries(6),t=be.makeArea(e),n=be.makeTrendline(e),i=be.makeRandomSeries(2),a=be.makeLine(i),s=be.makeErrorBand(i);return[t,n,a,s]}static makeDefaultLayout(e){var t={template:new xe(e).makeDefaultTemplate(be.theme)};return t.title="Chart",t.xaxis={title:"Datestamp"},t.yaxis={title:"Price"},t}constructor(e){var{data:t=be.makeRandomData(),layout:n=be.makeDefaultLayout(e),filterFields:i=[]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(e),gr(this,"data",void 0),gr(this,"filterFields",void 0),gr(this,"layout",void 0),this.data=t,this.layout=n,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 n=this.filterFields[t],i="java.lang.String";e.set(n,{name:n,type:i})}return e}isFilterRequired(){return this.filterFields.length>0}setFilter(){this.fireUpdate(this.data)}}gr(be,"random",Math.random.bind(Math));gr(be,"smoothing",1.5);gr(be,"_theme",void 0);const Xw=be,yf=bf(Ro);function to(r){return r.setFigure!==void 0}const Zw=Object.freeze(Object.defineProperty({__proto__:null,Chart:ul,ChartModel:St,ChartModelFactory:mr,ChartThemeContext:ll,ChartThemeProvider:Sf,ChartUtils:xe,DownsamplingError:Cf,FigureChartModel:eo,MockChartModel:Xw,Plot:yf,defaultChartTheme:ol,isFigureChartModel:to,useChartTheme:dl},Symbol.toStringTag,{value:"Module"}));var Ef=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 wf(r){return r.componentName!==void 0}function Qw(r){return r.component!==void 0}var Pf=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Jw=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ef,isGLComponentConfig:wf,isReactComponentConfig:Qw,itemDefaultConfig:Pf},Symbol.toStringTag,{value:"Module"}));function sa(r,e,t){return e=eP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eP(r){var e=tP(r,"string");return typeof e=="symbol"?e:String(e)}function tP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ci{constructor(){sa(this,"_mSubscriptions",void 0),sa(this,"off",this.unbind),sa(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[ci.ALL_EVENT]=[]}on(e,t,n){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:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];if(t)for(var s=0;s<t.length;s++){var o=t[s].ctx||{};try{t[s].fn.apply(o,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[ci.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,n){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)&&(!n||n===this._mSubscriptions[e][a].ctx)&&(this._mSubscriptions[e].splice(a,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}sa(ci,"ALL_EVENT","__all");const Ft=ci;function _t(r,e,t){return e=nP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nP(r){var e=rP(r,"string");return typeof e=="symbol"?e:String(e)}function rP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class no extends Ft{constructor(e,t,n){super(),_t(this,"width",void 0),_t(this,"height",void 0),_t(this,"title",void 0),_t(this,"parent",void 0),_t(this,"layoutManager",void 0),_t(this,"tab",void 0),_t(this,"_config",void 0),_t(this,"isHidden",!1),_t(this,"beforeCloseHandler",void 0),_t(this,"_element",Z(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),_t(this,"_contentElement",void 0),this.title=wf(e)?e.componentName:"",this.parent=t,this.layoutManager=n,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 n,i,a,s=this.parent,o=null;s&&!s.isColumn&&!s.isRow;){var l;if(o=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!o)return!1;for(var d=s.isColumn?"height":"width",h=d==="height"?t:e,c=((n=this[d])!==null&&n!==void 0?n:0)*(1/(((i=o.config[d])!==null&&i!==void 0?i:0)/100)),f=h/c*100,p=(((a=o.config[d])!==null&&a!==void 0?a:0)-f)/(s.contentItems.length-1),m=0;m<s.contentItems.length;m++)if(s.contentItems[m]===o)s.contentItems[m].config[d]=f;else{var b;s.contentItems[m].config[d]=((b=s.contentItems[m].config[d])!==null&&b!==void 0?b:0)+p}return s.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.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(Z.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 n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,a=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-a),this.emit("resize")}}}const iP=Object.freeze(Object.defineProperty({__proto__:null,Container:no,ItemContainer:no},Symbol.toStringTag,{value:"Module"}));function _f(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function Tf(r){if(window.location.hash)return _f(r);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,i;for(i=0;i<e.length;i++)n=e[i].split("="),t[n[0]]=n[1];return t[r]||null}function cl(r){return window.requestAnimationFrame(r)}function aP(r,e){var t=e.indexOf(r);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function vl(){return(Math.random()*1e15).toString(36).replace(".","")}function sP(r,e){var t=r.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 fl(r){return Z.trim(r.replace(/(<([^>]+)>)/gi,""))}function lt(r,e,t){return e=oP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oP(r){var e=lP(r,"string");return typeof e=="symbol"?e:String(e)}function lP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class dP extends Ft{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),lt(this,"_eElement",void 0),lt(this,"_oDocument",void 0),lt(this,"_eBody",void 0),lt(this,"_destroyAfterMouseUp",void 0),lt(this,"_nDelay",400),lt(this,"_timeout",void 0),lt(this,"timeout",void 0),lt(this,"_nDistance",10),lt(this,"_nX",0),lt(this,"_nY",0),lt(this,"_nOriginalX",0),lt(this,"_nOriginalY",0),lt(this,"_bDragging",!1),this._eElement=e,this._oDocument=Z(document),this._eBody=Z(document.body),this._destroyAfterMouseUp=n,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,n,i,a,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=s.y)!==null&&n!==void 0?n: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,n;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=i.y)!==null&&n!==void 0?n: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,n,i,a,s;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.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)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var o;(o=this._eElement)===null||o===void 0||o.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,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"),(n=this._oDocument)===null||n===void 0||(i=n.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}const Oi=dP;function er(r,e,t){return e=uP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uP(r){var e=hP(r,"string");return typeof e=="symbol"?e:String(e)}function hP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Of{constructor(e,t){er(this,"_container",void 0),er(this,"_reactComponent",null),er(this,"_portalComponent",null),er(this,"_originalComponentWillUpdate",null),er(this,"_initialState",void 0),er(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=xa.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 n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.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=Z.extend(e,this._container._config.props);return X.createElement(this._reactClass,t)}}var ga=["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"],cP=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function pl(r){if(ga.length>36)throw new Error("Too many keys in config minifier map");var e={};return ml(r,e,"_min"),e}function ro(r){if(ga.length>36)throw new Error("Too many keys in config minifier map");var e={};return ml(r,e,"_max"),e}function ml(r,e,t){var n=t==="_min"?vP:fP;for(var i in r)if(r.hasOwnProperty(i)){var a=Array.isArray(r)?r[Number.parseInt(i,10)]:r[i];if(typeof a=="object"&&a!=null){var s=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=s;else{var o=n(i,ga);e[o]=s}ml(a,s,t)}else{var l=n(a,cP);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,ga);e[d]=l}}}}function vP(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function fP(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function ws(r,e,t){return e=pP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pP(r){var e=mP(r,"string");return typeof e=="symbol"?e:String(e)}function mP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class io{constructor(e,t){ws(this,"name",void 0),ws(this,"origin",void 0),ws(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Bi(r,e,t){return e=gP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gP(r){var e=bP(r,"string");return typeof e=="symbol"?e:String(e)}function bP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let CP=class extends Ft{constructor(e){super(),Bi(this,"_layoutManager",void 0),Bi(this,"_dontPropagateToParent",void 0),Bi(this,"_childEventSource",void 0),Bi(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ft.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),Z(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];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,n="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(n,!0,!0),i.eventName=n,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){Z(window).off("gl_child_event",this._boundOnEventFromChild)}};const Df=CP,SP=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:io,DragListener:Oi,EventEmitter:Ft,EventHub:Df,ReactComponentHandler:Of,animFrame:cl,filterXss:sP,getHashValue:_f,getQueryStringParam:Tf,getUniqueId:vl,minifyConfig:pl,removeFromArray:aP,stripTags:fl,unminifyConfig:ro},Symbol.toStringTag,{value:"Module"}));function ln(r,e,t){return e=yP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yP(r){var e=EP(r,"string");return typeof e=="symbol"?e:String(e)}function EP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class If extends Ft{constructor(e,t,n,i,a){super(),ln(this,"isInitialised",!1),ln(this,"_config",void 0),ln(this,"_dimensions",void 0),ln(this,"_parentId",void 0),ln(this,"_indexInParent",void 0),ln(this,"_layoutManager",void 0),ln(this,"_popoutWindow",null),ln(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=a,this._createWindow()}toConfig(){var e,t,n,i,a,s,o,l,d,h,c;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:(n=(i=(a=this._popoutWindow)===null||a===void 0?void 0:a.screenX)!==null&&i!==void 0?i:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&n!==void 0?n:0,top:(o=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&o!==void 0?o:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.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,n=null;if(this._parentId){var i;if(t=Z.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var a;((a=this._layoutManager.root.contentItems.length)!==null&&a!==void 0?a:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=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,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;Z(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(a))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+vl();e=pl(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var n=document.location.href.split("?");return n.length===1?n[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(r,e,t){return e=wP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wP(r){var e=PP(r,"string");return typeof e=="symbol"?e:String(e)}function PP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zn extends Ft{constructor(e,t,n,i,a,s){var o,l,d,h,c,f,p,m;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=n,this._layoutManager=i,this._contentItem=a,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var b,g;this._layoutManager.tabDropPlaceholder.width((b=this._contentItem.tab.element.outerWidth(!0))!==null&&b!==void 0?b:0),this._layoutManager.tabDropPlaceholder.height((g=this._contentItem.tab.element.outerHeight(!0))!==null&&g!==void 0?g:0)}if(this.element=Z(zn._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._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",fl((o=this._contentItem.config.title)!==null&&o!==void 0?o:"")),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(),Z(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var C,y;this._layoutManager.tabDropPlaceholder.width((C=this._proxyTab.outerWidth(!0))!==null&&C!==void 0?C:0),this._layoutManager.tabDropPlaceholder.height((y=this._proxyTab.outerHeight(!0))!==null&&y!==void 0?y:0)}var S=this._layoutManager.container.offset();this._minX=(d=S==null?void 0:S.left)!==null&&d!==void 0?d:0,this._minY=(h=S==null?void 0:S.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(m=this.element.height())!==null&&m!==void 0?m:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,a,s=(i=n.pageX)!==null&&i!==void 0?i:0,o=(a=n.pageY)!==null&&a!==void 0?a:0,l=s>this._minX&&s<this._maxX&&o>this._minY&&o<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,o)}_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,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Re(zn,"_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 Wi(r,e,t){return e=_P(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _P(r){var e=TP(r,"string");return typeof e=="symbol"?e:String(e)}function TP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class xf{constructor(e,t,n){Wi(this,"_element",void 0),Wi(this,"_itemConfig",void 0),Wi(this,"_layoutManager",void 0),Wi(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Oi(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Z.extend(!0,{},n));new zn(e,t,this._dragListener,this._layoutManager,i,null)}}function Gi(r,e,t){return e=OP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function OP(r){var e=DP(r,"string");return typeof e=="symbol"?e:String(e)}function DP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nf{constructor(e,t,n){Gi(this,"_element",Z(window)),Gi(this,"_itemConfig",void 0),Gi(this,"_layoutManager",void 0),Gi(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Oi(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 n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Z.extend(!0,{},n));new zn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Mf(r,e,t){return e=IP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function IP(r){var e=xP(r,"string");return typeof e=="symbol"?e:String(e)}function xP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Di{constructor(){Mf(this,"element",Z(Di._template)),Z(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()}}Mf(Di,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Ps(r,e,t){return e=NP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function NP(r){var e=MP(r,"string");return typeof e=="symbol"?e:String(e)}function MP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Jr{constructor(e,t,n,i){Ps(this,"element",void 0),Ps(this,"_header",void 0),Ps(this,"_action",void 0),this._header=e,this.element=Z('<li class="'+n+'" 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 LP(r,e,t){return e=FP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function FP(r){var e=AP(r,"string");return typeof e=="symbol"?e:String(e)}function AP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class RP extends Error{constructor(e,t){super(),LP(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const jn=RP,jP=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:jn},Symbol.toStringTag,{value:"Module"}));function Me(r,e,t){return e=kP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kP(r){var e=$P(r,"string");return typeof e=="symbol"?e:String(e)}function $P(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function vi(r){return r.isStack}function ht(r){return r.isComponent}function Lf(r){return r.isRoot}class $e extends Ft{constructor(e,t,n,i){super(),Me(this,"config",void 0),Me(this,"type",void 0),Me(this,"contentItems",void 0),Me(this,"parent",void 0),Me(this,"layoutManager",void 0),Me(this,"element",void 0),Me(this,"childElementContainer",void 0),Me(this,"componentName",void 0),Me(this,"isInitialised",!1),Me(this,"isMaximised",!1),Me(this,"isRoot",!1),Me(this,"isRow",!1),Me(this,"isColumn",!1),Me(this,"isStack",!1),Me(this,"isComponent",!1),Me(this,"tab",void 0),Me(this,"_pendingEventPropagations",void 0),Me(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Ft.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&i!==!0&&this[e].apply(this,t);for(var a=0;a<this.contentItems.length;a++)this.contentItems[a].callDownwards(e,t,n);n===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=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(n!==!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 n=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]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,vi(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=[],n=function i(a){for(var s=0;s<a.contentItems.length;s++)e(a.contentItems[s])===!0&&t.push(a.contentItems[s]),i(a.contentItems[s])};return n(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),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$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"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&ht(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,i;e=e||this.element;var a=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},s=(n=e.width())!==null&&n!==void 0?n:0,o=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+s,y2:a.top+o,surface:s*o,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 io(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new jn("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(Pf)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof io&&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,cl(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Gr(r,e,t){return e=UP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function UP(r){var e=HP(r,"string");return typeof e=="symbol"?e:String(e)}function HP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ff extends $e{constructor(e,t,n){super(e,t,n,Z()),Gr(this,"config",void 0),Gr(this,"componentName",void 0),Gr(this,"container",void 0),Gr(this,"parent",void 0),Gr(this,"instance",void 0),this.config=t,this.parent=n;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=Z.extend(!0,{},this.config.componentState||{});if(i==null)throw new jn('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 no(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(){$e.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),$e.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),$e.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),$e.prototype._$destroy.call(this)}_$getArea(){return null}}function gt(r,e,t){return e=VP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function VP(r){var e=BP(r,"string");return typeof e=="symbol"?e:String(e)}function BP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ba extends $e{constructor(e,t,n,i){super(t,n,i,Z('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),gt(this,"isRow",void 0),gt(this,"isColumn",void 0),gt(this,"childElementContainer",void 0),gt(this,"parent",void 0),gt(this,"_splitter",[]),gt(this,"_splitterSize",void 0),gt(this,"_splitterGrabSize",void 0),gt(this,"_isColumn",void 0),gt(this,"_dimension",void 0),gt(this,"_splitterPosition",null),gt(this,"_splitterMinPosition",null),gt(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,n){var i,a,s,o;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(o=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(o),o.after(e.element)):(this.contentItems[0].element.before(o),o.before(e.element))):this.childElementContainer.append(e.element),$e.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[s].config[this._dimension]=a}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,a=this.contentItems.indexOf(e),s=Math.max(a-1,0),o,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),o=0;o<this.contentItems.length;o++)if(this.contentItems[o]!==e){var d;this.contentItems[o].config[this._dimension]=((d=this.contentItems[o].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}$e.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 n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=n,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($e.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,n=(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,s=0,o=[];this._isColumn?a-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var d,h,c=this._isColumn?Math.floor(a*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));s+=c,o.push(c)}var f=Math.floor((this._isColumn?a:i)-s);return{itemSizes:o,additionalPixel:f,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var a=this.contentItems[i].config[n];a!=null?e+=a:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var s=0;s<t.length;s++)t[s].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var o=0;o<t.length;o++)t[o].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[n]=((d=this.contentItems[l].config[n])!==null&&d!==void 0?d: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,n=[],i=0,a=0,s=0,o=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=d.itemSizes[h];c<t?(a+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),o.push(l)}if(!(a===0||a>i)){var f=a/i;s=a;for(var p=0;p<n.length;p++){l=n[p];var m=Math.round((l.width-t)*f);s-=m,l.width-=m}s!==0&&(o[o.length-1].width-=s);for(var b=0;b<this.contentItems.length;b++)this.contentItems[b].config.width=o[b].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new Af(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,n=0,i=0;i<e.length;++i){var a,s;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),n=Math.max((s=e[i].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,a,s=this._getItemsForSplitter(e),o=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((n=s.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=s.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||o)),this._splitterMaxPosition=((a=s.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(c||o)}_onSplitterDrag(e,t,n){var i=this._isColumn?n: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,n,i,a,s,o=this._getItemsForSplitter(e),l=(t=o.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(n=o.after.element[this._dimension]())!==null&&n!==void 0?n:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((a=o.before.config[this._dimension])!==null&&a!==void 0?a:0)+((s=o.after.config[this._dimension])!==null&&s!==void 0?s:0);o.before.config[this._dimension]=h*c,o.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),cl(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Qd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Jd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qd(Object(t),!0).forEach(function(n){ao(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ao(r,e,t){return e=WP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WP(r){var e=GP(r,"string");return typeof e=="symbol"?e:String(e)}function GP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class so extends $e{constructor(e,t,n){super(e,Jd(Jd({},t),{},{type:"root"}),null,Z('<div class="lm_goldenlayout lm_item lm_root"></div>')),ao(this,"childElementContainer",void 0),ao(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,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 n,i;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n: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,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(ht(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,a=i==="left"||i==="right"?"row":"column",s=i==="left"||i==="right"?"width":"height",o=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof ba)||l.type!=a){var d=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,d),d.addChild(e,o?0:void 0,!0),d.addChild(l,o?void 0:0,!0),l.config[s]=50,e.config[s]=50,d.callDownwards("setSize")}else{var h,c=l.contentItems[o?0:l.contentItems.length-1];l.addChild(e,o?0:void 0,!0),c.config[s]=((h=c.config[s])!==null&&h!==void 0?h:0)*.5,e.config[s]=c.config[s],l.callDownwards("setSize")}}}}function eu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function tr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?eu(Object(t),!0).forEach(function(n){st(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):eu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function st(r,e,t){return e=zP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zP(r){var e=KP(r,"string");return typeof e=="symbol"?e:String(e)}function KP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class oo extends $e{constructor(e,t,n){var i,a,s,o,l,d,h,c,f;super(e,t,n,Z('<div class="lm_item lm_stack"></div>')),st(this,"_activeContentItem",null),st(this,"_header",void 0),st(this,"childElementContainer",Z('<div class="lm_items"></div>')),st(this,"header",void 0),st(this,"parent",void 0),st(this,"isStack",!0),st(this,"_dropZones",{}),st(this,"_dropSegment",null),st(this,"_contentAreaDimensions",null),st(this,"_dropIndex",void 0),st(this,"_side",void 0),st(this,"_sided",!1),st(this,"config",void 0),this.parent=n,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?(s=p.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(o=p.settings)!==null&&o!==void 0&&o.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=p.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(f=p.labels)===null||f===void 0?void 0:f.minimise)!==null&&c!==void 0?c:void 0},p.header&&(this._header=tr(tr({},this._header),p.header)),t.header&&(this._header=tr(tr({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=tr(tr({},this._header),t.content[0].header)),this.header=new en(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,i,a,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,o=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?s:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:s);for(this.childElementContainer.width(o),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(o).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,n=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(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){$e.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",n=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",a=t&&this.parent.isColumn||n&&this.parent.isRow,s=t?"column":"row",o=t?"height":"width";if(ht(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[o]=((d=this.config[o])!==null&&d!==void 0?d:0)*.5,e.config[o]=this.config[o],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:s},this);this.parent.replaceChild(this,c),c.addChild(e,i?0:void 0,!0),c.addChild(this,i?void 0:0,!0),this.config[o]=50,e.config[o]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var a=i.hoverArea;if(a.x1<e&&a.x2>e&&a.y1<t&&a.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));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 n=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+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.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+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.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,n,i,a,s,o,l,d,h,c,f,p,m,b,g,C,y=this.header.tabs.length;if(y===0){var S,E,w,I,O,T,N,R,W=this.header.element.offset();(S=this.layoutManager.dropTargetIndicator)===null||S===void 0||S.highlightArea({x1:(E=W==null?void 0:W.left)!==null&&E!==void 0?E:0,x2:((w=W==null?void 0:W.left)!==null&&w!==void 0?w:0)+100,y1:(I=(O=this.header.element.offset())===null||O===void 0?void 0:O.top)!==null&&I!==void 0?I:0,y2:((T=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&T!==void 0?T:0)+((R=this.header.element.innerHeight())!==null&&R!==void 0?R:0)});return}var L=this.header.tabsContainer,D=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),M=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!D||!M)){e<D.left?e=D.left+1:e>D.right&&(e=D.right-1);var F,k;if(!(M.left<e&&e<M.right)){for(var H=0;H<y;H++){var q;if(F=this.header.tabs[H].element,k=(q=F.get(0))===null||q===void 0?void 0:q.getBoundingClientRect(),k&&k.left<e&&e<k.right){this._dropIndex=H;break}}if(F&&k&&e<k.left+k.width*.5)F.before(this.layoutManager.tabDropPlaceholder);else if(F){var re;this._dropIndex=Math.min(((re=this._dropIndex)!==null&&re!==void 0?re:0)+1,y),F.after(this.layoutManager.tabDropPlaceholder)}}var V=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;V=Math.max(V,(s=(o=this.header.tabsContainer.offset())===null||o===void 0?void 0:o.left)!==null&&s!==void 0?s:0);var x=V+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);x=Math.min(x,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:V,x2:x,y1:(p=(m=this.header.element.offset())===null||m===void 0?void 0:m.top)!==null&&p!==void 0?p:0,y2:((b=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&b!==void 0?b:0)+((C=this.header.element.innerHeight())!==null&&C!==void 0?C:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===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,n,i=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(i){var a;(a=this.layoutManager.dropTargetIndicator)===null||a===void 0||a.highlightArea(i)}this._dropSegment=e}}const qP=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:$e,Component:Ff,ContentItem:$e,Root:so,RowOrColumn:ba,Stack:oo,isComponent:ht,isRoot:Lf,isStack:vi},Symbol.toStringTag,{value:"Module"}));function Xt(r,e,t){return e=YP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YP(r){var e=XP(r,"string");return typeof e=="symbol"?e:String(e)}function XP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ii{constructor(e,t){var n;Xt(this,"header",void 0),Xt(this,"contentItem",void 0),Xt(this,"element",Z(Ii._template)),Xt(this,"titleElement",void 0),Xt(this,"closeElement",void 0),Xt(this,"isActive",!1),Xt(this,"_layoutManager",void 0),Xt(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,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new Oi(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),ht(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),ht(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 n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new zn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){Z(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){ht(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&ht(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):ht(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),ht(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(),ht(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Xt(Ii,"_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 le(r,e,t){return e=ZP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ZP(r){var e=QP(r,"string");return typeof e=="symbol"?e:String(e)}function QP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class en extends Ft{constructor(e,t){var n,i;super(),le(this,"layoutManager",void 0),le(this,"element",Z(en._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",Z(en._nextButtonTemplate)),le(this,"tabPreviousButton",Z(en._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.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 n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var i=new Ii(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,n,i,a,s=0;s<this.tabs.length;s++)a=this.tabs[s].contentItem===e,this.tabs[s].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(n=t.scrollIntoView)===null||n===void 0||n.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 n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;n*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_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 n,i,a,s,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)>((a=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&a!==void 0?a:0)+((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o: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 d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,a;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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 s=this.tabsContainer.get(0);s&&(s.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,n;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)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0,s=this.tabsContainer.get(0);if(s){var o=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,f,p=a||h,m=h-p,b=this.START_SPEED*m+.5*this.ACCELERATION*(m*m);b=Math.min(b,(c=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,b,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(),Z(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,n,i,a;if(a=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Jr(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),n=this._getHeaderSetting("popout"),new Jr(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),o=this._getHeaderSetting("minimise"),l=new Jr(this,s,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",o??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Jr(this,n,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),Z(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"),Z(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(o,l,d){if(d==null||d.length<2)return-1;for(var h=(o+l+d.length)%d.length;h!==o;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.length}return o}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.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,s;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),(s=this.tabDropdownList)===null||s===void 0||s.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 n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-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,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.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(),Z(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,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 s=this.tabDropdownContainer[0].getBoundingClientRect(),o=(n=Z(window).height())!==null&&n!==void 0?n:0,l=(i=Z(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=a<o-d.bottom,c=!h&&d.bottom>o*.6,f=Math.min(d.left+(c?d.width:0),l-s.width-this.PADDING),p=c?Math.max(d.top-a,this.PADDING):d.bottom,m=o-p-this.PADDING;this.tabDropdownContainer.css({"max-height":m,top:p,left:f})}}}}_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 n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}le(en,"_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(""));le(en,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(en,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function zr(r,e,t){return e=JP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JP(r){var e=e0(r,"string");return typeof e=="symbol"?e:String(e)}function e0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Af{constructor(e,t,n){zr(this,"_isVertical",void 0),zr(this,"_size",void 0),zr(this,"_grabSize",void 0),zr(this,"_dragListener",void 0),zr(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new Oi(this.element)}on(e,t,n){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,n)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=Z('<div class="lm_drag_handle"></div>'),t=Z('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,i=n/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const t0=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:If,DragProxy:zn,DragSource:xf,DragSourceFromEvent:Nf,DropTargetIndicator:Di,Header:en,HeaderButton:Jr,Splitter:Af,Tab:Ii},Symbol.toStringTag,{value:"Module"}));var n0={config:Jw,container:iP,controls:t0,errors:jP,items:qP,utils:SP};const r0=n0;function tu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function rt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tu(Object(t),!0).forEach(function(n){ue(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):tu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ue(r,e,t){return e=i0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function i0(r){var e=a0(r,"string");return typeof e=="symbol"?e:String(e)}function a0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Rf extends Ft{static minifyConfig(e){return pl(e)}static unminifyConfig(e){return ro(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":Of}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",Z('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Df(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",Z('<div class="lm_drop_tab_placeholder"></div>')),ue(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&&Z("body").css("visibility","hidden"),this._typeToItem={column:ba.bind(this,!0),row:ba.bind(this,!1),stack:oo,component:Ff}}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 n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}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 $e))throw new Error("Root must be a ContentItem");var t={settings:rt({},this.config.settings),dimensions:rt({},this.config.dimensions),labels:rt({},this.config.labels),content:[]},n=function a(s,o){for(var l in o.config)l!=="content"&&(s[l]=o.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),o.contentItems.length){s.content=[];for(var d=0;d<o.contentItems.length;d++)s.content[d]={},a(s.content[d],o.contentItems[d])}};e?n(t,{contentItems:[e]}):n(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){Z(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 Di,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 n=this._reactChildMap.get(e);n===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}updateSize(e,t){var n,i;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n: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,s;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),Z(window).off("resize",this._onResize),Z(window).off("unload beforeunload",this._onUnload),Z(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 n,i;if(typeof e.type!="string")throw new jn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw n="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new jn(n);return e.type==="component"&&!(t instanceof oo)&&t&&!(this.isSubWindow===!0&&t instanceof so)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,t),i}createPopout(e,t,n,i){var a=[],s=e instanceof $e,o=this;if(s){var l;a=this.toConfig(e).content,n=vl();for(var d=e.parent,h=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var f;i=(f=d)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?a=e:a=[e];if(!t&&s){var p,m,b,g=window.screenX||window.screenLeft,C=window.screenY||window.screenTop,y=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:g+y.left,top:C+y.top,width:(m=e.element.width())!==null&&m!==void 0?m:0,height:(b=e.element.height())!==null&&b!==void 0?b:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!n||i===void 0)){var S=new If(a,t,n,i,this);return S.on("initialised",function(){o.emit("windowOpened",S)}),S.on("closed",function(){o._$reconcilePopoutWindows()}),this.openPopouts.push(S),S}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new xf(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Nf(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,n;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((n=this.container.height())!==null&&n!==void 0?n: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 n=1/0,i=null,a=0;a<this._itemAreas.length;a++){var s=this._itemAreas[a];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&n>s.surface&&(n=s.surface,i=s)}return i}_$createRootItemAreas(){var e=50,t=rt({},this.root._$getArea()),n=[rt(rt({},t),{},{side:"left",x2:t.x1+e}),rt(rt({},t),{},{side:"right",x1:t.x2-e}),rt(rt({},t),{},{side:"top",y2:t.y1+e}),rt(rt({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...n)}_$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 n=e[t];if(vi(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var a;this._itemAreas.push(i);var s=rt(rt({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof $e)return e;if(Z.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.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=n=>{if(e.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)t(n.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&Z(window).resize(this._onResize),Z(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,n=Tf("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=ro(e),localStorage.removeItem(n)),e=Z.extend(!0,{},Ef,e);var i=function a(s){for(var o in s){var l=s[o];o!=="props"&&typeof l=="object"&&l!=null?a(l):o==="type"&&l==="react-component"&&(s.type="component",s.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=Z('<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=fl((e=this.config.content[0].title)!==null&&e!==void 0?e:""),Z("head").append(Z("body link, body style, template, .gl_keep")),this.container=Z("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?Z(this._originalContainer):Z("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,Z("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 jn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new jn(t,e);this.root=new so(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,n=e*t;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),a=e-i,s=this.root.contentItems[0],o=this._findAllStackContainers()[0],l=0;l<a;l++){var d=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(o,d)}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(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{vi(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}ue(Rf,"__lm",r0);const jf=Rf,s0="_lm_dragging_k4a5m_1",o0="_lm_goldenlayout_k4a5m_1",l0="_lm_header_k4a5m_1",d0="_lm_controls_k4a5m_1",u0="_lm_tabpreviousbutton_k4a5m_1",h0="_lm_tabnextbutton_k4a5m_1",c0="_lm_tab_k4a5m_1",v0="_lm_active_k4a5m_1",f0="_lm_close_tab_k4a5m_1",p0="_lm_content_k4a5m_1",m0="_lm_dragProxy_k4a5m_1",g0="_lm_dropTargetIndicator_k4a5m_1",b0="_march_k4a5m_1",C0="_lm_inner_k4a5m_1",S0="_lm_splitter_k4a5m_1",y0="_lm_selectable_k4a5m_1",E0="_lm_tabdropdown_list_k4a5m_1",w0="_lm_title_k4a5m_1",P0="_lm_title_before_k4a5m_1",_0="_lm_selected_k4a5m_1",T0="_lm_focusin_k4a5m_1",O0="_lm_window_blur_k4a5m_1",D0="_lm_popout_k4a5m_1",I0="_lm_maximise_k4a5m_1",x0="_lm_tabdropdown_k4a5m_1",N0="_lm_close_k4a5m_1",M0="_lm_tabdropdown_search_k4a5m_1",L0="_lm_tabs_k4a5m_1",F0="_lm_keyboard_active_k4a5m_1",A0="_lm_maximised_k4a5m_1",R0="_lm_items_k4a5m_1",nu={"tab-height":"28px","drag-border-width":"5px",lm_dragging:s0,lm_goldenlayout:o0,lm_header:l0,lm_controls:d0,lm_tabpreviousbutton:u0,lm_tabnextbutton:h0,lm_tab:c0,lm_active:v0,lm_close_tab:f0,lm_content:p0,lm_dragProxy:m0,lm_dropTargetIndicator:g0,march:b0,lm_inner:C0,lm_splitter:S0,lm_selectable:y0,lm_tabdropdown_list:E0,lm_title:w0,lm_title_before:P0,lm_selected:_0,lm_focusin:T0,lm_window_blur:O0,lm_popout:D0,lm_maximise:I0,lm_tabdropdown:x0,lm_close:N0,lm_tabdropdown_search:M0,lm_tabs:L0,lm_keyboard_active:F0,lm_maximised:A0,lm_items:R0},ru=Object.freeze({tabHeight:parseInt(nu["tab-height"],10),dragBorderWidth:parseInt(nu["drag-border-width"],10)});function iu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function zt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?iu(Object(t),!0).forEach(function(n){kf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):iu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kf(r,e,t){return e=j0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function j0(r){var e=k0(r,"string");return typeof e=="symbol"?e:String(e)}function k0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var dn=B.module("LayoutUtils");function $f(r){return r.componentName!==void 0}function ur(r){var e=r;return($f(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function zi(r){return r.focus!==void 0}function au(r){return r.type==="stack"}class A{static activateTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n){dn.error("Could not find stack for config",t);return}var i=A.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return dn.error("Could not find stack for config",t),!1;var i=A.getContentItemInStack(n,t),a=n.getActiveContentItem();return a===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(Lf(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var i=e.contentItems[0],a=t?i.isColumn:i.isRow;if(!a){e.removeChild(i,!0),e.addChild({type:n});var s=document.activeElement;e.contentItems[0].addChild(i),s&&s.focus!=null&&s.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 o=e.contentItems[e.contentItems.length-1],l=t?o.isRow:o.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(o,!0),e.contentItems[e.contentItems.length-1].addChild(o),o=e.contentItems[e.contentItems.length-1]),this.addStack(o,!t)}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&vi(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&&Kl(a.config,t))return e;var s=this.getStackForConfig(a,t,n);if(s)return s}return null}static getStackForRoot(e,t){var n=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,s=this.getStackForConfig(e,t);return!s&&i&&(s=this.getStackForConfig(e,{component:t.component},a)),!s&&n&&(s=this.addStack(e)),s}static getStackForComponentTypes(e,t){for(var n=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,s=0;s<t.length;s+=1){var o=t[s],l=s===t.length-1,d=A.getStackForRoot(e,{component:o},n&&l,i,a);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var i=e.contentItems[n];if(i.isComponent&&i.config!=null&&Kl(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i],{component:s,content:o}=a;if(s){var l=t(s,a);l!=null?n.push(l):dn.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(o){var d=zt(zt({},a),{},{content:A.dehydrateLayoutConfig(o,t)});n.push(d)}else n.push(a)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:i}=n;i!==void 0?(au(n)&&delete n.activeItemIndex,A.dropLayoutMinorChange(i)):ur(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=A.cloneLayout(e),a=A.cloneLayout(t);return n?(A.dropLayoutMinorChange(i),A.dropLayoutMinorChange(a),Mt(i,a)):Mt(i,a)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i];if(ur(a)){var s,{component:o,props:l={}}=a;n.push(zt(zt({},a),{},{id:(s=a==null?void 0:a.id)!==null&&s!==void 0?s:ye(),props:t(o,l)}))}else if(a.content!==void 0){var d=A.hydrateLayoutConfig(a.content,t);au(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=d.length&&(dn.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),n.push(zt(zt({},a),{},{content:d}))}else n.push(a)}return n}static openComponent(){var{root:e,config:t,replaceExisting:n=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:o=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,d=zt({},t);if(d.id==null&&(d.id=ye.generate()),o!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,o);return}var h=i||{id:d.id,component:d.component};z(e);var c=a?A.addStack(e):A.getStackForRoot(e,h);z(c);var f=A.getContentItemInStack(c,h);if(s!=null){var p=b=>{dn.debug("Component created, focusing element",s),c.off("componentCreated",p);var{element:g}=b.origin;requestAnimationFrame(()=>{A.focusElement(g[0],s)})};c.on("componentCreated",p)}if(n&&f){var m=c.contentItems.indexOf(f);c.addChild(d,m+1),c.removeChild(f),c.setActiveContentItem(c.contentItems[m])}else c.addChild(d);s==null&&l&&zi(l)&&l.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,a={id:t.id},s=A.getContentItemInStack(e,a);if(n&&s&&e){var o=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,o+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[o])}else e==null||e.addChild(t);i&&zi(i)&&i.focus()}static closeComponent(e,t,n){var i=A.getStackForRoot(e,t,!1,!1,!1);if(!i){dn.warn("Cannot find stack for component, ignoring close",t);return}var a=A.getContentItemInStack(i,t),s=document.activeElement;a&&(ht(a)?a.container.close(n):i.removeChild(a)),s&&document.contains(s)&&zi(s)&&s.focus()}static renameComponent(e,t,n){var i=A.getStackForRoot(e,t,!1);if(!i){dn.error("Could not find stack for config",t);return}var a=A.getContentItemInStack(i,t);a&&a.setTitle(n)}static cloneComponent(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return dn.error("Could not find stack for config",t),null;var{props:i={}}=t,a=A.getPanelComponentState(t),s={type:"react-component",component:t.component,props:zt(zt({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:ye.generate()};return A.openComponentInStack(n,s),s}static getPanelComponentState(e){if($f(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(ur(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ru.tabHeight,borderWidth:ru.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=A.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return A.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=A.getComponentConfigFromContainer(t);if(n&&ur(n)){var i;return(i=n.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,n,i=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.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]:A.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(zi(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}kf(A,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Uf=X.forwardRef((r,e)=>{var t=A.getComponentNameFromPanel({props:r});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Uf.displayName="PanelPlaceholder";const te=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 fi(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function Hf(r){return typeof r.id=="string"&&r.layout instanceof jf&&r.panelManager instanceof Ga&&typeof r.registerComponent=="function"}function Kn(r){if(!Hf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function su(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ou(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?su(Object(t),!0).forEach(function(n){pn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):su(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pn(r,e,t){return e=$0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $0(r){var e=U0(r,"string");return typeof e=="symbol"?e:String(e)}function U0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var bt=B.module("PanelManager");class Ga{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(o,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(o,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};pn(this,"layout",void 0),pn(this,"hydrateComponent",void 0),pn(this,"dehydrateComponent",void 0),pn(this,"onPanelsUpdated",void 0),pn(this,"closed",void 0),pn(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=n,this.onPanelsUpdated=s,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.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 A.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&ur(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=A.getStackForConfig(this.layout.root,{id:e});return(t=n&&A.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var i=t[n];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>fi(n)&&t instanceof n.WrappedComponent||!fi(n)&&t instanceof n))}updatePanel(e){var t=A.getIdFromPanel(e);if(t==null){bt.error("updatePanel Panel did not have an ID",e);return}bt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=A.getIdFromPanel(e);if(t==null){bt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){bt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){bt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}bt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){bt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){bt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){bt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){bt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var a=ou(ou({},e),{},{props:i}),{root:s}=this.layout;A.openComponent({root:s,config:a,replaceConfig:t})}handleDeleted(e){bt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){bt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;A.closeComponent(n,t)}addClosedPanel(e){var t=A.getComponentConfigFromContainer(e);if(t&&ur(t)){var n=this.dehydrateComponent(t.component,t);n!=null&&this.closed.push(n)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}pn(Ga,"MAX_CLOSED_PANEL_COUNT",100);var H0=B.module("PanelErrorBoundary");class Vf extends v.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=A.getIdFromContainer(e);H0.debug("componentWillUnmount",n),t.emit(te.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(He,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function lu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ca(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lu(Object(t),!0).forEach(function(n){V0(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):lu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function V0(r,e,t){return e=B0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function B0(r){var e=W0(r,"string");return typeof e=="symbol"?e:String(e)}function W0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function za(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var a={};return n!=null&&(a.metadata=n),i!=null&&(a.panelState=i),Ca(Ca({},r),{},{componentState:null,props:a,type:"react-component"})}function Ka(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Ca(Ca({},r),{},{localDashboardId:e})}function gl(r){var e=fi(r)&&r.WrappedComponent.prototype!=null&&r.WrappedComponent.prototype.isReactComponent!=null||r.prototype!=null&&r.prototype.isReactComponent!=null,t=!fi(r)&&"$$typeof"in r&&r.$$typeof===Jm.ForwardRef;return e||t}const Bf={dehydrate:za,hydrate:Ka};var qa=X.createContext(void 0),G0=_.shape({on:_.func,off:_.func,isHidden:_.bool,tab:_.shape({header:_.shape({tabs:_.arrayOf(_.shape({contentItem:_.shape({})}))})}),title:_.string,setTitle:_.func,close:_.func}),Wf=_.shape({on:_.func,off:_.func,emit:_.func}),z0=_.shape({registerComponent:_.func,root:_.shape({addChild:_.func}),on:_.func,off:_.func,eventHub:Wf}),Ya=Object.freeze({Container:G0,EventHub:Wf,Layout:z0});function ce(r,e,t){v.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}function An(r,e,t,n){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.");X.useEffect(()=>{var s=r(a,e,t,n);return()=>{s()}},[e,n,t,a,r])}function K0(r){var{dashboardProps:e,componentName:t,component:n,supportedTypes:i,hydrate:a,dehydrate:s}=r,{id:o,layout:l,registerComponent:d}=e,h=v.useCallback(c=>{var{dragEvent:f,panelId:p=ye.generate(),widget:m}=c,{name:b,type:g}=m,C=g!=null&&(Array.isArray(i)&&i.includes(g)||g===i);if(C){var y={localDashboardId:o,metadata:m};a!=null&&(y=a(y,o));var S={type:"react-component",component:t,props:y,title:b,id:p},{root:E}=l;A.openComponent({root:E,config:S,dragEvent:f})}},[t,a,o,l,i]);An(d,n,a,s),ce(l.eventHub,te.OPEN,h)}function q0(){var r=v.useContext(qa);if(r==null)throw new Error("LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?");return r}function du(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Y0(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?du(Object(t),!0).forEach(function(n){X0(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):du(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function X0(r,e,t){return e=Z0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Z0(r){var e=Q0(r,"string");return typeof e=="symbol"?e:String(e)}function Q0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var J0=Object.freeze({}),e_=new Map,Gf=r=>r.api,t_=r=>r.user,zf=r=>r.storage,Kf=r=>zf(r).commandHistoryStorage,qf=r=>zf(r).fileStorage,n_=r=>r.defaultWorkspaceSettings,Yf=r=>{var{workspace:e}=r;return e},xi=r=>{for(var e=Yf(r).data.settings,t=Y0({},n_(r)),n=Object.keys(e),i=0;i<n.length;i+=1){var a=n[i];e[a]!==void 0&&(t[a]=e[a])}return t},bl=r=>xi(r).timeZone,r_=r=>{var e;return(e=xi(r).defaultNotebookSettings)!==null&&e!==void 0?e:J0},Cl=r=>r.activeTool,i_=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:e_},Xf="SET_ACTIVE_TOOL",a_="SET_API",s_="SET_COMMAND_HISTORY_STORAGE",o_="SET_FILE_STORAGE",l_="SET_PLUGINS",d_="SET_USER",Zf="SET_WORKSPACE",u_="SET_DEFAULT_WORKSPACE_SETTINGS",h_="SET_WORKSPACE_STORAGE",c_="SET_SERVER_CONFIG_VALUES";function uu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Nn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uu(Object(t),!0).forEach(function(n){v_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function v_(r,e,t){return e=f_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function f_(r){var e=p_(r,"string");return typeof e=="symbol"?e:String(e)}function p_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var m_=r=>({type:Zf,payload:r}),g_=r=>(e,t)=>{e(m_(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i.save(r)},Qf=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n,a=Nn(Nn({},n),{},{data:Nn(Nn(Nn({},i),r),{},{settings:Nn(Nn({},i.settings),r.settings)})});return e(g_(a))},b_=r=>e=>e(Qf({settings:r})),Jf=r=>({type:Xf,payload:r});function hu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function _s(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hu(Object(t),!0).forEach(function(n){C_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function C_(r,e,t){return e=S_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function S_(r){var e=y_(r,"string");return typeof e=="symbol"?e:String(e)}function y_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ep(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:{var i=n.payload;return i==null?null:t!=null?_s(_s({},t),i):_s({},i)}default:return t}}}function cu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cu(Object(t),!0).forEach(function(n){E_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function E_(r,e,t){return e=w_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function w_(r){var e=P_(r,"string");return typeof e=="symbol"?e:String(e)}function P_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function __(r){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 n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case r:{var{id:a,payload:s}=i;return t&&Mt({payload:s},{payload:n[a]})?n:vu(vu({},n),{},{[a]:s})}default:return n}}}function On(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:return n.payload;default:return t}}}const T_=On(a_,null),O_=On(Xf,null),D_=On(l_,null),I_=On(s_,null),x_=On(o_,null),N_=On(h_,null),M_=Eo({commandHistoryStorage:I_,fileStorage:x_,workspaceStorage:N_}),L_=ep(d_,null),F_=ep(Zf,null),A_=On(u_,null),R_=On(c_,null);var j_={activeTool:O_,api:T_,plugins:D_,storage:M_,user:L_,workspace:F_,defaultWorkspaceSettings:A_,serverConfigValues:R_};const k_=j_;function fu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fu(Object(t),!0).forEach(function(n){lo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function lo(r,e,t){return e=$_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $_(r){var e=U_(r,"string");return typeof e=="symbol"?e:String(e)}function U_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class H_{constructor(){lo(this,"reducers",{}),lo(this,"listener",null)}register(e,t){var n;this.reducers=pu(pu({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var V_=new H_;const Xa=V_;var mu=B.module("redux-logger"),B_=r=>e=>t=>{mu.debug("dispatching",t);var n=e(t);return mu.debug("next state",r.getState()),n};const W_=B_;var G_=B.module("redux-crashReporter"),z_=r=>e=>t=>{try{return e(t)}catch(n){throw G_.error("Error executing",t," with state ",r.getState(),":",n),n}};const K_=z_,q_=[W_,K_,eg];var Ts;Object.entries(k_).map(r=>{var[e,t]=r;return Xa.register(e,t)});var Y_=(Ts=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&Ts!==void 0?Ts:rg,tp=tg(Eo(Xa.reducers),Y_(ng(...q_)));Xa.setListener(r=>{tp.replaceReducer(Eo(r))});const X_=tp;var Sl="SET_DASHBOARD_DATA";const Z_=__(Sl,{},!1),np={dashboardData:Z_};var Q_=new Map,rp=Object.freeze({}),J_=Object.freeze([]),ip=r=>r.dashboardData,Be=(r,e)=>{var t;return(t=ip(r)[e])!==null&&t!==void 0?t:rp},ap=(r,e)=>{var t;return(t=Be(r,e).closed)!==null&&t!==void 0?t:J_},yl=(r,e)=>{var t;return(t=Be(r,e).openedMap)!==null&&t!==void 0?t:Q_},El=(r,e)=>{var t;return(t=Be(r,e).pluginDataMap)!==null&&t!==void 0?t:rp},sp=(r,e,t)=>El(r,e)[t];function gu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gu(Object(t),!0).forEach(function(n){eT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function eT(r,e,t){return e=tT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tT(r){var e=nT(r,"string");return typeof e=="symbol"?e:String(e)}function nT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wl=(r,e)=>({type:Sl,id:r,payload:e}),At=(r,e)=>(t,n)=>t(wl(r,hr(hr({},Be(n(),r)),e))),op=(r,e,t)=>(n,i)=>n(wl(r,hr(hr({},Be(i(),r)),{},{pluginDataMap:hr(hr({},El(i(),r)),{},{[e]:t})})));function rT(r,e){var t=gi(),n=cc(a=>sp(a,r,e)),i=v.useCallback(a=>t(op(r,e,a)),[r,e,t]);return[n,i]}Object.entries(np).map(r=>{var[e,t]=r;return Xa.register(e,t)});function iT(r){var{children:e}=r;return u.jsx(u.Fragment,{children:e})}function bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Kr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bu(Object(t),!0).forEach(function(n){aT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function aT(r,e,t){return e=sT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sT(r){var e=oT(r,"string");return typeof e=="symbol"?e:String(e)}function oT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ki=B.module("DashboardLayout"),lT=Object.freeze({}),dT=[],Cu=()=>{},Su=r=>r;function Pl(r){var e,t,{id:n,children:i,emptyDashboard:a=u.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:o=dT,onLayoutChange:l=Cu,onLayoutInitialized:d=Cu,hydrate:h=Ka,dehydrate:c=za,panelWrapper:f=iT}=r,p=gi(),m=(e=cc(P=>Be(P,n)))!==null&&e!==void 0?e:lT,[b,g]=v.useState(!1),[C,y]=v.useState(!1),[S,E]=v.useState(),[w]=v.useState((t=m==null?void 0:m.closed)!==null&&t!==void 0?t:[]),[I,O]=v.useState(!1),[T,N]=v.useState(s.getReactChildren()),R=v.useMemo(()=>new Map,[]),W=v.useMemo(()=>new Map,[]),L=v.useCallback(function(P,j){var U,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Ki.debug2("registerComponent",P,j,Q,me);function $(ie,ve){var Ee=j,Vr=f,Qn=gl(Ee),{glContainer:Br,glEventHub:xn}=ie;return u.jsx(Vf,{glContainer:Br,glEventHub:xn,children:u.jsx(Vr,Kr(Kr({},ie),{},{children:Qn?u.jsx(Ee,Kr(Kr({},ie),{},{ref:ve})):u.jsx(Ee,Kr({},ie))}))})}$.displayName="DashboardWrapper(".concat((U=j.displayName)!==null&&U!==void 0?U:P,")");var J=s.registerComponent(P,X.forwardRef($));return R.set(P,Q),W.set(P,me),J},[h,c,R,W,s,f]),D=v.useCallback((P,j)=>{var U;return((U=R.get(P))!==null&&U!==void 0?U:Su)(j,n)},[R,n]),M=v.useCallback((P,j)=>{var U;return((U=W.get(P))!==null&&U!==void 0?U:Su)(j,n)},[W,n]),F=v.useMemo(()=>new Ga(s,D,M,new Map,w,P=>{var{closed:j,openedMap:U}=P;p(At(n,{closed:j,openedMap:U}))}),[M,p,D,n,w,s]),k=v.useCallback(()=>{if(!C){I||(d(),O(!0));var P=s.toConfig(),j=P.content,U=A.dehydrateLayoutConfig(j,M),Q=S==null||!A.isEqual(S,U);Ki.debug("handleLayoutStateChanged",Q,j,U),Q&&(g(s.root.contentItems.length===0),E(U),l(U),N(s.getReactChildren()))}},[M,I,C,S,s,l,d]),H=v.useCallback(P=>{var j=A.getIdFromContainer(P);s.eventHub.emit(te.DRAGGING,j),y(!0)},[s.eventHub]),q=v.useCallback(P=>{var j=A.getIdFromContainer(P);s.eventHub.emit(te.DROPPED,j),y(!1)},[s.eventHub]),re=v.useCallback(P=>{if(Ki.debug2("handleComponentCreated",P),!(P==null||P.config==null||P.config.component==null||P.element==null)){var j=P.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),U="".concat(j,"-component");P.element.addClass(U)}},[]),V=v.useCallback(()=>{N(s.getReactChildren())},[s]);ce(s,"stateChanged",k),ce(s,"itemPickedUp",H),ce(s,"itemDropped",q),ce(s,"componentCreated",re),ce(s.eventHub,te.TITLE_CHANGED,k),ce(s,"reactChildrenChanged",V);var x=Pc(o);return v.useEffect(function(){if(x!==o&&o!==S){Ki.debug("Setting new layout content...");for(var j=A.hydrateLayoutConfig(o,D);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var U=0;U<j.length;U+=1)s.root.addChild(j[U]);g(s.root.contentItems.length===0)}},[D,s,o,S,F,x]),u.jsxs(u.Fragment,{children:[b&&a,T,X.Children.map(i,P=>P!=null?X.cloneElement(P,{id:n,layout:s,panelManager:F,registerComponent:L}):null)]})}Pl.propTypes={id:_.string.isRequired,children:_.node,data:_.shape({}),emptyDashboard:_.node,layout:Ya.Layout.isRequired,layoutConfig:_.arrayOf(_.shape({})),onLayoutChange:_.func,onLayoutInitialized:_.func};function yu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function uT(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yu(Object(t),!0).forEach(function(n){hT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hT(r,e,t){return e=cT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cT(r){var e=vT(r,"string");return typeof e=="symbol"?e:String(e)}function vT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fT=100,Os=()=>{},pT=Object.freeze({});function uo(r){var{id:e="default",children:t,emptyDashboard:n,layoutConfig:i,layoutSettings:a=pT,onLayoutConfigChange:s=Os,onGoldenLayoutChange:o=Os,onLayoutInitialized:l=Os,fallbackComponent:d=Uf,hydrate:h,dehydrate:c,panelWrapper:f}=r,p=v.useRef(null),[m,b]=v.useState(!1),[g,C]=v.useState();v.useEffect(function(){if(!p.current){C(void 0);return}var E=uT({},A.makeDefaultLayout());E.settings===void 0&&(E.settings={}),Object.assign(E.settings,a),E.content=[];var w=new jf(E,p.current),I=()=>{w.off("initialised",I),b(!0)};return w.on("initialised",I),d!=null&&w.setFallbackComponent(d),w.init(),C(w),o(w),()=>{w.destroy()}},[a,d,o,b,C]);var y=v.useMemo(()=>bi(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},fT),[g]);return $o(p.current,y),u.jsxs("div",{className:"dashboard-container w-100 h-100",children:[u.jsx("div",{className:"w-100 h-100",ref:p}),m&&g&&u.jsx(qa.Provider,{value:g,children:u.jsx(Pl,{emptyDashboard:n,id:e,layout:g,layoutConfig:i,onLayoutChange:s,onLayoutInitialized:l,hydrate:h,dehydrate:c,panelWrapper:f,children:t})})]})}var _l="default",Tl="CREATE_DASHBOARD";function mT(r,e){r.on(Tl,e)}function gT(r,e){r.emit(Tl,e)}var bT=["id","isActive","plugins"];function Eu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eu(Object(t),!0).forEach(function(n){CT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Eu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function CT(r,e,t){return e=ST(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ST(r){var e=yT(r,"string");return typeof e=="symbol"?e:String(e)}function yT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ET(r,e){if(r==null)return{};var t=wT(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function wT(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function PT(r){var{id:e,isActive:t,plugins:n}=r,i=ET(r,bT),[a,s]=v.useState(t),o=gi(),l=v.useCallback(d=>{o(e===_l?Qf({layoutConfig:d}):At(e,{layoutConfig:d}))},[e,o]);return!a&&t&&s(!0),a?u.jsx(uo,wu(wu({id:e,onLayoutConfigChange:l},i),{},{children:n})):u.jsx(He,{})}const _T=Object.freeze(Object.defineProperty({__proto__:null,CREATE_DASHBOARD:Tl,DEFAULT_DASHBOARD_ID:_l,Dashboard:uo,DashboardLayout:Pl,DashboardUtils:Bf,GLPropTypes:Ya,LayoutManagerContext:qa,LayoutUtils:A,LazyDashboard:PT,PanelErrorBoundary:Vf,PanelEvent:te,PanelManager:Ga,SET_DASHBOARD_DATA:Sl,assertIsDashboardPluginProps:Kn,canHaveRef:gl,default:uo,dehydrate:za,emitCreateDashboard:gT,getAllDashboardsData:ip,getClosedPanelsForDashboard:ap,getDashboardData:Be,getOpenedPanelMapForDashboard:yl,getPluginDataForDashboard:sp,getPluginDataMapForDashboard:El,hydrate:Ka,isDashboardPluginProps:Hf,isWrappedComponent:fi,listenForCreateDashboard:mT,reducers:np,setDashboardData:wl,setDashboardPluginData:op,updateDashboardData:At,useDashboardPanel:K0,useDashboardPluginData:rT,useLayoutManager:q0,useListener:ce,usePanelRegistration:An},Symbol.toStringTag,{value:"Module"}));function TT(r){var{type:e}=r,t=Ve();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ne,{icon:To});case t.VariableType.FIGURE:return u.jsx(ne,{icon:_o});case t.VariableType.PANDAS:return u.jsx(ne,{icon:gc});default:return u.jsx(ne,{icon:mc})}}function Pu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function OT(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Pu(a,n,i,s,o,"next",l)}function o(l){Pu(a,n,i,s,o,"throw",l)}s(void 0)})}}function lp(r){var{children:e,language:t}=r,[n,i]=v.useState(null),{activeThemes:a}=jr();return v.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=OT(function*(){if(e!=null&&a!=null){var d=yield jo.colorize(e.toString(),t,{});s||i(d)}}),l.apply(this,arguments)}return o(),()=>{s=!0}},[a,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class DT{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const dp=DT;class Sa{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:ig.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),n="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(i,".").concat(a)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return Sa.isTableType(e,t)||Sa.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const ho=Sa;function up(r){var{children:e}=r;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}up.propTypes={children:_.node.isRequired};function co(r,e,t){return e=IT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function IT(r){var e=xT(r,"string");return typeof e=="symbol"?e:String(e)}function xT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class hp extends v.Component{constructor(e){super(e),co(this,"timer",void 0),co(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return u.jsx("div",{className:Y("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(Ma,{className:"ml-2"}),"Running... ",vr.formatElapsedTime(n)," ",u.jsx(K,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:wo,tooltip:"Cancel",onClick:t,disabled:e})]})})}}co(hp,"defaultProps",{disabled:!1});const NT=hp;function li(r,e,t){return e=MT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MT(r){var e=LT(r,"string");return typeof e=="symbol"?e:String(e)}function LT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dr extends v.PureComponent{constructor(e){super(e),li(this,"mouseX",void 0),li(this,"mouseY",void 0),li(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Dr.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Dr.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;z(n);var i=n.indexOf(`
4
- `),a=i>-1,s=n;a&&(s=n.slice(0,i));var o=n.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:Y("error-message",{expanded:e}),children:[a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:u.jsx(ne,{icon:e?sr:Gg,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:s}),e?o:""]})]}),!a&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:s})})]},"error")}}li(Dr,"defaultProps",{message:""});li(Dr,"mouseDragThreshold",5);const FT=Dr;function AT(r,e,t){return e=RT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function RT(r){var e=jT(r,"string");return typeof e=="symbol"?e:String(e)}function jT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var _u=B.module("ConsoleHistoryItem");class cp extends v.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){_u.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(_u.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,iconForType:i}=this.props,{disabledObjects:a,result:s}=t,o=t.command!=null&&t.command!=="",l=null;o&&(l=u.jsxs("div",{className:"console-history-item-command",children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsx("div",{className:"console-history-content",children:u.jsx(lp,{language:n,children:t.command})})]}));var d=[],h=!1;if(s){var{error:c,message:f,changes:p}=s;if(p){var{created:m,updated:b}=p;[...m,...b].forEach(I=>{h=!0;var{title:O}=I,T="".concat(O),N=e===void 0||e||(a??[]).indexOf(T)>=0,R=u.jsx(K,{kind:"primary",onClick:()=>this.handleObjectClick(I),className:"btn-console-object",disabled:N,icon:i(I.type),children:O},T);d.push(R)})}if(c!=null&&!o){var g,C="".concat((g=c.message)!==null&&g!==void 0?g:c);C||(C=c);var y=u.jsx(FT,{message:C},"result-error");d.push(y)}if(f!==void 0&&f!==""){var S=u.jsx("div",{className:"log-message",children:f},"log-message");d.push(S)}}else{h=!0;var E=u.jsx(NT,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(E)}var w=null;return d.length>0&&(w=u.jsx(up,{children:d})),u.jsxs("div",{className:Y("console-command-result",{"console-result-buttons":h}),children:[l,w]})}}AT(cp,"defaultProps",{disabled:!1});const kT=cp;function $T(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function UT(r){for(var{disabled:e=!1,items:t,language:n,openObject:i,supportsType:a,iconForType:s}=r,o=[],l=0;l<t.length;l+=1){var d=t[l],h=u.jsx(kT,{disabled:e,item:d,openObject:i,language:n,supportsType:a,iconForType:s},$T(l,d));o.push(h)}return u.jsx("div",{className:"container-fluid console-history",children:o})}var HT={name:"Console",CLEAR:qe.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[pe.CTRL,fe.L],macShortcut:[pe.CTRL,fe.C]}),FOCUS_HISTORY:qe.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[pe.CTRL,fe.H],macShortcut:[pe.CTRL,pe.OPTION,fe.H]})},VT={name:"Command History",FOCUS_HISTORY:qe.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[pe.CTRL,fe.H],macShortcut:[pe.CTRL,pe.OPTION,fe.H]}),SEND_TO_CONSOLE:qe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]}),SEND_TO_NOTEBOOK:qe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[pe.CTRL,fe.ENTER],macShortcut:[pe.CMD,fe.ENTER]}),RUN:qe.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[pe.ALT,fe.R],macShortcut:[pe.OPTION,fe.R]})},BT={name:"Notebook",RUN:qe.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[pe.ALT,fe.R],macShortcut:[pe.OPTION,fe.R]}),RUN_SELECTED:qe.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[pe.ALT,pe.SHIFT,fe.R],macShortcut:[pe.OPTION,pe.SHIFT,fe.R]}),FIND:qe.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[pe.CTRL,fe.F],macShortcut:[pe.CMD,fe.F],isEditable:!1}),MINIMAP:qe.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[pe.ALT,fe.M],macShortcut:[pe.OPTION,fe.M]}),WORDWRAP:qe.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[pe.ALT,fe.Z],macShortcut:[pe.OPTION,fe.Z]})},WT={CONSOLE:HT,COMMAND_HISTORY:VT,NOTEBOOK:BT};const et=WT,ke=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"});function Ds(r,e,t){return e=GT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GT(r){var e=zT(r,"string");return typeof e=="symbol"?e:String(e)}function zT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Kt=B.module("MonacoCompletionProvider");class Rn extends v.PureComponent{static lspToMonacoKind(e){var t=ki.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),Ds(this,"registeredCompletionProvider",void 0),Ds(this,"registeredSignatureProvider",void 0),Ds(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=ki.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=ki.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=ki.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,n;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(n=this.registeredHoverProvider)===null||n===void 0||n.dispose()}handleCompletionRequest(e,t,n){var{model:i,session:a}=this.props;if(e!==i)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Rn.monacoToLspPosition(t),context:n},o=a.getCompletionItems(s);Kt.debug("Requested completion items",s);var l=o.then(d=>{Kt.debug("Completion items received: ",s,d);var h=d.map(c=>{var{label:f,kind:p,detail:m,documentation:b,sortText:g,filterText:C,textEdit:y,insertTextFormat:S}=c;return{label:f,kind:Rn.lspToMonacoKind(p),detail:m,documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,sortText:g,filterText:C,insertText:y.text,insertTextRules:S===2?4:S,range:Rn.lspToMonacoRange(y.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(Kt.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,i){var a={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:s,session:o}=this.props;if(e!==s||!o.getSignatureHelp)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Rn.monacoToLspPosition(t),context:i},d=o.getSignatureHelp(l);Kt.debug("Requested signature help",l);var h=d.then(c=>{Kt.debug("Signatures received: ",l,d);var f=c.map(m=>{var{label:b,documentation:g,parameters:C}=m;return{documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,label:b,parameters:C??[]}});if(f.length===0)return a;var p=0;return{value:{signatures:f,activeSignature:p,activeParameter:c[p].activeParameter},dispose:()=>{}}}).catch(c=>(Kt.error("There was an error retrieving completion items",c),a));return h}handleHoverRequest(e,t){var{model:n,session:i}=this.props;if(e!==n||!i.getHover)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Rn.monacoToLspPosition(t)},s=i.getHover(a);Kt.debug("Requested hover",a);var o=s.then(l=>{Kt.debug("Hover received: ",a,l);var{contents:d}=l;return{contents:d?[d]:[]}}).catch(l=>(Kt.error("There was an error retrieving hover",l),{contents:[]}));return o}render(){return null}}const vp=Rn;function KT(r){var{children:e}=r,{activeThemes:t}=jr();return v.useEffect(function(){t!=null&&vt.initTheme()},[t]),u.jsx(u.Fragment,{children:e})}function Tu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function qT(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Tu(a,n,i,s,o,"next",l)}function o(l){Tu(a,n,i,s,o,"throw",l)}s(void 0)})}}function dt(r,e,t){return e=YT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YT(r){var e=XT(r,"string");return typeof e=="symbol"?e:String(e)}function XT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Is=B.module("ConsoleInput"),ya=parseInt(Jb["line-height"],10),fp=6,pp=6,ZT=ya+fp+pp,xs=100;class Ni extends v.PureComponent{constructor(e){super(e),dt(this,"cancelListener",void 0),dt(this,"resizeObserver",void 0),dt(this,"commandContainer",void 0),dt(this,"commandEditor",void 0),dt(this,"commandHistoryIndex",void 0),dt(this,"commandSuggestionContainer",void 0),dt(this,"loadingPromise",void 0),dt(this,"timestamp",void 0),dt(this,"bufferIndex",void 0),dt(this,"history",void 0),dt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=X.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:ya,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(Is.debug("Command received: ",e),!n){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:ya,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:fp,bottom:pp},value:"",wordWrap:"on"},i=this.commandContainer.current;z(i),this.commandEditor=jo.create(i,n),vt.setEOL(this.commandEditor),vt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:o}=this,l=s==null?void 0:s.getPosition();z(l);var{lineNumber:d}=l,h=s==null?void 0:s.getModel();if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){o!=null?this.loadCommand(o+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===(h==null?void 0:h.getLineCount())){o!=null&&o>0?this.loadCommand(o-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(!a.altKey&&!a.shiftKey&&!a.metaKey&&a.keyCode===oi.Enter&&!this.isSuggestionMenuPopulated()){var c;a.stopPropagation(),a.preventDefault();var f=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(f!==void 0){var p;this.processCommand(f),(p=this.commandEditor)===null||p===void 0||p.setValue("")}}}),vt.disableKeyBindings(this.commandEditor,[qc.CtrlCmd|oi.KeyF]),vt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(vt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,n;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(n=t.getDomNode())===null||n===void 0?void 0:n.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(n=t.querySelector(".monaco-list-rows"))===null||n===void 0?void 0:n.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,n,i,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();z(s);var o=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,o);z(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:o}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(a=this.commandEditor)===null||a===void 0||a.focus()}focusEnd(){var e,t,n,i,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();z(s);var o=s.getLineCount(),l=s.getLineLength(o)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(o,l);z(d),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:o,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(a=this.commandEditor)===null||a===void 0||a.focus()}clear(){var e,t,n;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,n;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),a=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(i??a),e!==null&&e>this.history.length-xs&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return qT(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:i}=e.props;e.loadingPromise=Se.makeCancelable(t.getTable(n,i??"",e.timestamp),o=>o.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+xs-1}),e.loadingPromise=Se.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=xs,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...s.items.filter((o,l,d)=>{var{name:h}=o;return l===0||h!==d[l-1].name}).map(o=>{var{name:l}=o;return l}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(o){if(e.loadingPromise=void 0,Se.isCanceled(o)){Is.debug2("Promise canceled, not loading history");return}Is.error("Error fetching history",o)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),z(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;z(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),ZT),i=t>n,a={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:n},()=>{var s,o;(s=this.commandEditor)===null||s===void 0||s.updateOptions(a),(o=this.commandEditor)===null||o===void 0||o.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:i,isFocused:a,model:s}=this.state;return u.jsx("div",{className:Y("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:Y("console-input-inner-wrapper",{focus:a}),children:[u.jsx("div",{className:Ni.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),s&&u.jsx(vp,{model:s,language:t,session:n})]})})}}dt(Ni,"defaultProps",{maxHeight:ya*10,scope:null,disabled:!1});dt(Ni,"INPUT_CLASS_NAME","console-input");const Ou=Ni;function Cn(r,e,t){return e=QT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function QT(r){var e=JT(r,"string");return typeof e=="symbol"?e:String(e)}function JT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Du="pasted values",eO=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Ns=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Iu=[".zip"];class Vt extends v.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!eO.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ns.some(n=>e.endsWith(n))||t&&Iu.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Du?Yl:e.endsWith(".csv")?zg:e.endsWith(".zip")?Kg:qg}constructor(e){super(e),Cn(this,"fileElem",void 0),Cn(this,"divElem",void 0),Cn(this,"getValidExtensions",se(t=>t?[...Ns,...Iu]:[...Ns])),Cn(this,"getAcceptString",se(t=>this.getValidExtensions(t).join(", "))),Cn(this,"getFileTypeErrorString",se(t=>Ot.join(this.getValidExtensions(t),"or"))),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=X.createRef(),this.divElem=X.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:n,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){n();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();z(a),Vt.isValidExtension(a.name,t)?this.handleFile(a):this.setState({dropError:Vt.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Du,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Yl,action:this.handleMenuPaste,shortcut:Pr.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:i,dropError:a}=this.state,s=t??a,o=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Vt.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(ae,{actions:o}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(s===void 0||s==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:Yg})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(K,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(s===void 0||s==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ne,{icon:Vt.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!n&&u.jsx(K,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Wn,tooltip:"Remove"})]})]})]}),!!s&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:Oo})}),u.jsx("label",{children:s}),s===Vt.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Cn(Vt,"defaultProps",{allowZip:!1,dragError:null});Cn(Vt,"MULTIPLE_FILE_ERROR","Please select only one file");Cn(Vt,"FILE_TYPE_ERROR","Filetype not supported.");const rr=Vt;function qn(r,e,t){return e=tO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tO(r){var e=nO(r,"string");return typeof e=="symbol"?e:String(e)}function nO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dn{}qn(Dn,"INTEGER","int");qn(Dn,"LONG","long");qn(Dn,"DOUBLE","double");qn(Dn,"BOOLEAN","bool");qn(Dn,"STRING","string");qn(Dn,"DATE_TIME","datetime");qn(Dn,"LOCAL_TIME","localtime");const de=Dn;function mp(r,e){var t=r.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(n,i)=>e(i)),t}function xu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Nu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xu(Object(t),!0).forEach(function(n){Xe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Xe(r,e,t){return e=rO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rO(r){var e=iO(r,"string");return typeof e=="symbol"?e:String(e)}function iO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Mu="unknown",aO=2147483647,sO=-2147483648,Lu=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,Fu=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class ze{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case de.STRING:return de.STRING;case de.INTEGER:return ze.checkInteger(e);case de.LONG:return ze.checkLong(e);case de.DOUBLE:return ze.checkDouble(e);case de.BOOLEAN:return ze.checkBoolean(e);case de.DATE_TIME:return ze.checkDateTime(e);case de.LOCAL_TIME:return ze.checkLocalTime(e);default:return ze.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return ze.isNotParsableNumber(t)?de.STRING:ze.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return ze.isNotParsableNumber(t)?de.STRING:t.includes(".")?de.DOUBLE:de.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return ze.isNotParsableNumber(t)?de.STRING:de.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?de.BOOLEAN:de.STRING}static checkDateTime(e){return Lu.test(e)?de.DATE_TIME:de.STRING}static checkLocalTime(e){return Fu.test(e)?de.LOCAL_TIME:de.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(ze.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?de.BOOLEAN:Lu.test(e)&&e.includes(":")?de.DATE_TIME:Fu.test(e)?de.LOCAL_TIME:de.STRING}return ze.getNumberType(t)}static getNumberType(e){if(e.includes("."))return de.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return de.LONG;var n=parseInt(e,10);return n>aO||n<sO?de.LONG:de.INTEGER}constructor(e,t,n,i,a,s,o,l,d,h){Xe(this,"onFileCompleted",void 0),Xe(this,"file",void 0),Xe(this,"readHeaders",void 0),Xe(this,"nullString",void 0),Xe(this,"onProgress",void 0),Xe(this,"onError",void 0),Xe(this,"types",void 0),Xe(this,"chunks",void 0),Xe(this,"totalChunks",void 0),Xe(this,"rowCount",void 0),Xe(this,"isZip",void 0),Xe(this,"shouldTrim",void 0),Xe(this,"zipProgress",void 0),Xe(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=a,this.onProgress=s,this.onError=o,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Nu(Nu({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)ai.parse(this.file,this.config);else{var e=mp(this.file,this.handleNodeUpdate);ai.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(Mu),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,z(this.types);var i=[...this.types];n.forEach(o=>{if(o.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=ze.determineType(this.shouldTrim?o[l].trim():o[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
3
+ `).map(T=>T.trim()).join(" ")}function C(){if(m.current){m.current.style.height="0";var O=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);O>0&&(m.current.style.height="".concat(O,"px"))}}function y(O){var T=O.target.value;f&&(o&&(T=b(T)),p(!1)),v(T),n(T)}function S(){m.current&&(o&&(v(b(h)),C()),m.current.scrollLeft=0)}function E(){m.current&&document.activeElement!==m.current&&m.current.focus()}function w(){o&&(v(g(h)),n(g(h)))}function I(){p(!0)}return c.useEffect(function(){C()},[h]),u.jsx("textarea",{ref:m,id:l,className:Y(e,"auto-resize-textarea form-control"),placeholder:a,value:h,rows:1,onChange:y,onFocus:S,onMouseDown:E,onBlur:w,onPaste:I,spellCheck:i,disabled:s,"data-testid":d})}Ho.propTypes={value:_.string.isRequired,onChange:_.func.isRequired,className:_.string,placeholder:_.string,spellCheck:_.bool,disabled:_.bool,delimiter:_.string,id:_.string,"data-testid":_.string};Ho.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function Pi(r){var{children:e,className:t,style:n,"data-testid":i}=r;return u.jsx("div",{className:Y("btn-group",t),style:n,role:"group","data-testid":i,children:e})}Pi.displayName="ButtonGroup";Pi.propTypes={children:_.node.isRequired,className:_.string,style:_.object,"data-testid":_.string};Pi.defaultProps={className:null,style:{},"data-testid":void 0};function VS(r){var{blockInteraction:e=!0,children:t,debounceMs:n,isOpen:i=!1}=r,{value:a}=wi(i,n);return u.jsxs(u.Fragment,{children:[e&&i&&u.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),X.cloneElement(t,{isOpen:i&&a})]})}function BS(r){var{className:e,icon:t,isOpen:n=!1,subtitle:i,title:a}=r;return u.jsx(Ci,{isOpen:n,className:e,children:u.jsx(Si,{children:u.jsxs("div",{className:"info-modal",children:[t!=null&&u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:t})}),u.jsx("div",{className:"message-header",children:a}),i!=null&&u.jsx("div",{className:"message-content",children:i})]})})})}function ja(r){var{className:e="modal-footer",children:t,"data-testid":n}=r;return u.jsx("div",{className:e,"data-testid":n,children:t})}function _n(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:a,onDiscard:s,onModalDisable:o,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:v=!1,children:f,"data-testid":p}=r,m=c.useRef(null),b=c.useRef(null),g=c.useCallback(()=>{b.current!==null&&b.current.checked&&o&&o(),a()},[a,o]),C=c.useCallback(()=>{var S;(S=m.current)===null||S===void 0||S.focus()},[]),y="";return e&&(y=typeof n=="function"?n():n),u.jsxs(Ci,{isOpen:e,onOpened:C,children:[u.jsx(Na,{closeButton:!1,children:t}),u.jsx(Si,{children:y}),u.jsxs(ja,{children:[o&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:b,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),s&&u.jsx(K,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:s,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:h}),i&&u.jsx(K,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),u.jsxs(Pi,{children:[u.jsx(K,{kind:v?"danger":"primary",onClick:g,ref:m,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:d}),f]})]})]})}_n.propTypes={isOpen:_.bool.isRequired,headerText:_.string.isRequired,bodyText:_.oneOfType([_.string,_.func]).isRequired,onCancel:_.func,onConfirm:_.func.isRequired,onDiscard:_.func,onModalDisable:_.func,cancelButtonText:_.string,confirmButtonText:_.string,discardButtonText:_.string,children:_.node,"data-testid":_.string};_n.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var ka=X.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,onClick:a,style:s,id:o}=r;return u.jsx("button",{ref:e,type:"button",className:Y("btn",n),onClick:a,style:s,disabled:i,id:o,children:t})});ka.displayName="Button";ka.propTypes={children:_.node,className:_.string,disabled:_.bool,onClick:_.func,style:_.shape({}),id:_.string};ka.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Hs=ka;function ud(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ud(Object(t),!0).forEach(function(n){WS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ud(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function WS(r,e,t){return e=GS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GS(r){var e=zS(r,"string");return typeof e=="symbol"?e:String(e)}function zS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function KS(r){var{styleProps:e,selectedItemCount:t,onClearSelection:n}=r;return u.jsx(zm,hd(hd({UNSAFE_className:Uo.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:n}))}function $a(r){var{className:e,isFlipped:t,children:n,"data-testid":i}=r,a=d=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[d]},s=c.useRef(null),o=c.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=c.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return c.useEffect(function(){if(!s.current)throw Error("ref undefined");s.current.addEventListener("transitionstart",o);var h=s.current;return function(){if(h!=null)return h.removeEventListener("transitionstart",o)}},[o]),u.jsxs("div",{className:Y(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[u.jsx("div",{className:"card-flip--back",children:a(0)}),u.jsx("div",{ref:s,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}function gv(r,e,t){return e=qS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qS(r){var e=YS(r,"string");return typeof e=="symbol"?e:String(e)}function YS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ut extends c.Component{static handleEnter(e){var t=e;t.style.height="0"}static handleEntering(e){var t=e;t.style.height="".concat(Ut.getHeight(t),"px")}static handleExiting(e){var t=e;t.style.height="0"}static handleExit(e){var t=e;t.style.height="".concat(Ut.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:n}=this.props;if(n!==void 0&&n){var i=t.querySelector("input, select, textarea");i!=null&&i.focus()}}render(){var{children:e,className:t,in:n,"data-testid":i}=this.props;return u.jsx(Hn,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ut.handleEnter,onEntering:Ut.handleEntering,onEntered:this.handleEntered,onExit:Ut.handleExit,onExiting:Ut.handleExiting,timeout:350,children:a=>u.jsx("div",{className:Y({collapse:a==="exited"},t),"data-testid":i,children:e})})}}gv(Ut,"propTypes",{className:_.string,in:_.bool.isRequired,children:_.node.isRequired,autoFocusOnShow:_.bool,"data-testid":_.string});gv(Ut,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const XS=Ut;var ZS=B.module("TimeInput"),QS="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",JS=["00:00:00","12:34:56","23:59:59"];function cd(r){return r!=null?"".concat(r.substring(0,8).replace(/\u2007/g,"0")).concat("00:00:00".substring(r.length)):r}var bv=X.forwardRef((r,e)=>{var{allowValueWrapping:t=!0,className:n="",onChange:i=()=>!1,value:a=0,onFocus:s=()=>!1,onBlur:o=()=>!1,onSelect:l=()=>!1,"data-testid":d}=r,[h,v]=c.useState(vr.formatTime(a)),f=c.useRef(a),[p,m]=c.useState(),b=c.useRef(null);c.useImperativeHandle(e,()=>({focus:()=>{var w;(w=b.current)===null||w===void 0||w.focus()},setSelection:w=>{var I;(I=b.current)===null||I===void 0||I.focus(),m(w)}}),[]),c.useEffect(function(){f.current!==a&&(v(vr.formatTime(a)),f.current=a)},[f,a]);function g(w,I,O){var T=w.selectionStart===0?24:60,N=parseInt(O,10)-I;return Number.isNaN(N)?N=0:t?N=(N%T+T)%T:N=Math.min(Math.max(0,N),T-1),"".concat(N).padStart(2,"0")}function C(w,I,O,T,N){return T===0&&N===2&&I===1&&parseInt(O,10)>1?"0".concat(O).concat(w.substring(2)):_c(w,I,O)}var y=c.useCallback(w=>{ZS.debug("handleChange",w),v(w),f.current=vr.parseTime(cd(w)),i(f.current)},[i]),S=c.useCallback(()=>{var w=cd(h);w!==h&&v(w),o()},[h,o]),E=c.useCallback(w=>{m(w),l(w)},[l]);return u.jsx(Do,{ref:b,className:n,example:JS,getNextSegmentValue:g,getPreferredReplacementString:C,onChange:y,onSelect:E,pattern:QS,selection:p,value:h,onFocus:s,onBlur:S,"data-testid":d})});bv.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const fa=bv;function vd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ey(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vd(Object(t),!0).forEach(function(n){Sn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Sn(r,e,t){return e=ty(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ty(r){var e=ny(r,"string");return typeof e=="symbol"?e:String(e)}function ny(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fd=-1,Vs;(function(r){r.UP="UP",r.DOWN="DOWN"})(Vs||(Vs={}));class ut extends c.Component{constructor(e){super(e),Sn(this,"csContainer",void 0),Sn(this,"menuContainer",void 0),Sn(this,"button",void 0),Sn(this,"input",void 0);var{value:t,valueToTime:n}=e;this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.handleCustomInput=this.handleCustomInput.bind(this),this.csContainer=X.createRef(),this.menuContainer=X.createRef(),this.button=X.createRef(),this.input=X.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:n(t),inputFocused:!1}}getSelectedText(){var{options:e,value:t,placeholder:n}=this.props,{customTime:i}=this.state;if(t===null)return n;for(var a=0;a<e.length;a+=1){var s=e[a];if(s.value===t)return s.title}return vr.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:n,inputFocused:i}=this.state,{options:a}=this.props;switch(e.key){case"Enter":case" ":i?this.updateFromCustom():this.updateInputValue(a[n].value),this.closeMenu(),(t=this.button.current)===null||t===void 0||t.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(ut.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){var{keyboardOptionIndex:t,inputFocused:n}=this.state,{options:i}=this.props,a=i.length,s=t;switch(e){case ut.MENU_NAVIGATION_DIRECTION.UP:if(!n&&t===0){this.focusInput();break}else n&&this.focusOption(t);t>0&&!n?(s=(s-1)%a,this.setState({keyboardOptionIndex:s})):t===0&&(s=a-1,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s);break;case ut.MENU_NAVIGATION_DIRECTION.DOWN:if(!n&&t===a-1){this.focusInput();break}else n&&this.focusOption(t);t<a&&!(n&&t===0)&&(s=(s+1)%a,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s);break}}handleOptionClick(e){var t=Number(e.currentTarget.value),{options:n,timeToValue:i}=this.props,{customTime:a}=this.state;if(t===fd){var s=i(a);this.updateAndClose(s)}else this.updateAndClose(n[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:n}=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(),n!==null){var s=t.map(o=>o.value).indexOf(n);s<0&&this.focusInput()}}focusInput(){var e;(e=this.input.current)===null||e===void 0||e.focus()}focusOption(e){var t,n=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(n&&n.children!=null){var i=n.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,n=t(e);this.updateInputValue(n),this.setState({customTime:e})}updateFromCustom(){var{timeToValue:e}=this.props,{customTime:t}=this.state,n=e(t);this.updateInputValue(n)}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 n=e.map(i=>i.value).indexOf(t);n>0&&this.setState({keyboardOptionIndex:n})}}scrollOptionIntoView(e){var t,n=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(n&&n.children!=null){var i=n.children.item(e);i instanceof HTMLElement&&i.offsetTop>ut.DROP_DOWN_MENU_HEIGHT?n.scrollTop=i.offsetTop-ut.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(n.scrollTop=0)}}renderMenuElement(){var{inputWidth:e}=this.state;return u.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:u.jsx("div",{className:"cs-options-container",children:u.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){for(var{options:e,value:t,icon:n,customText:i}=this.props,{keyboardOptionIndex:a,customTime:s,inputFocused:o}=this.state,l=!1,d=[],h=0;h<e.length;h+=1){var v=e[h],f="option-".concat(h,"-").concat(v.value);l=l||v.value===t,d.push(u.jsxs("button",{type:"button",value:h,className:Y("cs-option-btn",{"keyboard-active":a===h&&!o}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[v.value===t&&u.jsx(ne,{icon:n,className:"mr-2"}),v.value!==t&&u.jsx("span",{className:"mr-4"}),v.title]},f))}return d.push(u.jsx("hr",{className:"cs-divider"},"option-divider")),d.push(u.jsxs("button",{type:"button",value:fd,className:Y("cs-option-btn",{"keyboard-active":o}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?u.jsx(ne,{icon:n,className:"mr-2"}):u.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),d.push(u.jsxs("div",{className:"cs-custom-container",children:[u.jsx("span",{className:"mr-2"}),u.jsx(fa,{ref:this.input,onChange:this.handleCustomInput,value:s,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),u.jsx("span",{className:"ml-2"})]},"cs-custom-container")),d.push(u.jsx("hr",{className:"mb-2"},"option-end")),d}render(){var{disabled:e,invalid:t,value:n,"data-testid":i}=this.props,{menuIsOpen:a}=this.state,{popperOptions:s}=this.props;return s=ey({placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}}},s),u.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:u.jsx("div",{className:Y("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:u.jsxs("button",{type:"button",className:Y("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[u.jsx("span",{className:Y({"text-muted":n===null}),children:this.getSelectedText()}),u.jsx("span",{className:"cs-caret"}),u.jsx(En,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:s,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}Sn(ut,"MENU_NAVIGATION_DIRECTION",Vs);Sn(ut,"DROP_DOWN_MENU_HEIGHT",125);Sn(ut,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:cr,customText:"Custom",placeholder:"Select a time",valueToTime:r=>r===null?0:Math.round(r/1e3),timeToValue:r=>r*1e3,invalid:!1,"data-testid":void 0});const ry=ut;var iy=B.module("DateInput"),ay="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",sy=["2000-01-01","2022-12-31"],oy="YYYY-MM-DD",Cv=X.forwardRef((r,e)=>{var{className:t="",onChange:n=()=>{},defaultValue:i="",onFocus:a=()=>{},onBlur:s=()=>{},"data-testid":o}=r,[l,d]=c.useState(i),[h,v]=c.useState(),f=c.useCallback(p=>{iy.debug("handleChange",p),d(p),n(p)},[n]);return u.jsx("div",{className:"d-flex flex-row align-items-center",children:u.jsx(Do,{ref:e,className:Y(t),example:sy,getNextSegmentValue:bb,onChange:f,onSelect:v,pattern:ay,placeholder:oy,selection:h,value:l,onFocus:a,onBlur:s,"data-testid":o})})});Cv.displayName="DateInput";const ly=Cv;function Sv(r,e,t){return e=dy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dy(r){var e=uy(r,"string");return typeof e=="symbol"?e:String(e)}function uy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yv extends c.PureComponent{constructor(e){super(e),Sv(this,"searchInput",void 0),this.searchInput=X.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Le(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:n,id:i,"data-testid":a}=this.props,{value:s}=this.state;return u.jsx(Ei,{value:s,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":a})}}Sv(yv,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Ev=yv;function hy(r){var{isInvalid:e=!1,items:t,onAdd:n=()=>{},onDelete:i=()=>{},validate:a=()=>null}=r,[s,o]=c.useState(null),[l,d]=c.useState([]),[h,v]=c.useState(""),f=c.useCallback(S=>{d(S)},[]),p=c.useCallback(()=>{i(ua.getItemsInRanges(t,l)),d([])},[t,l,i]),m=c.useCallback(()=>{if(h!==""){var S=a(h);S==null?(n(h),v("")):o(S)}},[h,n,a]),b=c.useCallback(S=>{var{value:E}=S.target;v(E),o(E===""?null:a(E))},[a]),g=c.useCallback(()=>{d([])},[]),C=c.useCallback(S=>{S.key==="Enter"&&m()},[m]),y=c.useMemo(()=>14+ar(t.length,1,6)*wr.DEFAULT_ROW_HEIGHT,[t.length]);return u.jsxs("div",{className:Y("editable-item-list-container",{"is-invalid":e}),children:[u.jsx("div",{style:{height:y},children:u.jsx(wr,{itemCount:t.length,items:t.map((S,E)=>({value:S,isSelected:ua.isSelected(l,E)})),offset:0,selectedRanges:l,onSelectionChange:f,isMultiSelect:!0})}),u.jsxs("div",{className:"d-flex flex-row pt-2",children:[u.jsx("div",{className:"d-flex flex-grow-1",children:u.jsx("input",{className:Y("form-control",{"is-invalid":s!=null}),placeholder:"Enter value",type:"text",value:h,onChange:b,onFocus:g,onKeyDown:C})}),u.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[u.jsx(K,{kind:"ghost",onClick:m,disabled:s!=null||h==="",icon:hg,tooltip:"Add new item","data-testid":"add-item-button"}),u.jsx(K,{kind:"ghost",onClick:p,disabled:l.length===0,icon:Wn,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}var cy=B.module("ErrorBoundary");class vy extends c.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:n}=this.props;cy.error("Error caught by ErrorBoundary",e,t),n==null||n(e,t)}render(){var{children:e,className:t,fallback:n}=this.props,{error:i}=this.state;return i!=null?n??u.jsx("div",{className:t,children:u.jsx(He,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function fy(r,e,t){return e=py(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function py(r){var e=my(r,"string");return typeof e=="symbol"?e:String(e)}function my(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fr extends c.Component{static isParentSelected(e,t){var n=t.get(e);if(n===void 0)return!1;if(typeof n=="boolean")return n;var i=Array.from(n.values()).includes(!0),a=Array.from(n.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:n}=t;return{menuIsOpen:!n}})}toggleValueFor(e,t){var{valueMap:n,onUpdateValueMap:i}=this.props,a=new Map(n),s=a.get(e);if(s instanceof Map){var o=new Map(s);if(t!=null)o.set(t,s.get(t)===void 0);else{var l=fr.isParentSelected(e,a),d=l==null||!l;s.forEach((f,p)=>o.set(p,d))}a.set(e,o)}else a.set(e,s==null||!s);var h=a.get(e);if(t===void 0&&h!==void 0&&typeof h!="boolean"){var v=fr.isParentSelected(e,n);v!=null&&v?h.forEach((f,p)=>h.set(p,!1)):h.forEach((f,p)=>h.set(p,!0))}i(a)}setAllValues(e){var{valueMap:t,onUpdateValueMap:n}=this.props,i=new Map;t.forEach((a,s)=>{if(typeof a=="boolean")i.set(s,e);else{var o=new Map;a.forEach((l,d)=>o.set(d,e)),i.set(s,o)}}),n(i)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){var{valueMap:e,"data-testid":t}=this.props;return u.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(n=>{var[i,a]=n;return u.jsxs("div",{children:[u.jsx(ha,{className:"hcm-parent",checked:fr.isParentSelected(i,e),onChange:()=>this.toggleValueFor(i),children:i}),a!==void 0&&typeof a!="boolean"&&Array.from(a.entries()).map(s=>{var[o,l]=s;return u.jsx(ha,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(i,o),children:o},o)})]},i)}),u.jsx(K,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?"".concat(t,"-btn-select-all"):void 0,children:"Select All"}),u.jsx(K,{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:n,id:i,"data-testid":a}=this.props,{menuIsOpen:s}=this.state;return u.jsxs("button",{type:"button",className:Y("btn hcm-btn",t),onClick:this.toggleMenu,id:i,"data-testid":a,children:[u.jsxs("span",{children:[n&&u.jsx(ne,{icon:n,className:"hcm-icon mr-1"}),e]}),u.jsx("span",{className:"cs-caret"}),u.jsx(yi,{options:{placement:"bottom"},isShown:s,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}fy(fr,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const gy=fr;function pd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ms(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pd(Object(t),!0).forEach(function(n){by(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function by(r,e,t){return e=Cy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cy(r){var e=Sy(r,"string");return typeof e=="symbol"?e:String(e)}function Sy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wv=c.memo(r=>{var{tab:e,onClose:t,onSelect:n,isActive:i,activeRef:a,index:s,isDraggable:o,contextActions:l}=r,{key:d,isClosable:h=t!=null,title:v}=e;return u.jsx(Km,{draggableId:d,index:s,isDragDisabled:!o,children:(f,p)=>u.jsxs("div",{className:"context-menu-wrapper",ref:i?a:null,children:[u.jsxs("div",ms(ms(ms({ref:f.innerRef},f.draggableProps),f.dragHandleProps),{},{className:Y("btn btn-link btn-nav-tab",{active:i},{dragging:p.isDragging}),"data-testid":"btn-nav-tab-".concat(v),role:"tab",tabIndex:0,onClick:m=>{m.target.focus(),n(d)},onKeyPress:m=>{m.key==="Enter"&&n(d)},children:[v,h&&u.jsx(K,{kind:"ghost",className:"btn-nav-tab-close",onClick:m=>{t==null||t(d),m.stopPropagation(),m.preventDefault()},icon:wo,tooltip:"Close"})]})),u.jsx(ae,{actions:l})]})},d)});wv.displayName="NavTab";const yy=wv;function md(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?md(Object(t),!0).forEach(function(n){Ey(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):md(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ey(r,e,t){return e=wy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wy(r){var e=Py(r,"string");return typeof e=="symbol"?e:String(e)}function Py(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var _y=500,Ty=.01,Oy=5e-4;function bd(r){return r.scrollLeft===0}function Cd(r){return r.scrollLeft+r.clientWidth===r.scrollWidth||r.scrollWidth===0}function Dy(r,e,t){var{isClosable:n=!1,key:i}=r,a=[];if(n&&t!=null){a.push({title:"Close",order:10,group:20,action:()=>{t(i)}});for(var s=!0,o=e.length-1;o>0&&e[o].key!==r.key;o-=1)if(e[o].isClosable===!0){s=!1;break}a.push({title:"Close to the Right",order:20,group:20,action:()=>{for(var l=e.length-1;l>0&&e[l].key!==i;l-=1)e[l].isClosable===!0&&t(e[l].key)},disabled:s}),a.push({title:"Close All",order:30,group:20,action:()=>{e.forEach(l=>{l.isClosable===!0&&t(l.key)})}})}return a}function Iy(r){var{activeKey:e,tabs:t,onSelect:n,onReorder:i,onClose:a,makeContextActions:s}=r,o=c.useRef(),[l,d]=c.useState(!0),[h,v]=c.useState(!0),[f,p]=c.useState(!0),m=c.useCallback(()=>{o.current!=null&&(o.current.clientWidth<o.current.scrollWidth&&t.length>0?d(!0):d(!1),v(bd(o.current)),p(Cd(o.current)))},[t]);$o(o.current,m);var b=c.useCallback(D=>{js.stopDragging(),D.destination&&(i==null||i(D.source.index,D.destination.index))},[i]),g=c.useCallback(()=>{if(o.current!=null){var D=bd(o.current);D!==h&&v(D);var M=Cd(o.current);M!==f&&p(M)}},[h,f]),C=c.useRef({cancelClick:!1}),y=c.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:D}=o.current,M=D.length-1;M>=0;M-=1){var F=D[M];if(F.offsetLeft<o.current.scrollLeft-5){F.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"});return}}},[]),S=c.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:D}=o.current,M=0;M<D.length;M+=1){var F=D[M];if(F.offsetLeft+5>o.current.scrollLeft+o.current.offsetWidth){F.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"});return}}},[]),E=c.useCallback(function(D,M){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3?arguments[3]:void 0,H=o.current;H!=null&&(C.current.cancelClick=!0,D==="left"?H.scrollLeft=M-F:D==="right"&&(H.scrollLeft=M+F),C.current.rAF=requestAnimationFrame(q=>{var re=k??q,V=q-re,x=Ty*V+.5*Oy*V**2;x=Math.min(x,H.scrollWidth),E(D,M,x,re)}))},[]),w=c.useCallback(()=>{var{holdTimer:D,rAF:M}=C.current;D!=null&&(clearTimeout(D),C.current.holdTimer=void 0),M!=null&&(cancelAnimationFrame(M),C.current.rAF=void 0),window.removeEventListener("mouseup",w)},[]);c.useEffect(()=>()=>window.removeEventListener("mouseup",w),[w]);var I=c.useCallback(D=>{o.current!=null&&(C.current.holdTimer=window.setTimeout(E,_y,D,o.current.scrollLeft)),C.current.cancelClick=!1,window.addEventListener("mouseup",w)},[w,E]),O=c.useCallback(()=>{I("left")},[I]),T=c.useCallback(()=>{I("right")},[I]);c.useEffect(function(){var M,F=k=>{k.stopPropagation(),k.preventDefault();var H=k.currentTarget,q=Math.abs(k.deltaY)>Math.abs(k.deltaX)?k.deltaY:k.deltaX;H.scrollLeft+=ar(q,-30,30)};return(M=o.current)===null||M===void 0||M.addEventListener("wheel",F),()=>{var k;(k=o.current)===null||k===void 0||k.removeEventListener("wheel",F)}},[]);var N=c.useMemo(()=>{var D=new Map;return t.forEach(M=>{var{key:F}=M,k=[()=>Dy(M,t,a),()=>{var H;return(H=s==null?void 0:s(M))!==null&&H!==void 0?H:[]}];D.set(F,k)}),D},[s,t,a]),R=c.useRef(null),W=t.find(D=>D.key===e),L=t.map((D,M)=>{var{key:F}=D,k=D===W;return u.jsx(yy,{tab:D,index:M,isActive:k,activeRef:R,onSelect:n,onClose:a,isDraggable:i!=null,contextActions:N.get(F)},F)});return c.useEffect(function(){R.current!=null&&R.current.scrollIntoView({block:"nearest",inline:"nearest"})},[e]),u.jsxs("nav",{className:"nav-container",children:[l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:cg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-left",tooltip:"Scroll left",onClick:y,onMouseDown:O,disabled:h}),u.jsx(qm,{onDragStart:js.startDragging,onDragEnd:b,children:u.jsx(Ym,{droppableId:"droppable-tab-navigation",direction:"horizontal",children:(D,M)=>u.jsxs("div",gd(gd({ref:F=>{F!=null&&(o.current=F,D.innerRef(F))}},D.droppableProps),{},{className:Y("nav nav-tabs",{dragging:M.draggingFromThisWith}),role:"tablist",onScroll:g,children:[L,D.placeholder]}))})}),l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:vg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-right",tooltip:"Scroll right",onClick:S,onMouseDown:T,disabled:f})]})}function xy(){var{selectedThemeKey:r,setSelectedThemeKey:e,themes:t}=jr(),n=c.useCallback(i=>{e(i)},[e]);return u.jsx(Xm,{label:"Pick a color scheme",items:t,selectedKey:r,onSelectionChange:n,children:i=>u.jsx(uc,{children:i.name},i.themeKey)})}function Ny(r){var{className:e,style:t}=r;return u.jsx("div",{className:Y("dh-logo",e),style:t})}var My=.025,Ly=.9,Fy=.1,Ay=.618,Sd=80,Jn={SIZE:8,DOT_SIZE:2},sn=18,Ry=250,jy=60*1e3,ky={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 $y(){return Po(ky)}var Uy=X.memo(()=>{var{activeThemes:r}=jr(),e=c.useMemo($y,[r]),t=c.useRef(null),n=c.useRef(null),[i,a]=c.useState(!1),s=window.devicePixelRatio,o,l,d,h,v,f=null,p=[];function m(){var L;n.current!=null&&(d=n.current.offsetWidth,h=n.current.offsetHeight),t.current!=null&&(t.current.style.width="".concat(d,"px"),t.current.style.height="".concat(h,"px"),t.current.width=d*s,t.current.height=h*s),(L=o)===null||L===void 0||L.scale(s,s)}function b(){var{foregroundFill:L,foregroundStroke:D}=e,M=document.createElement("canvas");M.width=Jn.SIZE,M.height=Jn.SIZE;var F=M.getContext("2d");return F!=null&&(F.fillStyle=D,F.fillRect(0,0,Jn.DOT_SIZE,Jn.DOT_SIZE),F.fillStyle=L,F.fillRect(0,0,Jn.SIZE,Jn.SIZE)),F==null?void 0:F.createPattern(M,"repeat")}function g(L){var D=Math.random()-.5,M=My*D;return L<Fy?M=Math.abs(M):L>Ly&&(M=-Math.abs(M)),L+M}function C(){for(var L=[],D=Ay,M=0;M<d+sn;M+=1)D=g(D),L.push(D);return L}function y(){for(;p.length>=d+sn;)p.pop();for(;p.length<d+sn;)p.push(g(p[p.length-1]))}function S(L,D){D.beginPath(),D.moveTo(-1,h+1),D.lineTo(-1,h*L[0]);for(var M=0;M<L.length;M+=1)D.lineTo(M,h*L[M]);D.lineTo(d+sn,h*L[L.length-1]),D.lineTo(d+sn,h+1),D.closePath()}function E(L){L.beginPath();for(var D=1;D<d;D+=Sd)L.moveTo(D,0),L.lineTo(D,h);for(var M=1;M<h;M+=Sd)L.moveTo(0,M),L.lineTo(d,M)}function w(L){var D,M,F;f=(D=f)!==null&&D!==void 0?D:L;var{background:k,foregroundStroke:H,gridColor:q}=e;z(o),o.fillStyle=k,o.fillRect(0,0,d,h),E(o),o.lineWidth=1,o.strokeStyle=q,o.stroke();var re=(((M=f)!==null&&M!==void 0?M:0)-(L??0))/(1e3/sn);if(o.translate(re,0),S(p,o),o.lineWidth=2,o.strokeStyle=H,o.stroke(),o.translate(-re,0),l!=null&&(o.fillStyle=l),o.fill(),o.setTransform(s,0,0,s,0,0),(L??0)-((F=f)!==null&&F!==void 0?F:0)>1e3/sn){for(var V,x=Math.floor(((L??0)-((V=f)!==null&&V!==void 0?V:0))/(1e3/sn)),P=0;P<x;P+=1)p.shift(),p.push(g(p[p.length-1]));f=L}v!=null&&cancelAnimationFrame(v),v=requestAnimationFrame(w)}var I=Le(()=>{v=requestAnimationFrame(L=>{m(),y(),a(!1),w(L)})},Ry,{leading:!0});function O(){a(!0),v!=null&&cancelAnimationFrame(v),v=null,f=null}var T=Le(()=>{O()},jy);function N(){v==null&&(a(!1),m(),y(),v=requestAnimationFrame(w)),T()}function R(){document.hasFocus()&&N()}function W(){v!=null&&cancelAnimationFrame(v),T(),I()}return c.useEffect(()=>{var L;return o=(L=t.current)===null||L===void 0?void 0:L.getContext("2d",{alpha:!1}),m(),p=C(),l=b(),w(),T(),window.addEventListener("resize",W),window.addEventListener("focus",N),window.addEventListener("blur",O),window.addEventListener("mousemove",R),window.addEventListener("keydown",R),()=>{v!=null&&cancelAnimationFrame(v),window.removeEventListener("resize",W),window.removeEventListener("focus",N),window.removeEventListener("blur",O),window.removeEventListener("mousemove",R),window.removeEventListener("keydown",R),T.cancel(),I.cancel()}},[e]),u.jsx("div",{className:"random-area-plot-animation-container",ref:n,children:u.jsx("canvas",{ref:t,className:i?"shade":""})})});const Pv=Uy;function _v(r){var{text:e,placement:t="top-start"}=r,n=c.useMemo(()=>({placement:t}),[t]);return u.jsxs(u.Fragment,{children:[u.jsx(oc,{UNSAFE_className:Uo.spectrumEllipsis,children:e??u.jsx(u.Fragment,{children:" "})}),e==null||e===""?null:u.jsx(wt,{options:n,children:e})]})}var Hy=["scrollRef","getItemDisplayText","getKey"];function yd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ed(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yd(Object(t),!0).forEach(function(n){Vy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Vy(r,e,t){return e=By(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function By(r){var e=Wy(r,"string");return typeof e=="symbol"?e:String(e)}function Wy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Gy(r,e){if(r==null)return{};var t=zy(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function zy(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Ky(r){var{scrollRef:e,getItemDisplayText:t,getKey:n}=r,i=Gy(r,Hy),a=c.useCallback(s=>{var o=n(s),l=t(s);return u.jsx(uc,{textValue:l??String(o),children:u.jsx(_v,{text:l})},o)},[t,n]);return u.jsx(Zm,Ed(Ed({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var Vo=X.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,id:a,isLinked:s,isLinkedSource:o,isInvalid:l,onClick:d,onMouseEnter:h,onMouseLeave:v,style:f,"data-testid":p}=r;return u.jsxs("button",{ref:e,type:"button",className:Y("btn-socketed",{"btn-socketed-linked":s!==void 0&&s||o},{"btn-socketed-linked-source":o},{"is-invalid":l},n),id:a,onClick:d,onMouseEnter:h,onMouseLeave:v,style:f,disabled:i,"data-testid":p,children:[t,u.jsx(ne,{icon:fg,className:"linked btn-socketed-icon",transform:"down-1"}),u.jsx(ne,{icon:pg,className:"is-invalid btn-socketed-icon"})]})});Vo.displayName="SocketedButton";Vo.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 Bo=Vo;var qy=500;function Yy(r){var{heading:e,content:t,delayMs:n=qy}=r,[i,a]=c.useState(!1);return c.useEffect(()=>{window.setTimeout(()=>{a(!0)},n)},[n]),i?u.jsxs(Qm,{children:[u.jsx(yo,{size:"XXL",children:u.jsx(ne,{icon:mg})}),u.jsx(lc,{children:e}),t==null?null:u.jsx(dc,{children:t})]}):null}const Xy="_modified_5rbci_24",Zy="_track_5rbci_35",Qy="_handle_5rbci_15",Jy="_ticks_5rbci_103",Tv={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_5rbci_5","time-slider-popovers":"_time-slider-popovers_5rbci_10","handle-popper":"_handle-popper_5rbci_15",modified:Xy,"flex-spacer":"_flex-spacer_5rbci_31",track:Zy,"track-fills":"_track-fills_5rbci_42","track-fill":"_track-fill_5rbci_42","track-fill-start":"_track-fill-start_5rbci_60","track-fill-middle":"_track-fill-middle_5rbci_61","track-fill-end":"_track-fill-end_5rbci_64","handle-track":"_handle-track_5rbci_67",handle:Qy,ticks:Jy,"tick-labels":"_tick-labels_5rbci_121","tick-label":"_tick-label_5rbci_121","tick-label-wrapper":"_tick-label-wrapper_5rbci_137"};var Ui=parseInt(Tv["handle-size"],10),wd=parseInt(Tv["popover-width"],10),ft=24*60*60-1,Pd=5*60;function eE(r){var{startTime:e,endTime:t,onChange:n,isStartModified:i=!1,isEndModified:a=!1,"data-testid":s}=r,[o,l]=c.useState(e),[d,h]=c.useState(t),v=c.useRef(null);c.useEffect(function(){l(e),h(t)},[e,t]);var f=c.useCallback((b,g)=>{var C=b,y=g;C===y&&(y<ft?y+=1:C-=1),l(C),h(y),n({startTime:C,endTime:y})},[l,h,n]),p=c.useCallback(b=>{f(b,d)},[f,d]),m=c.useCallback(b=>{f(o,b)},[f,o]);return u.jsxs("div",{className:"time-slider","data-testid":s,children:[u.jsx(tE,{startTime:o,endTime:d,onStartTimeChange:p,onEndTimeChange:m,isStartModified:i,isEndModified:a}),u.jsxs("div",{className:"track",ref:v,children:[u.jsx(nE,{startTime:o,endTime:d}),u.jsx("div",{className:"ticks",children:Array(24).fill(null).map((b,g)=>u.jsx("div",{className:"tick"},g))}),u.jsx(_d,{track:v,time:o,setTime:p}),u.jsx(_d,{track:v,time:d,setTime:m})]}),u.jsxs("div",{className:"tick-labels",children:[u.jsx("div",{className:"tick-label",children:"0:00"}),u.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((b,g)=>u.jsx("div",{className:"tick-label",children:"".concat(g+1,":00")},g))})]})]})}function tE(r){var{startTime:e,endTime:t,onStartTimeChange:n,onEndTimeChange:i,isStartModified:a,isEndModified:s,"data-testid":o}=r,l=e>t,[d,h]=c.useState(l?t:e),[v,f]=c.useState(l?e:t),p=c.useRef(null),m=c.useRef(null),b=c.useRef(null),g=c.useRef(null);c.useEffect(function(){h(e>t?t:e),f(e>t?e:t)},[e,t]),c.useEffect(function(){if(b.current!==null){var I;(I=m.current)===null||I===void 0||I.setSelection(b.current)}if(g.current!==null){var O;(O=p.current)===null||O===void 0||O.setSelection(g.current)}},[l]);function C(w){e<=t?n(w):i(w)}function y(w){e<=t?i(w):n(w)}var S=c.useCallback(w=>{b.current=w,g.current=null},[]),E=c.useCallback(w=>{b.current=null,g.current=w},[]);return u.jsxs("div",{className:"time-slider-popovers",children:[u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(d/ft*100,"% - ").concat(wd/2,"px)")}}),u.jsxs("div",{className:"handle-popper",children:[u.jsx("label",{className:Y({modified:l?s:a}),children:l?"End Time":"Start Time"}),u.jsx(fa,{ref:p,allowValueWrapping:!1,value:d,onChange:C,onSelect:S,"data-testid":o!==void 0?"".concat(o,"-input-1"):void 0})]}),u.jsx("div",{className:"flex-spacer"}),u.jsxs("div",{className:"handle-popper",children:[u.jsx("label",{className:Y({modified:l?a:s}),children:l?"Start Time":"End Time"}),u.jsx(fa,{ref:m,allowValueWrapping:!1,value:v,onChange:y,onSelect:E,"data-testid":o!==void 0?"".concat(o,"-input-2"):void 0})]}),u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat((ft-v)/ft*100,"% - ").concat(wd/2,"px)")}})]})}function nE(r){var{startTime:e,endTime:t,"data-testid":n}=r;return u.jsxs("div",{className:"track-fills","data-testid":n,children:[e>t&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"track-fill track-fill-start",style:{transform:"scaleX(".concat(t/ft,")")}}),u.jsx("div",{className:"track-fill track-fill-end",style:{transform:"scaleX(".concat((ft-e)/ft,")")}})]}),e<t&&u.jsx("div",{className:"track-fill track-fill-middle",style:{transform:"translateX(".concat(e/ft*100,"%) scaleX(").concat((t-e)/ft,")")}})]})}function _d(r){var{track:e,time:t,setTime:n,"data-testid":i}=r,a=c.useMemo(()=>{var f=3600,p=Ui/2;return t<f?p=t/f*(Ui/2):t>23*f&&(p=Ui/2+1/(ft-23*f)*(t-23*f)*(Ui/2)),"translateX(calc(".concat(t/ft*100,"% - ").concat(p,"px))")},[t]),s=c.useCallback(f=>{if(!e.current)return 0;var p=e.current.getBoundingClientRect(),m=Math.max(f-p.left,0),b=ft*Math.min(1,m/p.width),g=Pd*Math.round(b/Pd),C=Math.min(ft,g);return C},[e]),o=c.useCallback(f=>{var{clientX:p}=f;n(s(p))},[n,s]),l=c.useCallback(f=>{var{clientX:p}=f;n(s(p)),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[n,s,o]),d=c.useCallback(()=>{window.addEventListener("mousemove",o),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[o,l]),h=c.useCallback(()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[o,l]),v=c.useCallback(()=>{d()},[d]);return c.useEffect(function(){return()=>{h()}},[h]),u.jsx("div",{className:"handle-track",style:{transform:a},children:u.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:v,"data-testid":i})})}function Ov(r){var{buttons:e,isShown:t=!1,classNames:n,message:i,type:a,onClick:s,onDismiss:o,"data-testid":l}=r,d=e&&e.length!==0;return u.jsx(Hn,{in:t,timeout:Vn.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:u.jsxs("div",{className:Y("toast-notification",n,a),role:"presentation",onClick:s,onKeyPress:s,"data-testid":l,children:[u.jsx("div",{className:"message-container",children:u.jsx("span",{className:"message",children:i})}),u.jsx(Hn,{in:d,timeout:Vn.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx("div",{className:"buttons-container",children:e})}),o&&u.jsx(K,{kind:"ghost",icon:wo,tooltip:"Close notification",className:"my-2",onClick:o})]})})}Ov.TYPE=Object.freeze({ERROR:"error"});function rE(r){var{children:e,className:t,labelText:n,hintText:i,isModified:a,validationError:s,showValidationError:o=!0,"data-testid":l,id:d}=r,{current:h}=c.useRef(d??ye());return u.jsxs(u.Fragment,{children:[u.jsx("label",{className:Y("validate-label",t,{modified:a}),htmlFor:h,"data-testid":l,children:n}),X.Children.toArray(e).map(v=>X.isValidElement(v)?X.cloneElement(v,{className:Y(v.props.className,{"is-invalid":s})}):u.jsx("div",{className:Y(t),children:v})),i!==void 0&&u.jsx("small",{className:"form-text text-muted",children:i}),s!==void 0&&o&&u.jsx("p",{className:"validate-label-error text-danger",children:s})]})}const iE=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:Jc,AutoCompleteInput:HS,AutoResizeTextarea:Ho,BasicModal:_n,BulkActionBar:KS,Button:K,ButtonGroup:Pi,ButtonOld:Hs,CSS_VAR_EXPRESSION_PREFIX:gg,CardFlip:$a,Checkbox:ha,Collapse:XS,ComboBox:Cb,ConfirmActionButton:xS,ConfirmationDialog:pv,ContextActionUtils:Sb,ContextActions:ae,ContextMenuItem:yb,ContextMenuRoot:Tc,CopyButton:Io,CustomTimeSelect:ry,DEFAULT_DARK_THEME_KEY:bg,DEFAULT_DARK_THEME_PALETTE:Cg,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:_c,DEFAULT_LIGHT_THEME_KEY:Sg,DEFAULT_PRELOAD_DATA_VARIABLES:yg,DateInput:ly,DateTimeInput:Eb,DebouncedModal:VS,DebouncedSearchInput:Ev,DragUtils:js,DraggableItemList:wb,DropdownMenu:En,EditableItemList:hy,ErrorBoundary:vy,GLOBAL_SHORTCUTS:Pr,HierarchicalCheckboxMenu:gy,IconActionButton:mv,InfoModal:BS,ItemList:wr,ItemListItem:Pb,get KEY(){return fe},LoadingOverlay:He,LoadingSpinner:Ma,Logo:Ny,get MODIFIER(){return pe},MaskedInput:Do,Menu:_b,MenuItem:Tb,Modal:Ci,ModalBody:Si,ModalFooter:ja,ModalHeader:Na,NON_WHITESPACE_REGEX:Eg,NavTabList:Iy,Option:Ob,Page:Db,Popper:yi,RadioGroup:Oc,RadioItem:ks,RandomAreaPlotAnimation:Pv,SVG_ICON_MANUAL_COLOR_MAP:wg,SearchInput:Ei,SearchableCombobox:Ky,Select:Bn,SelectValueList:Dc,Shortcut:Ib,ShortcutRegistry:qe,SocketedButton:Bo,Stack:xb,THEME_CACHE_LOCAL_STORAGE_KEY:Pg,TMP_CSS_PROP_PREFIX:_g,TableViewEmptyState:Yy,TextWithTooltip:_v,ThemeContext:Nb,ThemeExport:Vn,ThemePicker:xy,ThemeProvider:Ic,TimeInput:fa,TimeSlider:eE,ToastNotification:Ov,Tooltip:wt,UISwitch:xc,ValidateLabelInput:rE,WHITESPACE_REGEX:Tg,calculatePreloadStyleContent:Og,createCssVariableResolver:Dg,createPreloadStyleElement:Ig,extractDistinctCssVariableExpressions:xg,fillToLength:Mb,getActiveThemes:Ng,getDefaultBaseThemes:Mg,getExpressionRanges:fc,getThemeKey:pc,getThemePreloadData:Lg,overrideSVGFillColors:Fg,preloadTheme:Ag,replaceSVGFillColor:Rg,resolveCssVariablesInRecord:Po,resolveCssVariablesInString:jg,setThemePreloadData:kg,themeDHDefault:Lb,themeDark:$g,themeLight:Ug,trimTrailingMask:Fb,useTheme:jr},Symbol.toStringTag,{value:"Module"}));function aE(r,e){var t=Ve(),n=c.useMemo(()=>new t.CoreClient(r,e),[t,r,e]);return c.useEffect(()=>()=>{n.disconnect()},[n]),n}var Wo=c.createContext(null);function Dv(r){var{serverUrl:e,options:t,children:n}=r,i=aE(e,t);return u.jsx(Wo.Provider,{value:i,children:n})}function Td(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function sE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Td(a,n,i,s,o,"next",l)}function o(l){Td(a,n,i,s,o,"throw",l)}s(void 0)})}}var Iv=c.createContext(null);function xv(r){var[e,t]=c.useState(null),[n,i]=c.useState(null),a=c.useContext(Iv),s=c.useContext(La);return c.useEffect(()=>{if(a==null){if(s!=null){t(s),i(null);return}t(null),i(new Error("No API available in useDeferredApi. Was code wrapped in ApiBootstrap or DeferredApiContext.Provider?"));return}var o=!1;function l(){return d.apply(this,arguments)}function d(){return d=sE(function*(){if(typeof a=="function")try{var h=yield a(r);o||(t(h),i(null))}catch(v){o||(t(null),i(v))}else t(a)}),d.apply(this,arguments)}return l(),()=>{o=!0}},[s,a,r]),[e,n]}var Nv=X.memo(r=>{var{children:e,onError:t,widget:n}=r,[i,a]=xv(n);return a!=null?(t==null||t(a),null):i==null?null:u.jsx(La.Provider,{value:i,children:e})});Nv.displayName="DeferredApiBootstrap";function Gn(){return Rr(Wo,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}function Go(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function zo(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function oE(r){return Go(r)||zo(r)}var Ko=c.createContext(null);function Mv(r){if(zo(r))return{id:r.id,type:r.type};if(Go(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function Lv(r){var e,t;return{type:(e=r.type)!==null&&e!==void 0?e:"",name:(t=r.title)!==null&&t!==void 0?t:r.name,id:r.id}}function Fv(){return Rr(Ko,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}const lE=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Hg,ApiContext:La,ClientBootstrap:Dv,ClientContext:Wo,DeferredApiBootstrap:Nv,DeferredApiContext:Iv,ObjectFetcherContext:Ko,getVariableDescriptor:Lv,isIdVariableDescriptor:zo,isNameVariableDescriptor:Go,isVariableDescriptor:oE,sanitizeVariableDescriptor:Mv,useApi:Ve,useClient:Gn,useDeferredApi:xv,useObjectFetcher:Fv},Symbol.toStringTag,{value:"Module"}));function dE(r){return function(t){var{children:n}=t;return u.jsx(La.Provider,{value:r,children:n})}}function Od(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function uE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Od(a,n,i,s,o,"next",l)}function o(l){Od(a,n,i,s,o,"throw",l)}s(void 0)})}}var gs=B.module("MessageUtils"),Av="io.deephaven.message.LoginOptions.request",Rv="io.deephaven.message.SessionDetails.request",jv="io.deephaven.broadcast",qo="io.deephaven.broadcast.Login",kv="io.deephaven.broadcast.Logout";function Ua(r){var e=r;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function $v(r){return Ua(r)&&r.message===qo}function Uv(r){return Ua(r)&&r.message===kv}function Hv(r){var e=r;return e!=null&&typeof e.id=="string"}function Yo(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye(),t=arguments.length>2?arguments[2]:void 0;return{message:r,id:e,payload:t}}function hE(r,e){return{id:r,payload:e}}function Xo(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function Zo(r){return Bs.apply(this,arguments)}function Bs(){return Bs=uE(function*(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=Xo();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((n,i)=>{var a,s=ye(),o=l=>{var{data:d}=l;if(!Hv(d)){gs.debug("Ignoring non-deephaven response",d);return}if(gs.debug("Received message",d),(d==null?void 0:d.id)!==s){gs.debug("Ignore message, id doesn't match",d);return}window.clearTimeout(a),window.removeEventListener("message",o),n(d.payload)};window.addEventListener("message",o),a=window.setTimeout(()=>{window.removeEventListener("message",o),i(new Ab("Request timed out"))},e),t.postMessage(Yo(r,s),"*")})}),Bs.apply(this,arguments)}function cE(r,e,t){return e=vE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vE(r){var e=fE(r,"string");return typeof e=="symbol"?e:String(e)}function fE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vv extends Error{constructor(){super(...arguments),cE(this,"isNoConsolesError",!0)}}function Bv(r){return r.isNoConsolesError}function Dd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Ha(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Dd(a,n,i,s,o,"next",l)}function o(l){Dd(a,n,i,s,o,"throw",l)}s(void 0)})}}var or=B.module("SessionUtils");function pE(r,e){return or.info("Starting connection to '".concat(e,"'...")),new r.IdeConnection(e)}function Wv(r,e,t){return Ws.apply(this,arguments)}function Ws(){return Ws=Ha(function*(r,e,t){or.info("Getting console types...");var n=yield e.getConsoleTypes();if(n.length===0)throw new Vv("No console types available");or.info("Available types:",n);var i=n[0];or.info("Starting session with type",i);var a=yield e.startSession(i),s={type:i,id:ye.generate()};return or.info("Console session established",s),{session:a,config:s,connection:e,details:t,dh:r}}),Ws.apply(this,arguments)}function mE(r,e,t){return or.info("createCoreClient",e),new r.CoreClient(e,t)}function gE(r){return r!=null&&typeof r=="object"}function bE(){return Gs.apply(this,arguments)}function Gs(){return Gs=Ha(function*(){var r=yield Zo(Rv);if(!gE(r))throw new Error("Unexpected session details response: ".concat(r));return r}),Gs.apply(this,arguments)}function CE(){return zs.apply(this,arguments)}function zs(){return zs=Ha(function*(){var r=new URLSearchParams(window.location.search);switch(r.get("authProvider")){case"parent":return bE()}return{}}),zs.apply(this,arguments)}function SE(r,e,t){return Ks.apply(this,arguments)}function Ks(){return Ks=Ha(function*(r,e,t){var n;try{n=yield Wv(r,e,t)}catch(i){if(!Bv(i))throw i}return n}),Ks.apply(this,arguments)}const yE=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:jv,BROADCAST_LOGIN_MESSAGE:qo,BROADCAST_LOGOUT_MESSAGE:kv,BooleanColumnFormatter:Rb,CharColumnFormatter:jb,DateTimeColumnFormatter:xo,DateUtils:No,DecimalColumnFormatter:kb,DefaultColumnFormatter:$b,FETCH_TIMEOUT:Ub,Formatter:_r,FormatterUtils:wn,IntegerColumnFormatter:Hb,LOGIN_OPTIONS_REQUEST:Av,NoConsolesError:Vv,SESSION_DETAILS_REQUEST:Rv,StringColumnFormatter:Vb,TableColumnFormatter:Bb,TableUtils:Ne,createComboboxFilterArgs:Wb,createConnection:pE,createCoreClient:mE,createFilterConditionFactory:Mo,createKeyFromOffsetRow:Gb,createNotNullOrEmptyFilterCondition:Nc,createOnTableUpdatedHandler:Mc,createSearchTextFilter:Lo,createSelectedValuesFilter:Fo,createSessionWrapper:Wv,createShowOnlyEmptyFilterCondition:Lc,createValueFilter:Fc,defaultRowDeserializer:Ac,fetchVariableDefinition:zb,generateEmptyKeyedItems:Rc,getColumnFormats:Kb,getDateTimeFormatterOptions:qb,getSessionDetails:CE,getSize:Ao,getWindowParent:Xo,isBroadcastLoginMessage:$v,isBroadcastLogoutMessage:Uv,isClosed:ca,isCustomColumnFormatDefined:Yb,isMessage:Ua,isNoConsolesError:Bv,isResponse:Hv,loadSessionWrapper:SE,makeMessage:Yo,makeResponse:hE,padFirstAndLastRow:jc,requestParentResponse:Zo},Symbol.toStringTag,{value:"Module"}));var Id=B.module("useTableListener"),EE=(r,e,t)=>c.useEffect(function(){if(r==null){Id.debug2("Emitter undefined, skipping addEventListener",e);return}return Id.debug2("Adding listener",e),r.addEventListener(e,t)},[r,e,t]);const pr=EE;function wE(r,e,t){return e=PE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PE(r){var e=_E(r,"string");return typeof e=="symbol"?e:String(e)}function _E(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class TE extends Error{constructor(){super(...arguments),wE(this,"isColumnNameError",!0)}}const OE=TE;function DE(r,e,t){return e=IE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function IE(r){var e=xE(r,"string");return typeof e=="symbol"?e:String(e)}function xE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class NE extends Error{constructor(){super(...arguments),DE(this,"isTableDisconnectError",!0)}}const ME=NE;var Hi=B.module("useTable"),LE=(r,e,t,n)=>{var i=Ve(),[a,s]=c.useState(void 0),[o,l]=c.useState([]),[d,h]=c.useState(null),[v,f]=c.useState(null);c.useEffect(()=>{if(n===void 0){s(r==null?void 0:r.columns),h(null);return}try{s(r==null?void 0:r.findColumns(n)),h(null)}catch(g){Hi.error("Column not found",g,n),h(new OE("Invalid columnNames argument"))}},[r,n]),c.useEffect(()=>{if(!a||!r){Hi.debug2("Table or column not initialized, skip viewport update.");return}Hi.debug2("Setting viewport",e,t),r.setViewport(e,t,a)},[a,r,e,t]);var p=c.useCallback(g=>{var{detail:C}=g;if(!a){Hi.error("Columns not initialized.");return}var y=a.map(S=>C.rows.map(E=>E.get(S)));l(y)},[a]),m=c.useCallback(()=>{f(new ME("Table disconnected"))},[]),b=c.useCallback(()=>{f(null)},[]);return pr(r,i.Table.EVENT_UPDATED,p),pr(r,i.Table.EVENT_DISCONNECT,m),pr(r,i.Table.EVENT_RECONNECT,b),{columns:a,data:o,error:v??d}};const Gv=LE;var FE=(r,e,t,n)=>{var i=c.useMemo(()=>[n],[n]),{columns:a=[],data:s=[],error:o}=Gv(r,e,t,i);return{column:a[0],data:s[0],error:o}};const zv=FE;function xd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function AE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){xd(a,n,i,s,o,"next",l)}function o(l){xd(a,n,i,s,o,"throw",l)}s(void 0)})}}var Gt=B.module("TableInput"),bs=250;function Qo(r){var e,t,{className:n=void 0,columnName:i,settings:a,defaultValue:s=[],isInvalid:o=!1,onChange:l=()=>!1,onBlur:d=()=>!1,table:h}=r,v=c.useRef(null),f=Ve(),p=c.useMemo(()=>{var V=wn.getColumnFormats(a),x=wn.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:P={},defaultIntegerFormatOptions:j={}}=a;return new _r(f,V,x,P,j)},[f,a]),[m,b]=c.useState(""),[g,C]=c.useState(new Set(s)),[y,S]=c.useState(),E=c.useRef(null),w=Math.min((e=y==null?void 0:y.size)!==null&&e!==void 0?e:0,bs),{column:I,data:O,error:T}=zv(y,0,bs-1,i),N=c.useCallback(V=>I?p.getFormattedString(V,I.type,I.name):"".concat(V),[I,p]),[R,W]=c.useMemo(()=>{var V=new Set(g),x=[];if(O==null)return[x,null];if(O.forEach(j=>{var U="".concat(j),Q=g.has(U);Q&&V.delete(U),x.push({value:U,displayValue:N(j),isSelected:Q})}),V.size>0){Gt.debug2("Selection has items that are missing from the viewport");var P=new Set(g);return Array.from(V).forEach(j=>{P.delete(j)}),[x,P]}return[x,null]},[O,g,N]);c.useEffect(()=>{W!==null&&(C(W),l(Array.from(W)))},[l,W]);var L=c.useCallback(function(){var V=AE(function*(x){try{var P=yield x;Gt.debug("Table resolved",P),S(P)}catch(j){if(Se.isCanceled(j))return;Gt.error(j)}});return function(x){return V.apply(this,arguments)}}(),[]);c.useEffect(()=>{var V=Se.makeCancelable(h);return L(V),()=>{Gt.debug2("Cancel table promise"),V.cancel()}},[h,L]);var D=c.useCallback(V=>{var{value:x}=V.target;b(x);var P=R.findIndex(U=>U.displayValue.includes(x));if(P>-1){var j;Gt.debug2("Found ".concat(x," at index ").concat(P)),(j=E.current)===null||j===void 0||j.scrollIntoView(P)}else Gt.debug2("".concat(x," not found"))},[R,E]),M=c.useCallback(V=>{if(Gt.debug("handleSelect",V),V>=R.length){Gt.error("Invalid index",V);return}var x=R[V].value,P=new Set(g);R[V].isSelected?P.delete(x):P.add(x),C(P),l(Array.from(P))},[l,R,g]),F=c.useCallback(()=>{var V=R.map(P=>P.value),x=new Set(V);C(x),l(V)},[R,l]),k=c.useCallback(()=>{C(new Set),l([])},[l]),H=c.useCallback(()=>{},[]),q=c.useCallback(V=>{var x,{relatedTarget:P}=V;Gt.debug("handleChildBlur",P,P instanceof HTMLElement,v.current,(x=v.current)===null||x===void 0?void 0:x.contains(P)),(!P||v.current&&P instanceof HTMLElement&&!v.current.contains(P))&&d()},[d]),re=R.length===0;return u.jsxs("div",{ref:v,className:Y("table-input-container d-flex flex-column position-relative",n),children:[u.jsx(Ei,{disabled:!!T||re,value:m,placeholder:"Search",onChange:D,className:"mb-2 d-flex",onBlur:q}),u.jsx(Dc,{className:"table-input-list",disabled:y===void 0||re,isInvalid:o,items:re?[{value:"Empty",isSelected:!1}]:R,itemCount:w,offset:0,onSelect:M,onViewportChange:H,ref:E,onBlur:q}),y&&u.jsxs("div",{className:"meta-row",children:[u.jsx("div",{className:"d-flex align-items-center text-muted small",children:y!=null&&y.size>w&&u.jsxs(u.Fragment,{children:["Table is too large, showing the first ",bs," items."]})}),u.jsxs("div",{children:[u.jsx("button",{type:"button",className:"btn btn-link",onBlur:q,onClick:F,children:"Select All"}),u.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:q,onClick:k,children:"Clear"})]})]}),y==null||T&&u.jsx("div",{className:"h-100 w-100 position-absolute",children:u.jsx(He,{isLoaded:y!=null,isLoading:y==null&&T==null,errorMessage:(t=T==null?void 0:T.message)!==null&&t!==void 0?t:null})})]})}Qo.displayName="TableInput";Qo.defaultProps={isInvalid:!1,className:void 0};var Nd=B.module("useBroadcastChannel");function Jo(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xb,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jv,t=c.useMemo(()=>new BroadcastChannel(e),[e]);return c.useEffect(()=>()=>{t.close()},[t]),c.useEffect(()=>{function n(i){var{data:a}=i;if(!Ua(a)){Nd.debug("Ignoring non-deephaven message",a);return}Nd.debug("event received",a),r(i)}return t.addEventListener("message",n),()=>{t.removeEventListener("message",n)}},[t,r]),t}function Va(r,e){var t=c.useCallback(n=>{$v(n.data)?r==null||r(n.data):Uv(n.data)&&(e==null||e(n.data))},[r,e]);Jo(t)}var pa="io.deephaven.web.client.auth.refreshToken",Kv=c.createContext(null),RE=B.module("RefreshTokenUtils");function qs(){var r=Er.get(pa);try{if(r!=null)return JSON.parse(r)}catch(e){RE.error("Error parsing refresh token",r,e)}return null}function Ys(r){if(r==null){Er.remove(pa);return}var e=JSON.stringify({bytes:r.bytes,expiry:r.expiry}),t=new Date(r.expiry);Er.set(pa,e,{secure:!0,sameSite:"strict",expires:t})}function qv(r){var{children:e}=r,t=Ve(),n=Gn(),[i,a]=c.useState(qs());c.useEffect(function(){var d=n.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,h=>{var{detail:v}=h;Ys(v),a(v)});return d},[t,n,i]);var s=c.useCallback(()=>{a(qs())},[]),o=c.useCallback(()=>{Ys(null),a(null)},[]);return Va(s,o),u.jsx(Kv.Provider,{value:i,children:e})}function nn(){var r=Ve();return c.useMemo(()=>new Ne(r),[r])}function jE(r,e,t,n){var i=nn(),[a,s]=c.useState(""),{value:o}=wi(a,t),l=c.useCallback(f=>{s(f.trim())},[]),{data:d,isLoading:h}=hi(i.doesColumnValueExist,[r,e,o,n]),v=h||a!==o?null:d;return{valueTrimmed:a,valueTrimmedDebounced:o,valueExists:v,trimAndUpdateValue:l}}var Md=B.module("useDebouncedViewportSearch"),kE=200;function $E(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:kE,n=nn(),{table:i,applyFiltersAndRefresh:a}=r,s=c.useMemo(()=>Le(o=>{if(Md.debug("Applying debounced searchText '".concat(o,"'")),i!=null){var l=o.trim();if(l===""){a([]);return}var d=i.findColumn(e),h=n.makeFilterValue(d.type,l),v=[d.filter().contains(h)];a(v)}},t),[a,e,t,i,n]);return c.useEffect(()=>()=>{Md.debug("Cancelling debounced search function"),s.cancel()},[s]),s}var Yv=300;function UE(r){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:n,mapItemToValue:i}=r,a=nn(),s=uv(e,i),{value:o}=wi(s,Yv),l=ov(o,tv);return c.useMemo(()=>Fo(a,t,l.selection,n,l.isInverted),[t,l,n,a])}function el(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return c.useMemo(()=>Zb(...t.map(i=>i(r))),[r,...t])}function HE(r,e,t,n){var i=c.useRef("");return i.current=t,c.useMemo(()=>{var a=r.length>0&&r[0].item==null;return!a&&n!=null&&(i.current===""||n.toLowerCase().includes(i.current.toLowerCase()))?[{key:n,item:{[e]:n}},...r]:r},[n,e,r])}function Ld(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function VE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ld(a,n,i,s,o,"next",l)}function o(l){Ld(a,n,i,s,o,"throw",l)}s(void 0)})}}function BE(r){var{table:e,columnName:t,defaultValue:n,itemHeight:i,topOffset:a=0,value:s}=r;return c.useCallback(VE(function*(){if(e==null||s===""||s===n)return a;var o=e.findColumn(t),l=yield e.seekRow(0,o,"String",s),d=n==null?0:1;return(l+d)*i+a}),[t,n,i,e,a,s])}function tl(r){var[,e]=c.useState(0),t=Ve();return pr(r,t.Table.EVENT_SIZECHANGED,()=>{e(n=>n+1)}),Ao(r)}var WE=B.module("useInitializeViewportData");function Xv(r){var e=vv({}),t=Math.max(0,tl(r));return c.useEffect(()=>{var n=e.items.length;t!==n&&(WE.debug("size changed:",{currentSize:n,targetSize:t}),e.setItems(Array.from(Rc(0,t-1))))},[t,r]),e}function Zv(r,e,t){return c.useCallback(function(i){var[a,s]=jc(i,e,t,Ao(r));r==null||r.setViewport(a,s)},[r,t,e])}var Fd=B.module("useViewportData");function nl(r){var{table:e,itemHeight:t=1,scrollDebounce:n=YC,viewportSize:i=10,viewportPadding:a=50,deserializeRow:s=Ac}=r,o=Xv(e),l=Zv(e,i,a),d=c.useCallback(b=>{e&&!ca(e)?l(b):Fd.debug("setViewport called on closed table.",e)},[e,l]),h=c.useCallback(b=>{e&&!ca(e)?(e.applyFilter(b),d(0)):Fd.debug("applyFiltersAndRefresh called on closed table.",e)},[d,e]),v=Ve(),f=c.useMemo(()=>Mc(o,s),[s,o]);pr(e,v.Table.EVENT_UPDATED,f);var p=tl(e);c.useEffect(()=>{d(0)},[e,d,p]);var m=hv(t,d,n);return c.useMemo(()=>({viewportData:o,size:p,table:e,applyFiltersAndRefresh:h,setViewport:d,onScroll:m}),[h,m,d,p,e,o])}function rl(r,e){var{applyFiltersAndRefresh:t}=r;c.useEffect(()=>{t(e)},[t,e])}function GE(r,e){for(var t=nn(),[n,i]=c.useState(""),a=c.useMemo(()=>Lo(t,e,n),[e,n,t]),s=va(i,$s),o=nl({table:r,itemHeight:qC,viewportSize:Zc,viewportPadding:Qc}),l=arguments.length,d=new Array(l>2?l-2:0),h=2;h<l;h++)d[h-2]=arguments[h];var v=el(o.table,a,...d);return rl(o,v),{list:o,onSearchTextChange:s}}function zE(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=nn(),n=c.useMemo(()=>Nc(t),[t]);return c.useMemo(()=>Mo(r,n,e),[r,e,n])}function Qv(r){c.useEffect(()=>()=>{r!=null&&(ca(r)||r.close())},[r])}function KE(r){var{maybeTable:e,columnName:t,mapItemToValue:n,filterConditionFactories:i=[],trimSearchText:a=!1}=r,s=nn(),[o,l]=c.useState(""),[d,h]=c.useState(""),v=c.useCallback(q=>{h(a?q.trim():q)},[a]),f=c.useMemo(()=>a?o.trim():o,[o,a]),[p,m]=c.useState(null),[b,g]=c.useState(()=>new Map),{data:C,isLoading:y}=hi(s.doesColumnValueExist,[e,t,d,!1]),{isDebouncing:S}=wi(d,$s),E=S||y?null:C,w=c.useMemo(()=>Lo(s,t,d),[d,t,s]),I=c.useMemo(()=>Fo(s,t,new Set(b.keys()),!1,!0),[t,b,s]),{data:O}=hi(s.createDistinctSortedColumnTable,[e,t,"asc",...i]);Qv(O);var T=nl({table:O,itemHeight:KC,viewportSize:Zc,viewportPadding:Qc}),N=f.length>0&&T.size===0,R=b.has(f),W=va(v,$s),L=c.useCallback(q=>{l(q),W(q)},[W]),D=va(m,0),M=c.useCallback(q=>{if(l(""),v(""),m(q),D(null),q!=null){var re=T.viewportData.findItem(q);if(re!=null){var V=n(re);g(x=>{var P=new Map(x);return P.set(V,{value:V}),P})}}},[v,D,T.viewportData,n]),F=c.useCallback(q=>{g(re=>{if(q.size===0)return re;var V=new Map(re);for(var x of q)V.set(x,{value:x});return V})},[]),k=c.useCallback(q=>{g(re=>{if(q==="all")return new Map;var V=new Map(re);for(var x of q)V.delete(x);return V})},[]),H=el(T.table,w,I);return rl(T,H),c.useMemo(()=>({list:T,hasSearchTextWithZeroResults:N,searchText:o,searchTextExists:E,searchTextIsInSelectedValues:R,selectedKey:p,selectedValueMap:b,onSearchTextChange:L,onSelectKey:M,onAddValues:F,onRemoveValues:k}),[N,T,F,k,L,M,o,E,R,p,b])}function Ad(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function qE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ad(a,n,i,s,o,"next",l)}function o(l){Ad(a,n,i,s,o,"throw",l)}s(void 0)})}}function YE(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];var i=c.useCallback(qE(function*(){var d;return(d=r==null?void 0:r.selectDistinct(r.findColumns(t)))!==null&&d!==void 0?d:null}),[r,...t]),{data:a,error:s,isError:o,isLoading:l}=hi(i,[]);return c.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:s,isError:o,isLoading:l}}function XE(r,e){var t=nn(),n=c.useMemo(()=>Lc(t,r),[r,t]);return c.useMemo(()=>Mo(e,n),[e,n])}function ZE(r,e,t){var n=nn();return c.useMemo(()=>Fc(n,r,e,t),[r,t,n,e])}const QE=Object.freeze(Object.defineProperty({__proto__:null,DEBOUNCE_MS:Yv,REFRESH_TOKEN_KEY:pa,RefreshTokenBootstrap:qv,RefreshTokenContext:Kv,TableDropdown:Qb,TableInput:Qo,makeApiContextWrapper:dE,readRefreshToken:qs,storeRefreshToken:Ys,useBroadcastChannel:Jo,useBroadcastLoginListener:Va,useCheckIfExistsValue:jE,useDebouncedViewportSearch:$E,useDebouncedViewportSelectionFilter:UE,useFilterConditionFactories:el,useFilteredItemsWithDefaultValue:HE,useGetItemPosition:BE,useInitializeViewportData:Xv,useNotNullOrEmptyFilter:zE,usePickerWithSelectedValues:KE,useSearchableViewportData:GE,useSelectDistinctTable:YE,useSetPaddedViewportCallback:Zv,useShowOnlyEmptyFilter:XE,useTable:Gv,useTableClose:Qv,useTableColumn:zv,useTableListener:pr,useTableSize:tl,useTableUtils:nn,useValueFilter:ZE,useViewportData:nl,useViewportFilter:rl},Symbol.toStringTag,{value:"Module"}));var il=c.createContext(!1);function Jv(r){var{fontClassNames:e=["fira-sans-regular","fira-sans-semibold","fira-mono"],children:t}=r,[n,i]=c.useState(!1);return c.useEffect(function(){document.fonts.ready.then(()=>{i(!0)})},[]),u.jsxs(u.Fragment,{children:[u.jsx(il.Provider,{value:n,children:t}),u.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:e.map(a=>u.jsx("p",{className:a,children:"preload"},a))})]})}var _i=c.createContext(null),nt=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function ef(r){return"DashboardPlugin"in r}function ma(r){return"AuthPlugin"in r}function al(r){return"TablePlugin"in r}function tf(r){return ef(r)||ma(r)||al(r)}function JE(r){return"type"in r&&r.type===nt.DASHBOARD_PLUGIN}function Ti(r){return"type"in r&&r.type===nt.WIDGET_PLUGIN}function nf(r){return"type"in r&&r.type===nt.TABLE_PLUGIN}function rf(r){return"type"in r&&r.type===nt.AUTH_PLUGIN}function af(r){return"type"in r&&r.type===nt.THEME_PLUGIN}var ew=B.module("@deephaven/plugin.PluginUtils");function Xs(r,e){return r==null||!Ti(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function sf(r){var e=u.jsx(ne,{icon:mc});if(!Ti(r))return e;var{icon:t}=r;return t==null?e:c.isValidElement(t)?t:u.jsx(ne,{icon:t})}function of(r){var e=[...r.entries()].filter(t=>af(t[1]));return ew.debug("Getting theme data from plugins",e),e.map(t=>{var[n,i]=t,a=Array.isArray(i.themes)?i.themes:[i.themes];return a.map(s=>{var{name:o,baseTheme:l,styleContent:d}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:pc(n,o),name:o,styleContent:d}})}).flat()}function Ba(){return Rr(_i,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function tw(r){var{fetch:e,type:t}=r,n=Ba(),i=c.useMemo(()=>[...n.values()].filter(Ti).find(s=>[s.supportedTypes].flat().includes(t)),[n,t]);if(i!=null){var a=i.component;return u.jsx(a,{fetch:e})}throw new Error("Unknown widget type '".concat(t,"'"))}const nw=Object.freeze(Object.defineProperty({__proto__:null,PluginType:nt,PluginsContext:_i,WidgetView:tw,getIconForPlugin:sf,getThemeDataFromPlugins:of,isAuthPlugin:rf,isDashboardPlugin:JE,isLegacyAuthPlugin:ma,isLegacyDashboardPlugin:ef,isLegacyPlugin:tf,isLegacyTablePlugin:al,isTablePlugin:nf,isThemePlugin:af,isWidgetPlugin:Ti,pluginSupportsType:Xs,usePlugins:Ba},Symbol.toStringTag,{value:"Module"}));function rw(r){if(r==null)return!1;var e=r;return e.Component!==void 0&&typeof e.isAvailable=="function"}var lf="io.deephaven.auth.AnonymousAuthenticationHandler",iw="io.deephaven.authentication.psk.PskAuthenticationHandler";function Rd(r,e,t){return e=aw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aw(r){var e=sw(r,"string");return typeof e=="symbol"?e:String(e)}function sw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ow extends Error{constructor(){super(...arguments),Rd(this,"name","AuthenticationError"),Rd(this,"isAuthenticationError",!0)}}const df=ow;function jd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function lw(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){jd(a,n,i,s,o,"next",l)}function o(l){jd(a,n,i,s,o,"throw",l)}s(void 0)})}}var kd=B.module("AuthPluginBase");function sl(r){var{children:e,getLoginOptions:t}=r,n=Gn(),[i,a]=c.useState(),[s,o]=c.useState(!1);return c.useEffect(()=>{var l=!1;function d(){if(l)throw new kc("Login canceled.")}function h(){return v.apply(this,arguments)}function v(){return v=lw(function*(){try{var f=yield t();d(),kd.info("Logging in..."),yield n.login(f),d(),o(!0)}catch(b){if(!l){var p;kd.error("Unable to login:",b);var m=(p=Or(b))!==null&&p!==void 0?p:"Unable to login. Verify credentials.";a(new df(m)),o(!1)}}}),v.apply(this,arguments)}return h(),()=>{l=!0}},[n,t]),s?u.jsx(u.Fragment,{children:e}):u.jsx(He,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:Or(i)})}var dw={canLogout:!1};function uw(r){var{children:e}=r,t=Ve(),n=c.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return u.jsx(sl,{getLoginOptions:n,children:u.jsx(Aa.Provider,{value:dw,children:e})})}var hw={Component:uw,isAvailable:r=>r.includes(lf)};const uf=hw;function $d(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function cw(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){$d(a,n,i,s,o,"next",l)}function o(l){$d(a,n,i,s,o,"throw",l)}s(void 0)})}}var vw=B.module("AuthPluginParent"),fw={canLogout:!1};function pw(r){return r!=null&&typeof r.type=="string"}function mw(){return Zs.apply(this,arguments)}function Zs(){return Zs=cw(function*(){vw.info("Logging in by delegating to parent window...");var r=yield Zo(Av);if(!pw(r))throw new Error("Unexpected login options response: ".concat(r));return r}),Zs.apply(this,arguments)}function gw(){var r;return(r=new URLSearchParams(window.location.search).get("authProvider"))!==null&&r!==void 0?r:""}function bw(r){var{children:e}=r;return u.jsx(sl,{getLoginOptions:mw,children:u.jsx(Aa.Provider,{value:fw,children:e})})}var Cw={Component:bw,isAvailable:()=>Xo()!=null&&gw()==="parent"};const hf=Cw;function cf(r){var{children:e,errorMessage:t,isLoggingIn:n=!1,onSubmit:i}=r;return u.jsxs("form",{className:"login-form",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),i==null||i(a)},children:[u.jsx("div",{className:"flex-spacer"}),u.jsxs("div",{className:"flex-wrapper",children:[u.jsx("fieldset",{disabled:n,className:"container-fluid",children:e}),u.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:u.jsxs("button",{type:"submit",className:Y("btn btn-primary",{"btn-spinner":n},{"btn-cancelable":n}),"data-testid":"btn-login",children:[n&&u.jsxs("span",{children:[u.jsx(Ma,{className:"mr-2 loading-spinner-vertical-align"}),u.jsx("span",{className:"btn-normal-content",children:"Logging in"}),u.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!n&&"Login"]})})]}),u.jsx("div",{className:"flex-spacer",children:t!=null&&u.jsx("p",{className:"error-message mb-0",role:"alert",children:"".concat(t)})})]})}function vf(r){var{children:e,logoPath:t="./logo.png"}=r;return u.jsxs("div",{className:"login-container",children:[u.jsx(Pv,{}),u.jsxs("div",{className:"login-box",children:[u.jsx("div",{className:"logo",children:u.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),e,u.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}function Ud(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Cs(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ud(a,n,i,s,o,"next",l)}function o(l){Ud(a,n,i,s,o,"throw",l)}s(void 0)})}}var Qs="io.deephaven.authentication.psk.PskAuthenticationHandler",ff="psk",Js="io.deephaven.web.client.auth.psk.token",lr=B.module("AuthPluginPsk");function Sw(){return new URLSearchParams(window.location.search).get(ff)}function yw(){lr.debug2("clearWindowToken");var r=new URL(window.location.href);r.searchParams.delete(ff),window.history.replaceState(null,"",r.href)}function Hd(){var r;return(r=Er.get(Js))!==null&&r!==void 0?r:null}function Ss(r){lr.debug2("Storing token in cookie",r),r!=null?Er.set(Js,r,{secure:!0,sameSite:"strict"}):Er.remove(Js)}function Ew(r){var{children:e,logoPath:t}=r,n=Gn(),i=c.useRef(null),a=c.useRef(null),[s,o]=c.useState(),[l,d]=c.useState(!1),[h,v]=c.useState(!1),[f,p]=c.useState(!1),[m,b]=c.useState(""),g=c.useCallback(function(){var w=Cs(function*(I){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;lr.info("Logging in..."),p(!0);var T=null;try{if(T=n.login({type:Qs,token:I}),a.current=T,yield T,lr.info("Logged in successfully"),a.current!==T)return;Ss(I),v(!0)}catch(W){if(a.current!==T)return;if(d(!0),O){var N;lr.error("Unable to login",W);var R=(N=Or(W))!==null&&N!==void 0?N:"Unable to login: Verify credentials.";o(new df(R))}}p(!1)});return function(I){return w.apply(this,arguments)}}(),[n]),C=c.useCallback(()=>{a.current=null,p(!1)},[]),y=c.useCallback(Cs(function*(){lr.debug("onLogin");var w=Hd();h||f||w==null||g(w,!1)}),[h,f,g]),S=c.useCallback(()=>{Ss(null)},[]);Va(y,S),c.useEffect(()=>{var w=!1;function I(){return O.apply(this,arguments)}function O(){return O=Cs(function*(){var T,N=(T=Sw())!==null&&T!==void 0?T:Hd();if(yw(),N==null){d(!0);return}p(!0);try{yield n.login({type:Qs,token:N}),w||(Ss(N),v(!0),p(!1))}catch{w||(d(!0),p(!1))}}),O.apply(this,arguments)}return I(),()=>{w=!0}},[n]);var E=c.useCallback(()=>{f?C():g(m)},[C,f,g,m]);return c.useEffect(function(){var I;(I=i.current)===null||I===void 0||I.focus()},[i,l]),u.jsxs(u.Fragment,{children:[h&&e,l&&u.jsx(Hn,{in:!h,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(vf,{logoPath:t,children:u.jsx(cf,{errorMessage:Or(s),isLoggingIn:f,onSubmit:E,children:u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),u.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:i,value:m,onChange:w=>{o(void 0),b(w.target.value)}})]})})})}),u.jsx(He,{"data-testid":"auth-psk-loading",isLoaded:h||l,isLoading:!h&&!l})]})}var ww={Component:Ew,isAvailable:r=>r.includes(Qs)};const pf=ww;function Vd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ys(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vd(Object(t),!0).forEach(function(n){Pw(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Vd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pw(r,e,t){return e=_w(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _w(r){var e=Tw(r,"string");return typeof e=="symbol"?e:String(e)}function Tw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ow=B.module("UserUtils");function mf(r,e){return r.get("internal.webClient.appInit.".concat(e))}function gf(r){var e,t,n,i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};function o(g){return mf(r,g)}function l(g,C){var y=o(g);return y==="true"?!0:y==="false"?!1:(y!==void 0&&Ow.warn("Unexpected value for ".concat(g,": ").concat(y)),C)}var d=(e=o("name"))!==null&&e!==void 0?e:"",h=(t=o("operateAs"))!==null&&t!==void 0?t:d,v=(n=(i=o("groups"))===null||i===void 0?void 0:i.split(","))!==null&&n!==void 0?n:[],f=l("canCopy",!0),p=l("canDownloadCsv",!0),m=l("canUsePanels",!0),b=l("canLogout",!0);return ys(ys({name:d,operateAs:h,groups:v},a),{},{permissions:ys({canUsePanels:m,canCopy:f,canDownloadCsv:p,canLogout:b},s)})}const Dw=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:lf,AUTH_HANDLER_TYPE_PSK:iw,AuthPluginAnonymous:uf,AuthPluginBase:sl,AuthPluginParent:hf,AuthPluginPsk:pf,Login:vf,LoginForm:cf,UserContext:$c,UserOverrideContext:Uc,UserPermissionsOverrideContext:Aa,getAppInitValue:mf,getUserFromConfig:gf,isAuthPlugin:rw},Symbol.toStringTag,{value:"Module"})),bf=typeof ps=="function"?ps:ps.default;Ro.register([HC,VC,BC,WC,GC,zC]);function tt(r,e,t){return e=Iw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Iw(r){var e=xw(r,"string");return typeof e=="symbol"?e:String(e)}function xw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class De{constructor(e){tt(this,"dh",void 0),tt(this,"listeners",void 0),tt(this,"formatter",void 0),tt(this,"rect",void 0),tt(this,"isDownsamplingDisabled",void 0),tt(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(De.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(De.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(De.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(De.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(De.EVENT_ERROR,{detail:e}))}}tt(De,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");tt(De,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");tt(De,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");tt(De,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");tt(De,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");tt(De,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");tt(De,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");tt(De,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");tt(De,"EVENT_ERROR","ChartModel.EVENT_ERROR");const St=De;function Bd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Vi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bd(Object(t),!0).forEach(function(n){Ue(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ue(r,e,t){return e=Nw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nw(r){var e=Mw(r,"string");return typeof e=="symbol"?e:String(e)}function Mw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Wr=B.module("ChartUtils"),Wd="io.deephaven.time.DateTime",Lw=36e5,Fw=1e6;function Aw(r){return r.asDate!==void 0}function Rw(r){return r.asNumber!==void 0}function Gd(r){return r.dhTimeZone!==void 0}function jw(r){return r!=null&&r.range!=null&&(r.autorange===!1||r.autorange===void 0)}class G{static getPlotlyErrorBars(e,t,n){var i=n.map((s,o)=>s-e[o]),a=t.map((s,o)=>e[o]-s);return{type:"data",symmetric:!1,array:i,arrayminus:a}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;var i=n.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);z(a);var[,s,o,l,,d,h,v,f,p]=a,m=l.replace(",","").length,b=o.indexOf(",")>=0||l.indexOf(",")>=0,g=b?",":"",C=v!=null&&v!==""?"e":"f",y=f!==""?f:C,S=d.length+h.length,E="",w="0".concat(m).concat(g,".").concat(S).concat(E).concat(y),I=G.convertNumberPrefix(s),O=G.convertNumberPrefix(p);return{tickformat:w,tickprefix:I,ticksuffix:O,automargin:!0}}static addTickSpacing(e,t,n){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},s=i;return n&&(s=i/Fw),t.log&&(s=Math.log(s)),a.tickmode="linear",a.dtick=s,a}return e}static getSourceForAxis(e,t){for(var n=0;n<e.series.length;n+=1)for(var i=e.series[n],a=0;a<i.sources.length;a+=1){var s=i.sources[a];if(s.axis===t)return s}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,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:G.ORIENTATION.VERTICAL;return{type:e,mode:t,name:n,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,n)=>[...t,...n.axes],[])}static getAxisTypeMap(e){var t=G.getAllAxes(e);return G.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:n}=e,i=0;i<n.length;i+=1)for(var a=n[i],s=0;s<a.series.length;s+=1)if(t===a.series[s])return a;return null}static getLayoutRanges(e){for(var t={},n=Object.keys(e).filter(o=>o.indexOf("axis")>=0),i=0;i<n.length;i+=1){var a=n[i],s=e[a];jw(s)&&(t[a]=[...s.range])}return t}static getAxisLayoutProperty(e,t){var n=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(n)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((n,i)=>{var a,s=i[t],o=(a=n.get(s))!==null&&a!==void 0?a:[];return o.push(i),n.set(s,o),n},new Map)}static normalizeColorway(e){if(e!=null){if(Array.isArray(e))return e;if(typeof e=="string")return e.split(" ");Wr.warn("Unexpected colorway format: ".concat(e))}}static titleFromSettings(e){var{series:t,xAxis:n,title:i="".concat((t??[]).join(", ")," by ").concat(n)}=e;return i}constructor(e){Ue(this,"dh",void 0),Ue(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values()),Hc(this)}getAxisFormats(e,t){for(var n=this,i=new Map,a={tickformat:null,ticksuffix:null},s=G.getAllAxes(e),o=G.groupArray(s,"type"),{charts:l}=e,d=0;d<l.length;d+=1)for(var h=l[d],v=0;v<h.series.length;v+=1)for(var f=h.series[v],{sources:p}=f,m=p.filter(y=>y.axis),b=function(){var S=m[g],{axis:E}=S,{type:w}=E,I=o.get(w);z(I);var O=I.indexOf(E),T=n.getAxisPropertyName(w);if(T!=null){var N=G.getAxisLayoutProperty(T,O);if(i.has(N))Wr.debug("".concat(N," already added."));else{Wr.debug("Adding ".concat(N," to axisFormats."));var R=n.getPlotlyAxisFormat(S,t);if(R===null)i.set(N,a);else{i.set(N,R);var{businessCalendar:W}=E;if(W!=null){var L=[],{businessPeriods:D,businessDays:M,holidays:F,timeZone:k}=W,H=t==null?void 0:t.getColumnTypeFormatter(Wd),q;Gd(H)&&(q=H.dhTimeZone);var re=q?(k.standardOffset-q.standardOffset)/60:0;F.length>0&&L.push(...n.createRangeBreakValuesFromHolidays(F,k,q)),D.forEach(V=>L.push({pattern:"hour",bounds:[G.periodToDecimal(V.close)+re,G.periodToDecimal(V.open)+re]})),M.length<n.daysOfWeek.length&&n.createBoundsFromDays(M).forEach(V=>L.push({pattern:"day of week",bounds:V})),R.rangebreaks=L}if(i.size===h.axes.length)return{v:i}}}}},g=0;g<m.length;g+=1){var C=b();if(typeof C=="object")return C.v}return i}getPlotlyChartType(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case n.plot.SeriesPlotStyle.LINE:return"scatter";case n.plot.SeriesPlotStyle.BAR:case n.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case n.plot.SeriesPlotStyle.PIE:return"pie";case n.plot.SeriesPlotStyle.TREEMAP:return"treemap";case n.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case n.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,n){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(G.MODE_LINES),(n??!0)&&a.add(G.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(G.MODE_LINES),(n??!1)&&a.add(G.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.PIE:switch(t){case n.plot.SourceType.X:return"labels";case n.plot.SourceType.Y:return"values"}break;case n.plot.SeriesPlotStyle.OHLC:switch(t){case n.plot.SourceType.TIME:return"x"}break;case n.plot.SeriesPlotStyle.TREEMAP:switch(t){case n.plot.SourceType.X:return"ids";case n.plot.SourceType.Y:return"values";case n.plot.SourceType.LABEL:return"labels";case n.plot.SourceType.PARENT:return"parents";case n.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case n.plot.SourceType.X:return"x";case n.plot.SourceType.Y:return"y";case n.plot.SourceType.Z:return"z";case n.plot.SourceType.X_LOW:return"xLow";case n.plot.SourceType.X_HIGH:return"xHigh";case n.plot.SourceType.Y_LOW:return"yLow";case n.plot.SourceType.Y_HIGH:return"yHigh";case n.plot.SourceType.TIME:return"time";case n.plot.SourceType.OPEN:return"open";case n.plot.SourceType.HIGH:return"high";case n.plot.SourceType.LOW:return"low";case n.plot.SourceType.CLOSE:return"close";case n.plot.SourceType.SHAPE:return"shape";case n.plot.SourceType.SIZE:return"size";case n.plot.SourceType.LABEL:return"label";case n.plot.SourceType.COLOR:return"color";case n.plot.SourceType.PARENT:return"parent";case n.plot.SourceType.HOVER_TEXT:return"hovertext";case n.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,n,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(n=t.axis)===null||n===void 0?void 0:n.type)===i.plot.AxisType.Y?G.ORIENTATION.HORIZONTAL:G.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,{name:a,isLinesVisible:s,isShapesVisible:o,plotStyle:l,lineColor:d,shapeColor:h,sources:v,shape:f,shapeSize:p}=e,m=v.some(S=>{var E;return(E=S.axis)===null||E===void 0?void 0:E.businessCalendar}),b=this.getChartType(l,m),g=this.getPlotlyChartMode(l,s??void 0,o??void 0),C=this.getPlotlySeriesOrientation(e),y=G.makeSeriesData(b,g,a,i,C);return this.addSourcesToSeriesData(y,l,v,t),this.addStylingToSeriesData(y,l,d,h,f,p,n),y}addSourcesToSeriesData(e,t,n,i){for(var a=e,s=0;s<n.length;s+=1){var o=n[s],{axis:l,type:d}=o,h=this.getPlotlyProperty(t,d);hc(a,h,[]);var v=l!=null?this.getAxisPropertyName(l.type):null;if(v!=null){var f=i.get(l.type);if(f){var p=f.indexOf(l),m=p>0?"".concat(p+1):"";a["".concat(v,"axis")]="".concat(v).concat(m)}}}}addStylingToSeriesData(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,{dh:l}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===l.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===l.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===l.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===l.plot.SeriesPlotStyle.HISTOGRAM?d.width=[]:t===l.plot.SeriesPlotStyle.PIE?d.textinfo="label+percent":t===l.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center"),n!=null&&(t===l.plot.SeriesPlotStyle.BAR?d.marker.color=n:d.line.color=n),i!=null&&(d.marker.color=i),a!=null&&a.length>0)try{d.marker.symbol=G.getMarkerSymbol(a)}catch(h){Wr.warn("Unable to handle shape",a,":",h)}s!=null&&(d.marker.size=s*G.DEFAULT_MARKER_SIZE),o!=null&&t!==l.plot.SeriesPlotStyle.PIE&&(d.visible=o)}getChartType(e,t){var{dh:n}=this;switch(e){case n.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,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=e,o=G.getAllAxes(t),l=0;l<t.charts.length;l+=1){var d=t.charts[l],h=n==null?void 0:n(d),v=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(s,d.axes,o,i,a,v,h)}this.removeStaleAxes(s,o)}getChartBounds(e,t,n,i){var a,{dh:s}=this,{cols:o,rows:l}=e,{column:d,colspan:h,row:v,rowspan:f}=t,p=d+h,m=v+f,b=1/o,g=1/l,C=G.AXIS_SIZE_PX/n,y=G.AXIS_SIZE_PX/i,S={bottom:(l-m)*g+(m<l?y/2:0),top:(l-v)*g-(v>0?y/2:0),left:d*b+(d>0?C/2:0),right:p*b-(p<o?C/2:0)},E=G.groupArray(t.axes,"position"),w=(a=E.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return w.length>0&&(n>0?S.right-=(S.right-S.left)*Math.max(0,Math.min(G.LEGEND_WIDTH_PX/n,G.MAX_LEGEND_SIZE)):S.right-=(S.right-S.left)*G.DEFAULT_AXIS_SIZE),S}getPlotlyDateFormat(e,t,n){var{dh:i}=this,a=n==null?void 0:n.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",""),s,o=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&Gd(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(s=i.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:a,ticksuffix:s,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:n}=this,{axis:i,columnType:a}=e,{formatPattern:s}=i,o=null;return Ne.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=G.addTickSpacing(o,i,!0)):Ne.isNumberType(a)&&(o=G.getPlotlyNumberFormat(t,a,s),o=G.addTickSpacing(o,i,!1)),i.formatType===n.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}updateLayoutAxes(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},o=arguments.length>6?arguments[6]:void 0,{dh:l}=this,d=i>0?Math.max(G.MIN_AXIS_SIZE,Math.min(G.AXIS_SIZE_PX/a,G.MAX_AXIS_SIZE)):G.DEFAULT_AXIS_SIZE,h=a>0?Math.max(G.MIN_AXIS_SIZE,Math.min(G.AXIS_SIZE_PX/i,G.MAX_AXIS_SIZE)):G.DEFAULT_AXIS_SIZE,v=e,f=G.groupArray(t,"position"),p=G.groupArray(t,"type"),m=[...p.keys()],b=G.groupArray(n,"type"),g=0;g<m.length;g+=1){var C=m[g],y=this.getAxisPropertyName(C);if(y!=null){var S=p.get(C),E=b.get(C),w=C===l.plot.AxisType.Y,I=w?a:i;z(S),z(E);for(var O=0;O<S.length;O+=1){var T=S[O],N=E.indexOf(T),R=G.getAxisLayoutProperty(y,N);v[R]==null&&(v[R]={});var W=v[R];if(W!=null){this.updateLayoutAxis(W,T,O,f,d,h,s);var{range:L,autorange:D}=W;if(o!=null&&L!==void 0&&(D===void 0||D===!1)){var M=o(T),[F,k]=M(L);Wr.debug("Setting downsample range",I,F,k),T.range(I,F,k)}else T.range(I)}}}}}removeStaleAxes(e,t){for(var n=e,i=G.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);z(l);var d=l.length,h=this.getAxisPropertyName(o);if(h!=null)for(var v=G.getAxisLayoutProperty(h,d);n[v]!=null;)delete n[v],d+=1,v=G.getAxisLayoutProperty(h,d)}}updateLayoutAxis(e,t,n,i,a,s,o){var l,{dh:d}=this,h=t.type===d.plot.AxisType.Y,v=h?s:a,f=e,p=(l=t.label)!==null&&l!==void 0?l:"";if(f.title!==void 0&&typeof f.title!="string"?f.title.text=p:f.title={text:p},t.log&&(f.type="log"),f.side=this.getAxisSide(t.position),n>0){var m,b;f.overlaying=(m=this.getAxisPropertyName(t.type))!==null&&m!==void 0?m:void 0;var g=(b=i.get(t.position))!==null&&b!==void 0?b:[],C=g.indexOf(t);C>0&&(f.anchor="free",t.position===d.plot.AxisPosition.RIGHT?f.position=o.right+(C-g.length+1)*v:t.position===d.plot.AxisPosition.TOP?f.position=o.top+(C-g.length+1)*v:t.position===d.plot.AxisPosition.BOTTOM?f.position=o.bottom+(g.length-C+1)*v:t.position===d.plot.AxisPosition.LEFT&&(f.position=o.left+(g.length-C+1)*v))}else if(t.type===d.plot.AxisType.X){var y=i.get(d.plot.AxisPosition.LEFT)||[],S=i.get(d.plot.AxisPosition.RIGHT)||[],E=Math.max(o.left,o.left+(y.length-1)*s),w=Math.min(o.right-(S.length-1)*s,o.right);f.domain=[E,w]}else if(t.type===d.plot.AxisType.Y){var I=i.get(d.plot.AxisPosition.BOTTOM)||[],O=i.get(d.plot.AxisPosition.TOP)||[],T=Math.max(o.bottom,o.bottom+(I.length-1)*a),N=Math.min(o.top-(O.length-1)*a,o.top);f.domain=[T,N]}}createBoundsFromDays(e){var t=e.map(s=>this.daysOfWeek.indexOf(s)),n=this.daysOfWeek.filter(s=>!e.includes(s)).map(s=>this.daysOfWeek.indexOf(s)),i=new Set;n.forEach(s=>{for(var o=s+1;o<s+this.daysOfWeek.length;o+=1){var l=o%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(s=>{for(var o=s-1;o>s-this.daysOfWeek.length;o-=1){var l=o<0?o+this.daysOfWeek.length:o;if(t.includes(l)){var d=(l+1)%7;a.push([d,s]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,n){var i=[],a=[];return e.forEach(s=>{s.businessPeriods.length>0?a.push(...this.createPartialHoliday(s,t,n)):i.push(this.createFullHoliday(s,t,n))}),[{values:i},...a]}createFullHoliday(e,t,n){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,n)}createPartialHoliday(e,t,n){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(f=>{a.push(f.open),a.push(f.close)}),a.push("24:00");for(var s=[],o=0;o<a.length;o+=2){var l=a[o],d=a[o+1];if(l!==d){var h=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,n)],v=Lw*(G.periodToDecimal(d)-G.periodToDecimal(l));s.push({values:h,dvalue:v})}}return s}adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Wd,t),n):e}makeFigureSettings(e,t){var{dh:n}=this,{series:i,xAxis:a,type:s}=e,o=G.titleFromSettings(e),l={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.X),position:"".concat(n.plot.AxisPosition.BOTTOM)},d={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.Y),position:"".concat(n.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(n.plot.ChartType.XY),axes:[l,d],series:(i??[]).map(h=>({plotStyle:"".concat(s),name:h,dataSources:[{type:"".concat(n.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(n.plot.SourceType.Y),columnName:h,axis:d,table:t}]}))}],title:o}}unwrapValue(e,t){var{dh:n}=this;if(e!=null){if(Aw(e))return n.i18n.DateTimeFormat.format(G.DATE_FORMAT,e,t);if(Rw(e))return e.asNumber()}return e}wrapValue(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(Ne.isDateType(t)&&typeof e=="string"){var a=e,s=G.DATE_FORMAT.substr(0,e.length),o=i.i18n.DateTimeFormat.parse(s,a);if(!n)return o;var l="".concat(s," Z"),d=i.i18n.DateTimeFormat.format("Z",o,n),h=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d)),v=i.i18n.DateTimeFormat.format("Z",h,n);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(v))}return e}makeLayoutAxis(e,t){var{dh:n}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticks:"outside",ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}},legend:{font:{color:t.legend_color}}};return e===n.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===n.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultTemplate(e){var{error_band_line_color:t,ohlc_increasing:n,ohlc_decreasing:i,title_color:a}=e;return{data:{bar:[{marker:{line:{color:"transparent"}}}],scatter:[{error_x:{color:t},error_y:{color:t}}],ohlc:[{increasing:{line:{color:n}},decreasing:{line:{color:i}}}],pie:[{outsidetextfont:{color:a}}],treemap:[{outsidetextfont:{color:a}}]},layout:this.makeDefaultLayout(e)}}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:n,plot_bgcolor:i,title_color:a,coastline_color:s,land_color:o,ocean_color:l,lake_color:d,river_color:h}=e,v={paper_bgcolor:n,plot_bgcolor:i,autosize:!0,colorway:G.normalizeColorway(e==null?void 0:e.colorway),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},xanchor:"center",xref:"paper",yanchor:"top",pad:Vi({},G.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:Vi({},G.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:n,coastlinecolor:s,landcolor:o,oceancolor:l,lakecolor:d,rivercolor:h}};return v.datarevision=0,v}hydrateSettings(e){var{dh:t}=this;return Vi(Vi({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}Ue(G,"DEFAULT_AXIS_SIZE",.15);Ue(G,"MIN_AXIS_SIZE",.025);Ue(G,"MAX_AXIS_SIZE",.2);Ue(G,"AXIS_SIZE_PX",75);Ue(G,"LEGEND_WIDTH_PX",50);Ue(G,"MAX_LEGEND_SIZE",.25);Ue(G,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));Ue(G,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");Ue(G,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));Ue(G,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));Ue(G,"SUBTITLE_LINE_HEIGHT",25);Ue(G,"DEFAULT_MARKER_SIZE",6);Ue(G,"MODE_MARKERS","markers");Ue(G,"MODE_LINES","lines");const xe=G;function kw(r,e,t){return e=$w(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $w(r){var e=Uw(r,"string");return typeof e=="symbol"?e:String(e)}function Uw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Cf extends Error{constructor(){super(...arguments),kw(this,"isDownsamplingError",!0)}}const Hw="var(--dh-color-chart-colorway)",Vw="var(--dh-color-chart-grid)",Bw="var(--dh-color-chart-axis-line)",Ww="var(--dh-color-chart-axis-line-zero)",zd={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:Hw,gridcolor:Vw,linecolor:Bw,zerolinecolor:Ww,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var Kd=B.module("ChartTheme");function ol(){var r,e=Po(zd);return e.colorway=fc((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Vg.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),Kd.debug2("Chart theme:",zd),Kd.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}var ll=c.createContext(null);function Sf(r){var{children:e}=r,{activeThemes:t}=jr(),n=c.useMemo(ol,[t]);return u.jsx(ll.Provider,{value:n,children:e})}function dl(){return Rr(ll,"No ChartThemeContext value found.")}function qd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qd(Object(t),!0).forEach(function(n){Ge(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ge(r,e,t){return e=Gw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gw(r){var e=zw(r,"string");return typeof e=="symbol"?e:String(e)}function zw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var on=B.module("Chart");class bn extends c.Component{static convertIcon(e){var[t,,,,n]=e.icon,i="".concat(n);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),Ge(this,"currentSeries",void 0),Ge(this,"PlotComponent",void 0),Ge(this,"plot",void 0),Ge(this,"plotWrapper",void 0),Ge(this,"columnFormats",void 0),Ge(this,"dateTimeFormatterOptions",void 0),Ge(this,"decimalFormatOptions",void 0),Ge(this,"integerFormatOptions",void 0),Ge(this,"rect",void 0),Ge(this,"ranges",void 0),Ge(this,"isSubscribed",void 0),Ge(this,"isLoadedFired",void 0),Ge(this,"resizeObserver",void 0),Ge(this,"getCachedConfig",se((n,i,a,s,o,l)=>{var d=[],h=!!n;h&&d.push({name:"Downsampling failed: ".concat(n),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(n))},icon:bn.convertIcon(ql),attr:"fill-warning"});var v=!!l;if(v&&d.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:bn.convertIcon(ql),attr:"fill-warning"}),i||a||s||h){var f=bn.downsampleButtonTitle(a,s),p=bn.downsampleButtonAttr(a,s),m=a?Bg:Wg;d.push({name:f,title:"Downsampling status",icon:bn.convertIcon(m),click:this.handleDownsampleClick,attr:p})}var b=o.some(S=>{var{type:E}=S;return E!=null&&!E.includes("3d")}),g=o.some(S=>{var{type:E}=S;return E!=null&&E.includes("3d")}),C=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],y=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||h||v?!0:"hover",modeBarButtons:[d,["toImage"],["zoom2d","pan2d"],[...b?C:[],...g?y:[]]]}})),Hc(this),this.PlotComponent=bf(e.Plotly),this.plot=X.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:X.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),this.handleThemeChange()}componentDidUpdate(e){var{isActive:t,model:n,settings:i,theme:a}=this.props;this.updateFormatterSettings(i),n!==e.model&&(this.unsubscribe(e.model),this.subscribe(n)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(n)):this.unsubscribe(n)),a!==e.theme&&this.handleThemeChange()}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;this.setState(t=>{var{layout:n}=t;return{data:e.getData(),layout:dr(dr({},n),e.getLayout())}})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){on.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:n}=e;switch(on.debug2("Received data update",t,n),t){case St.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:m,revision:b}=p;return typeof m.datarevision=="number"&&(m.datarevision+=1),{data:n,layout:m,revision:b+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case St.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case St.EVENT_DISCONNECT:{var{onDisconnect:s}=this.props;s();break}case St.EVENT_RECONNECT:{var{onReconnect:o}=this.props;o();break}case St.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case St.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case St.EVENT_DOWNSAMPLENEEDED:case St.EVENT_DOWNSAMPLEFAILED:{var l,d=(l=n.message)!==null&&l!==void 0?l:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:d});var{onError:h}=this.props;h(new Cf(d));break}case St.EVENT_ERROR:{var v="".concat(n);this.setState({error:v});var{onError:f}=this.props;f(new Error(v));break}default:on.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,n=xe.getLayoutRanges(t),i=!Mt(n,this.ranges);i&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(on.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,n]=e;if(on.debug("handleRestyle",t,n),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var s=i.reduce((o,l)=>{var{name:d,visible:h}=l;return d!=null&&h==="legendonly"?[...o,d]:o},[]);a({hiddenSeries:s})}}}handleThemeChange(){var{theme:e,model:t}=this.props,{dh:n}=t,i=new xe(n);this.setState(a=>{var{layout:s}=a;return{layout:dr(dr({},s),{},{template:i.makeDefaultTemplate(e)})}})}toggleErrorMessage(e){this.setState(t=>{var{shownError:n}=t;return{shownError:n===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){on.warn("Unable to get plotting rect");return}var n=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(n||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=wn.getColumnFormats(e),n=wn.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!Mt(this.columnFormats,t)||!Mt(this.dateTimeFormatterOptions,n)||!Mt(this.decimalFormatOptions,i)||!Mt(this.integerFormatOptions,a))&&(this.columnFormats=wn.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new _r(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(n=>{on.debug("Unable to resize, promise rejected",n)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:n,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:s,error:o,shownError:l,layout:d,revision:h}=this.state,v=this.getCachedConfig(n,i,a,s,t??[],o),f=t!=null;return u.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[f&&u.jsx(e,{ref:this.plot,data:t,layout:d,revision:h,config:v,onAfterPlot:this.handleAfterPlot,onError:on.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),u.jsx(yi,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"chart-error",children:l}),u.jsx(Io,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}Ge(bn,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:No.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:Ro,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});function ul(r){var e=dl();return u.jsx(bn,dr(dr({},r),{},{theme:e}))}function Yd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Xd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yd(Object(t),!0).forEach(function(n){Pe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Yd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pe(r,e,t){return e=Kw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kw(r){var e=qw(r,"string");return typeof e=="symbol"?e:String(e)}function qw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fe=B.module("FigureChartModel");class Wa extends St{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(e),n=this,Pe(this,"chartUtils",void 0),Pe(this,"dh",void 0),Pe(this,"figure",void 0),Pe(this,"settings",void 0),Pe(this,"data",void 0),Pe(this,"layout",void 0),Pe(this,"seriesDataMap",void 0),Pe(this,"pendingSeries",void 0),Pe(this,"oneClicks",void 0),Pe(this,"filterColumnMap",void 0),Pe(this,"lastFilter",void 0),Pe(this,"isConnected",void 0),Pe(this,"seriesToProcess",void 0),Pe(this,"addPendingSeries",Le(()=>{for(var a=xe.getAxisTypeMap(this.figure),{pendingSeries:s}=this,o=function(){var h,v=s[l],f=n.figure.charts.find(p=>p.series.includes(v));n.addSeries(v,a,(h=f==null?void 0:f.showLegend)!==null&&h!==void 0?h:null),v.subscribe()},l=0;l<s.length;l+=1)o();this.pendingSeries=[]},Wa.ADD_SERIES_DEBOUNCE)),Pe(this,"getTimeZone",ot((a,s)=>{if(s!=null){var o=s.getColumnTypeFormatter(a);if(o!=null)return o.dhTimeZone}})),Pe(this,"getValueTranslator",ot((a,s)=>{var o=this.getTimeZone(a,s);return l=>this.chartUtils.unwrapValue(l,o)})),Pe(this,"getValueParser",ot((a,s)=>{var o=this.getTimeZone(a,s);return l=>this.chartUtils.wrapValue(l,a,o)})),Pe(this,"getRangeParser",ot((a,s)=>o=>{var[l,d]=o,h=this.getValueParser(a,s);return l=h(l),d=h(d),[l,d]})),Pe(this,"getAxisRangeParser",ot((a,s)=>o=>{var l=xe.getSourceForAxis(a,o);return l!=null?this.getRangeParser(l.columnType,s):d=>d})),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 xe(e),this.figure=t,this.settings=i,this.data=[],this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"}},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,n=xe.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var f=t[s],p=0;p<f.series.length;p+=1){var m=f.series[p];i.push(m.name),e.addSeries(m,n,f.showLegend)}var{axes:b,title:g}=f;if(g!=null&&g.length>0&&(t.length>1||e.figure.title!=null)){var C=b.find(R=>R.type===e.dh.plot.AxisType.X),y=b.find(R=>R.type===e.dh.plot.AxisType.Y);if(C==null||y==null)Fe.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",f);else{var S,E,w,I,O=((S=(E=n.get(C.type))===null||E===void 0?void 0:E.findIndex(R=>R===C))!==null&&S!==void 0?S:0)+1,T=((w=(I=n.get(y.type))===null||I===void 0?void 0:I.findIndex(R=>R===y))!==null&&w!==void 0?w:0)+1,N={align:"center",x:.5,y:1,yshift:17,text:g,showarrow:!1,xref:"x".concat(O," domain"),yref:"y".concat(T," domain")};e.layout.annotations==null?e.layout.annotations=[N]:e.layout.annotations.push(N)}}},s=0;s<t.length;s+=1)a();for(var o=[...this.seriesDataMap.keys()],l=o.filter(v=>i.indexOf(v)<0),d=0;d<l.length;d+=1){var h=l[d];this.seriesDataMap.delete(h)}}addSeries(e,t,n){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,xe.getSeriesVisibility(e.name,this.settings),n);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=xe.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?n??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:o}=s,l=0;l<o.length;l+=1)this.filterColumnMap.set(o[l].name,o[l]);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){Fe.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&&(Fe.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){Fe.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){Fe.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){Fe.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){Fe.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:n}=t;Fe.debug2("handleFigureUpdated",n);for(var i=0;i<n.length;i+=1){var a=n[i];Fe.debug2("handleFigureUpdated updating series",a.name);for(var{sources:s}=a,o=0;o<s.length;o+=1){var l=s[o],{columnType:d,type:h}=l,v=this.getValueTranslator(d,this.formatter),f=t.getArray(a,h,v);this.setDataArrayForSeries(a,h,f)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){Fe.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){Fe.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){Fe.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;Fe.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,n;super.setTitle(e);var i=(t=(n=(e??"").match(/<br>/g))===null||n===void 0?void 0:n.length)!==null&&t!==void 0?t:0,a=xe.DEFAULT_MARGIN.t+i*xe.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=Xd({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=Xd({},this.layout.title.pad),this.layout.title.pad.t=xe.DEFAULT_TITLE_PADDING.t+i*xe.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,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)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&n!==void 0?n:0),0)}getPlotHeight(){var e,t,n,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)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&n!==void 0?n:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,n)=>{Fe.debug("Assigning ".concat(n),this.layout[n],t);var i=this.layout[n];i!=null?Object.assign(i,t):Fe.debug("Ignoring null layout.".concat(n))})}}setDataArrayForSeries(e,t,n){var{name:i,plotStyle:a}=e,s=this.seriesDataMap.get(i),o=this.chartUtils.getPlotlyProperty(a,t);s&&hc(s,o,n)}cleanSeries(e){var{dh:t}=this,{name:n,plotStyle:i}=e,a=this.seriesDataMap.get(n);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:s,xHigh:o}=a;if(s&&o&&s.length===o.length){for(var l=[],d=0;d<s.length;d+=1)l.push(o[d]-s[d]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:h,xLow:v,xHigh:f,y:p,yLow:m,yHigh:b}=a;v&&f&&v!==h&&(a.error_x=xe.getPlotlyErrorBars(h,v,f)),m&&b&&m!==p&&(a.error_y=xe.getPlotlyErrorBars(p,m,b))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:g,labels:C}=a;g!==void 0&&C===void 0&&(a.labels=g)}}}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){Fe.warn("Trying to set a filter, but no one click!");return}Fe.debug("setFilter",e);for(var n=function(){var s=t.oneClicks[i],{columns:o}=s,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(d=>{var h=e.get(d);t.lastFilter.get(d)!==h&&o.find(v=>v.name===d)!=null&&s.setValueForColumn(d,h)})},i=0;i<this.oneClicks.length;i+=1)n();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}}Pe(Wa,"ADD_SERIES_DEBOUNCE",50);const eo=Wa;function Zd(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Es(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Zd(a,n,i,s,o,"next",l)}function o(l){Zd(a,n,i,s,o,"throw",l)}s(void 0)})}}class hl{static makeModelFromSettings(e,t,n){return Es(function*(){var i=yield hl.makeFigureFromSettings(e,t,n);return new eo(e,i,t)})()}static makeFigureFromSettings(e,t,n){return Es(function*(){var i=yield n.copy();return i.applyCustomColumns(n.customColumns),i.applyFilter(n.filter),i.applySort(n.sort),e.plot.Figure.create(new xe(e).makeFigureSettings(t,i))})()}static makeModel(e,t,n){return Es(function*(){return new eo(e,n,t)})()}}const mr=hl;function gr(r,e,t){return e=Yw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yw(r){var e=Xw(r,"string");return typeof e=="symbol"?e:String(e)}function Xw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class be extends St{static get theme(){return be._theme==null&&(be._theme=ol()),be._theme}static makeRandomSeries(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,i=[],a=[],s=[],o=[],l=new Date("2018-06-01"),d=0;d<n;d+=1){var h=new Date(l.getFullYear(),l.getMonth(),l.getDate()+d-n);i.push("".concat(h.getFullYear(),"-").concat(h.getMonth()+1,"-").concat(h.getDate()));var v=(Math.sin(d/n*e)*n/3+Math.cos(d*.2)*n/6+Math.sin(d*.5)*n/10+be.random()*n/5+d*be.smoothing)*t;v=Math.round(v*100)/100,a.push(v),o.push(40+d*be.smoothing),s.push(Math.sin(d/n*e)*n/3+be.random()*n/10+d*be.smoothing)}return{x:i,y:a,s,l:o}}static makeScatter(e){return{name:"SCTR",x:e.x,y:e.y,type:"scatter",mode:"markers",hoverinfo:"skip",marker:{size:5}}}static makeArea(e){return{name:"AREA",x:e.x,y:e.s,type:"scatter",mode:"line",fill:"tozeroy",hoverinfo:"all",line:{width:3}}}static makeTrendline(e){return{name:"Trendline <br>R<sup>2</sup> = 0.91",x:e.x,y:e.l,type:"scatter",mode:"line",hoverinfo:"skip",line:{width:3,dash:"dot"}}}static makeErrorBand(e){for(var t=[],n=[],i=0;i<e.y.length;i+=1){var a=e.y[i];t[i]=Math.round((a+18)*100)/100,n[i]=Math.round((a-18)*100)/100}var s=t.concat(n.reverse());return{name:"error",x:e.x.concat(e.x.slice().reverse()),y:s,type:"scatter",mode:"line",hoverinfo:"skip",fill:"toself",line:{width:0,color:be.theme.error_band_line_color,shape:"spline"}}}static makeLine(e){return{name:"LINE",x:e.x,y:e.y,type:"scatter",mode:"line",hoverinfo:"x+y+text+name",line:{width:3}}}static makeRandomData(){var e=be.makeRandomSeries(6),t=be.makeArea(e),n=be.makeTrendline(e),i=be.makeRandomSeries(2),a=be.makeLine(i),s=be.makeErrorBand(i);return[t,n,a,s]}static makeDefaultLayout(e){var t={template:new xe(e).makeDefaultTemplate(be.theme)};return t.title="Chart",t.xaxis={title:"Datestamp"},t.yaxis={title:"Price"},t}constructor(e){var{data:t=be.makeRandomData(),layout:n=be.makeDefaultLayout(e),filterFields:i=[]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(e),gr(this,"data",void 0),gr(this,"filterFields",void 0),gr(this,"layout",void 0),this.data=t,this.layout=n,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 n=this.filterFields[t],i="java.lang.String";e.set(n,{name:n,type:i})}return e}isFilterRequired(){return this.filterFields.length>0}setFilter(){this.fireUpdate(this.data)}}gr(be,"random",Math.random.bind(Math));gr(be,"smoothing",1.5);gr(be,"_theme",void 0);const Zw=be,yf=bf(Ro);function to(r){return r.setFigure!==void 0}const Qw=Object.freeze(Object.defineProperty({__proto__:null,Chart:ul,ChartModel:St,ChartModelFactory:mr,ChartThemeContext:ll,ChartThemeProvider:Sf,ChartUtils:xe,DownsamplingError:Cf,FigureChartModel:eo,MockChartModel:Zw,Plot:yf,defaultChartTheme:ol,isFigureChartModel:to,useChartTheme:dl},Symbol.toStringTag,{value:"Module"}));var Ef=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 wf(r){return r.componentName!==void 0}function Jw(r){return r.component!==void 0}var Pf=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const eP=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ef,isGLComponentConfig:wf,isReactComponentConfig:Jw,itemDefaultConfig:Pf},Symbol.toStringTag,{value:"Module"}));function sa(r,e,t){return e=tP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tP(r){var e=nP(r,"string");return typeof e=="symbol"?e:String(e)}function nP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ci{constructor(){sa(this,"_mSubscriptions",void 0),sa(this,"off",this.unbind),sa(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[ci.ALL_EVENT]=[]}on(e,t,n){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:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];if(t)for(var s=0;s<t.length;s++){var o=t[s].ctx||{};try{t[s].fn.apply(o,i)}catch(v){console.error("Error while emitting event:",v)}}i.unshift(e);for(var l=this._mSubscriptions[ci.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,i)}catch(v){console.error("Error while emitting event to allEventSubs:",v)}}}unbind(e,t,n){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)&&(!n||n===this._mSubscriptions[e][a].ctx)&&(this._mSubscriptions[e].splice(a,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}sa(ci,"ALL_EVENT","__all");const Ft=ci;function _t(r,e,t){return e=rP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rP(r){var e=iP(r,"string");return typeof e=="symbol"?e:String(e)}function iP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class no extends Ft{constructor(e,t,n){super(),_t(this,"width",void 0),_t(this,"height",void 0),_t(this,"title",void 0),_t(this,"parent",void 0),_t(this,"layoutManager",void 0),_t(this,"tab",void 0),_t(this,"_config",void 0),_t(this,"isHidden",!1),_t(this,"beforeCloseHandler",void 0),_t(this,"_element",Z(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),_t(this,"_contentElement",void 0),this.title=wf(e)?e.componentName:"",this.parent=t,this.layoutManager=n,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 n,i,a,s=this.parent,o=null;s&&!s.isColumn&&!s.isRow;){var l;if(o=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!o)return!1;for(var d=s.isColumn?"height":"width",h=d==="height"?t:e,v=((n=this[d])!==null&&n!==void 0?n:0)*(1/(((i=o.config[d])!==null&&i!==void 0?i:0)/100)),f=h/v*100,p=(((a=o.config[d])!==null&&a!==void 0?a:0)-f)/(s.contentItems.length-1),m=0;m<s.contentItems.length;m++)if(s.contentItems[m]===o)s.contentItems[m].config[d]=f;else{var b;s.contentItems[m].config[d]=((b=s.contentItems[m].config[d])!==null&&b!==void 0?b:0)+p}return s.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.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(Z.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 n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,a=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-a),this.emit("resize")}}}const aP=Object.freeze(Object.defineProperty({__proto__:null,Container:no,ItemContainer:no},Symbol.toStringTag,{value:"Module"}));function _f(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function Tf(r){if(window.location.hash)return _f(r);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,i;for(i=0;i<e.length;i++)n=e[i].split("="),t[n[0]]=n[1];return t[r]||null}function cl(r){return window.requestAnimationFrame(r)}function sP(r,e){var t=e.indexOf(r);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function vl(){return(Math.random()*1e15).toString(36).replace(".","")}function oP(r,e){var t=r.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 fl(r){return Z.trim(r.replace(/(<([^>]+)>)/gi,""))}function lt(r,e,t){return e=lP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lP(r){var e=dP(r,"string");return typeof e=="symbol"?e:String(e)}function dP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class uP extends Ft{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),lt(this,"_eElement",void 0),lt(this,"_oDocument",void 0),lt(this,"_eBody",void 0),lt(this,"_destroyAfterMouseUp",void 0),lt(this,"_nDelay",400),lt(this,"_timeout",void 0),lt(this,"timeout",void 0),lt(this,"_nDistance",10),lt(this,"_nX",0),lt(this,"_nY",0),lt(this,"_nOriginalX",0),lt(this,"_nOriginalY",0),lt(this,"_bDragging",!1),this._eElement=e,this._oDocument=Z(document),this._eBody=Z(document.body),this._destroyAfterMouseUp=n,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,n,i,a,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=s.y)!==null&&n!==void 0?n: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,n;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=i.y)!==null&&n!==void 0?n: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,n,i,a,s;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.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)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var o;(o=this._eElement)===null||o===void 0||o.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,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"),(n=this._oDocument)===null||n===void 0||(i=n.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}const Oi=uP;function er(r,e,t){return e=hP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hP(r){var e=cP(r,"string");return typeof e=="symbol"?e:String(e)}function cP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Of{constructor(e,t){er(this,"_container",void 0),er(this,"_reactComponent",null),er(this,"_portalComponent",null),er(this,"_originalComponentWillUpdate",null),er(this,"_initialState",void 0),er(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=xa.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 n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.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=Z.extend(e,this._container._config.props);return X.createElement(this._reactClass,t)}}var ga=["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"],vP=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function pl(r){if(ga.length>36)throw new Error("Too many keys in config minifier map");var e={};return ml(r,e,"_min"),e}function ro(r){if(ga.length>36)throw new Error("Too many keys in config minifier map");var e={};return ml(r,e,"_max"),e}function ml(r,e,t){var n=t==="_min"?fP:pP;for(var i in r)if(r.hasOwnProperty(i)){var a=Array.isArray(r)?r[Number.parseInt(i,10)]:r[i];if(typeof a=="object"&&a!=null){var s=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=s;else{var o=n(i,ga);e[o]=s}ml(a,s,t)}else{var l=n(a,vP);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,ga);e[d]=l}}}}function fP(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function pP(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function ws(r,e,t){return e=mP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mP(r){var e=gP(r,"string");return typeof e=="symbol"?e:String(e)}function gP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class io{constructor(e,t){ws(this,"name",void 0),ws(this,"origin",void 0),ws(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Bi(r,e,t){return e=bP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bP(r){var e=CP(r,"string");return typeof e=="symbol"?e:String(e)}function CP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let SP=class extends Ft{constructor(e){super(),Bi(this,"_layoutManager",void 0),Bi(this,"_dontPropagateToParent",void 0),Bi(this,"_childEventSource",void 0),Bi(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ft.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),Z(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];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,n="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(n,!0,!0),i.eventName=n,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){Z(window).off("gl_child_event",this._boundOnEventFromChild)}};const Df=SP,yP=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:io,DragListener:Oi,EventEmitter:Ft,EventHub:Df,ReactComponentHandler:Of,animFrame:cl,filterXss:oP,getHashValue:_f,getQueryStringParam:Tf,getUniqueId:vl,minifyConfig:pl,removeFromArray:sP,stripTags:fl,unminifyConfig:ro},Symbol.toStringTag,{value:"Module"}));function ln(r,e,t){return e=EP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function EP(r){var e=wP(r,"string");return typeof e=="symbol"?e:String(e)}function wP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class If extends Ft{constructor(e,t,n,i,a){super(),ln(this,"isInitialised",!1),ln(this,"_config",void 0),ln(this,"_dimensions",void 0),ln(this,"_parentId",void 0),ln(this,"_indexInParent",void 0),ln(this,"_layoutManager",void 0),ln(this,"_popoutWindow",null),ln(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=a,this._createWindow()}toConfig(){var e,t,n,i,a,s,o,l,d,h,v;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:(n=(i=(a=this._popoutWindow)===null||a===void 0?void 0:a.screenX)!==null&&i!==void 0?i:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&n!==void 0?n:0,top:(o=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&o!==void 0?o:0},content:(v=this.getGlInstance())===null||v===void 0?void 0:v.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,n=null;if(this._parentId){var i;if(t=Z.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var a;((a=this._layoutManager.root.contentItems.length)!==null&&a!==void 0?a:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=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,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;Z(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(a))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+vl();e=pl(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var n=document.location.href.split("?");return n.length===1?n[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(r,e,t){return e=PP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PP(r){var e=_P(r,"string");return typeof e=="symbol"?e:String(e)}function _P(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zn extends Ft{constructor(e,t,n,i,a,s){var o,l,d,h,v,f,p,m;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=n,this._layoutManager=i,this._contentItem=a,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var b,g;this._layoutManager.tabDropPlaceholder.width((b=this._contentItem.tab.element.outerWidth(!0))!==null&&b!==void 0?b:0),this._layoutManager.tabDropPlaceholder.height((g=this._contentItem.tab.element.outerHeight(!0))!==null&&g!==void 0?g:0)}if(this.element=Z(zn._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._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",fl((o=this._contentItem.config.title)!==null&&o!==void 0?o:"")),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(),Z(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var C,y;this._layoutManager.tabDropPlaceholder.width((C=this._proxyTab.outerWidth(!0))!==null&&C!==void 0?C:0),this._layoutManager.tabDropPlaceholder.height((y=this._proxyTab.outerHeight(!0))!==null&&y!==void 0?y:0)}var S=this._layoutManager.container.offset();this._minX=(d=S==null?void 0:S.left)!==null&&d!==void 0?d:0,this._minY=(h=S==null?void 0:S.top)!==null&&h!==void 0?h:0,this._maxX=((v=this._layoutManager.container.width())!==null&&v!==void 0?v:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(m=this.element.height())!==null&&m!==void 0?m:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,a,s=(i=n.pageX)!==null&&i!==void 0?i:0,o=(a=n.pageY)!==null&&a!==void 0?a:0,l=s>this._minX&&s<this._maxX&&o>this._minY&&o<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,o)}_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,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Re(zn,"_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 Wi(r,e,t){return e=TP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function TP(r){var e=OP(r,"string");return typeof e=="symbol"?e:String(e)}function OP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class xf{constructor(e,t,n){Wi(this,"_element",void 0),Wi(this,"_itemConfig",void 0),Wi(this,"_layoutManager",void 0),Wi(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Oi(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Z.extend(!0,{},n));new zn(e,t,this._dragListener,this._layoutManager,i,null)}}function Gi(r,e,t){return e=DP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function DP(r){var e=IP(r,"string");return typeof e=="symbol"?e:String(e)}function IP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nf{constructor(e,t,n){Gi(this,"_element",Z(window)),Gi(this,"_itemConfig",void 0),Gi(this,"_layoutManager",void 0),Gi(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Oi(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 n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Z.extend(!0,{},n));new zn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Mf(r,e,t){return e=xP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xP(r){var e=NP(r,"string");return typeof e=="symbol"?e:String(e)}function NP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Di{constructor(){Mf(this,"element",Z(Di._template)),Z(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()}}Mf(Di,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Ps(r,e,t){return e=MP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MP(r){var e=LP(r,"string");return typeof e=="symbol"?e:String(e)}function LP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Jr{constructor(e,t,n,i){Ps(this,"element",void 0),Ps(this,"_header",void 0),Ps(this,"_action",void 0),this._header=e,this.element=Z('<li class="'+n+'" 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 FP(r,e,t){return e=AP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function AP(r){var e=RP(r,"string");return typeof e=="symbol"?e:String(e)}function RP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class jP extends Error{constructor(e,t){super(),FP(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const jn=jP,kP=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:jn},Symbol.toStringTag,{value:"Module"}));function Me(r,e,t){return e=$P(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $P(r){var e=UP(r,"string");return typeof e=="symbol"?e:String(e)}function UP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function vi(r){return r.isStack}function ht(r){return r.isComponent}function Lf(r){return r.isRoot}class $e extends Ft{constructor(e,t,n,i){super(),Me(this,"config",void 0),Me(this,"type",void 0),Me(this,"contentItems",void 0),Me(this,"parent",void 0),Me(this,"layoutManager",void 0),Me(this,"element",void 0),Me(this,"childElementContainer",void 0),Me(this,"componentName",void 0),Me(this,"isInitialised",!1),Me(this,"isMaximised",!1),Me(this,"isRoot",!1),Me(this,"isRow",!1),Me(this,"isColumn",!1),Me(this,"isStack",!1),Me(this,"isComponent",!1),Me(this,"tab",void 0),Me(this,"_pendingEventPropagations",void 0),Me(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Ft.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&i!==!0&&this[e].apply(this,t);for(var a=0;a<this.contentItems.length;a++)this.contentItems[a].callDownwards(e,t,n);n===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=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(n!==!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 n=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]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,vi(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=[],n=function i(a){for(var s=0;s<a.contentItems.length;s++)e(a.contentItems[s])===!0&&t.push(a.contentItems[s]),i(a.contentItems[s])};return n(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),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$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"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&ht(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,i;e=e||this.element;var a=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},s=(n=e.width())!==null&&n!==void 0?n:0,o=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+s,y2:a.top+o,surface:s*o,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 io(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new jn("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(Pf)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof io&&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,cl(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Gr(r,e,t){return e=HP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function HP(r){var e=VP(r,"string");return typeof e=="symbol"?e:String(e)}function VP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ff extends $e{constructor(e,t,n){super(e,t,n,Z()),Gr(this,"config",void 0),Gr(this,"componentName",void 0),Gr(this,"container",void 0),Gr(this,"parent",void 0),Gr(this,"instance",void 0),this.config=t,this.parent=n;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=Z.extend(!0,{},this.config.componentState||{});if(i==null)throw new jn('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 no(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(){$e.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),$e.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),$e.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),$e.prototype._$destroy.call(this)}_$getArea(){return null}}function gt(r,e,t){return e=BP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function BP(r){var e=WP(r,"string");return typeof e=="symbol"?e:String(e)}function WP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ba extends $e{constructor(e,t,n,i){super(t,n,i,Z('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),gt(this,"isRow",void 0),gt(this,"isColumn",void 0),gt(this,"childElementContainer",void 0),gt(this,"parent",void 0),gt(this,"_splitter",[]),gt(this,"_splitterSize",void 0),gt(this,"_splitterGrabSize",void 0),gt(this,"_isColumn",void 0),gt(this,"_dimension",void 0),gt(this,"_splitterPosition",null),gt(this,"_splitterMinPosition",null),gt(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,n){var i,a,s,o;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(o=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(o),o.after(e.element)):(this.contentItems[0].element.before(o),o.before(e.element))):this.childElementContainer.append(e.element),$e.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[s].config[this._dimension]=a}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,a=this.contentItems.indexOf(e),s=Math.max(a-1,0),o,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),o=0;o<this.contentItems.length;o++)if(this.contentItems[o]!==e){var d;this.contentItems[o].config[this._dimension]=((d=this.contentItems[o].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}$e.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 n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=n,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($e.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,n=(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,s=0,o=[];this._isColumn?a-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var d,h,v=this._isColumn?Math.floor(a*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));s+=v,o.push(v)}var f=Math.floor((this._isColumn?a:i)-s);return{itemSizes:o,additionalPixel:f,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var a=this.contentItems[i].config[n];a!=null?e+=a:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var s=0;s<t.length;s++)t[s].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var o=0;o<t.length;o++)t[o].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[n]=((d=this.contentItems[l].config[n])!==null&&d!==void 0?d: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,n=[],i=0,a=0,s=0,o=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var v=d.itemSizes[h];v<t?(a+=t-v,l={width:t}):(i+=v-t,l={width:v},n.push(l)),o.push(l)}if(!(a===0||a>i)){var f=a/i;s=a;for(var p=0;p<n.length;p++){l=n[p];var m=Math.round((l.width-t)*f);s-=m,l.width-=m}s!==0&&(o[o.length-1].width-=s);for(var b=0;b<this.contentItems.length;b++)this.contentItems[b].config.width=o[b].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new Af(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,n=0,i=0;i<e.length;++i){var a,s;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),n=Math.max((s=e[i].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,a,s=this._getItemsForSplitter(e),o=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((n=s.after.config.content)!==null&&n!==void 0?n:[]),v=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=s.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||o)),this._splitterMaxPosition=((a=s.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(v||o)}_onSplitterDrag(e,t,n){var i=this._isColumn?n: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,n,i,a,s,o=this._getItemsForSplitter(e),l=(t=o.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(n=o.after.element[this._dimension]())!==null&&n!==void 0?n:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),v=((a=o.before.config[this._dimension])!==null&&a!==void 0?a:0)+((s=o.after.config[this._dimension])!==null&&s!==void 0?s:0);o.before.config[this._dimension]=h*v,o.after.config[this._dimension]=(1-h)*v,e.element.css({top:0,left:0}),cl(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Qd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Jd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qd(Object(t),!0).forEach(function(n){ao(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ao(r,e,t){return e=GP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GP(r){var e=zP(r,"string");return typeof e=="symbol"?e:String(e)}function zP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class so extends $e{constructor(e,t,n){super(e,Jd(Jd({},t),{},{type:"root"}),null,Z('<div class="lm_goldenlayout lm_item lm_root"></div>')),ao(this,"childElementContainer",void 0),ao(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,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 n,i;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n: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,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(ht(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,a=i==="left"||i==="right"?"row":"column",s=i==="left"||i==="right"?"width":"height",o=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof ba)||l.type!=a){var d=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,d),d.addChild(e,o?0:void 0,!0),d.addChild(l,o?void 0:0,!0),l.config[s]=50,e.config[s]=50,d.callDownwards("setSize")}else{var h,v=l.contentItems[o?0:l.contentItems.length-1];l.addChild(e,o?0:void 0,!0),v.config[s]=((h=v.config[s])!==null&&h!==void 0?h:0)*.5,e.config[s]=v.config[s],l.callDownwards("setSize")}}}}function eu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function tr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?eu(Object(t),!0).forEach(function(n){st(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):eu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function st(r,e,t){return e=KP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function KP(r){var e=qP(r,"string");return typeof e=="symbol"?e:String(e)}function qP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class oo extends $e{constructor(e,t,n){var i,a,s,o,l,d,h,v,f;super(e,t,n,Z('<div class="lm_item lm_stack"></div>')),st(this,"_activeContentItem",null),st(this,"_header",void 0),st(this,"childElementContainer",Z('<div class="lm_items"></div>')),st(this,"header",void 0),st(this,"parent",void 0),st(this,"isStack",!0),st(this,"_dropZones",{}),st(this,"_dropSegment",null),st(this,"_contentAreaDimensions",null),st(this,"_dropIndex",void 0),st(this,"_side",void 0),st(this,"_sided",!1),st(this,"config",void 0),this.parent=n,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?(s=p.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(o=p.settings)!==null&&o!==void 0&&o.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=p.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(v=(f=p.labels)===null||f===void 0?void 0:f.minimise)!==null&&v!==void 0?v:void 0},p.header&&(this._header=tr(tr({},this._header),p.header)),t.header&&(this._header=tr(tr({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=tr(tr({},this._header),t.content[0].header)),this.header=new en(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,i,a,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,o=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?s:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:s);for(this.childElementContainer.width(o),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(o).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,n=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(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){$e.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",n=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",a=t&&this.parent.isColumn||n&&this.parent.isRow,s=t?"column":"row",o=t?"height":"width";if(ht(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[o]=((d=this.config[o])!==null&&d!==void 0?d:0)*.5,e.config[o]=this.config[o],this.parent.callDownwards("setSize")}else{var v=this.layoutManager.createContentItem({type:s},this);this.parent.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[o]=50,e.config[o]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var a=i.hoverArea;if(a.x1<e&&a.x2>e&&a.y1<t&&a.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));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 n=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+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.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+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.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,n,i,a,s,o,l,d,h,v,f,p,m,b,g,C,y=this.header.tabs.length;if(y===0){var S,E,w,I,O,T,N,R,W=this.header.element.offset();(S=this.layoutManager.dropTargetIndicator)===null||S===void 0||S.highlightArea({x1:(E=W==null?void 0:W.left)!==null&&E!==void 0?E:0,x2:((w=W==null?void 0:W.left)!==null&&w!==void 0?w:0)+100,y1:(I=(O=this.header.element.offset())===null||O===void 0?void 0:O.top)!==null&&I!==void 0?I:0,y2:((T=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&T!==void 0?T:0)+((R=this.header.element.innerHeight())!==null&&R!==void 0?R:0)});return}var L=this.header.tabsContainer,D=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),M=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!D||!M)){e<D.left?e=D.left+1:e>D.right&&(e=D.right-1);var F,k;if(!(M.left<e&&e<M.right)){for(var H=0;H<y;H++){var q;if(F=this.header.tabs[H].element,k=(q=F.get(0))===null||q===void 0?void 0:q.getBoundingClientRect(),k&&k.left<e&&e<k.right){this._dropIndex=H;break}}if(F&&k&&e<k.left+k.width*.5)F.before(this.layoutManager.tabDropPlaceholder);else if(F){var re;this._dropIndex=Math.min(((re=this._dropIndex)!==null&&re!==void 0?re:0)+1,y),F.after(this.layoutManager.tabDropPlaceholder)}}var V=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;V=Math.max(V,(s=(o=this.header.tabsContainer.offset())===null||o===void 0?void 0:o.left)!==null&&s!==void 0?s:0);var x=V+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);x=Math.min(x,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((v=this.header.tabsContainer.innerWidth())!==null&&v!==void 0?v:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:V,x2:x,y1:(p=(m=this.header.element.offset())===null||m===void 0?void 0:m.top)!==null&&p!==void 0?p:0,y2:((b=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&b!==void 0?b:0)+((C=this.header.element.innerHeight())!==null&&C!==void 0?C:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===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,n,i=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(i){var a;(a=this.layoutManager.dropTargetIndicator)===null||a===void 0||a.highlightArea(i)}this._dropSegment=e}}const YP=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:$e,Component:Ff,ContentItem:$e,Root:so,RowOrColumn:ba,Stack:oo,isComponent:ht,isRoot:Lf,isStack:vi},Symbol.toStringTag,{value:"Module"}));function Xt(r,e,t){return e=XP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XP(r){var e=ZP(r,"string");return typeof e=="symbol"?e:String(e)}function ZP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ii{constructor(e,t){var n;Xt(this,"header",void 0),Xt(this,"contentItem",void 0),Xt(this,"element",Z(Ii._template)),Xt(this,"titleElement",void 0),Xt(this,"closeElement",void 0),Xt(this,"isActive",!1),Xt(this,"_layoutManager",void 0),Xt(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,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new Oi(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),ht(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),ht(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 n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new zn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){Z(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){ht(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&ht(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):ht(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),ht(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(),ht(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Xt(Ii,"_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 le(r,e,t){return e=QP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function QP(r){var e=JP(r,"string");return typeof e=="symbol"?e:String(e)}function JP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class en extends Ft{constructor(e,t){var n,i;super(),le(this,"layoutManager",void 0),le(this,"element",Z(en._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",Z(en._nextButtonTemplate)),le(this,"tabPreviousButton",Z(en._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.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 n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var i=new Ii(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,n,i,a,s=0;s<this.tabs.length;s++)a=this.tabs[s].contentItem===e,this.tabs[s].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(n=t.scrollIntoView)===null||n===void 0||n.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 n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;n*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_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 n,i,a,s,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)>((a=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&a!==void 0?a:0)+((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o: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 d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,a;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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 s=this.tabsContainer.get(0);s&&(s.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,n;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)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0,s=this.tabsContainer.get(0);if(s){var o=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var v,f,p=a||h,m=h-p,b=this.START_SPEED*m+.5*this.ACCELERATION*(m*m);b=Math.min(b,(v=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&v!==void 0?v:1/0),this._handleScrollRepeat(e,t,b,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(),Z(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,n,i,a;if(a=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Jr(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),n=this._getHeaderSetting("popout"),new Jr(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),o=this._getHeaderSetting("minimise"),l=new Jr(this,s,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",o??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Jr(this,n,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),Z(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"),Z(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(o,l,d){if(d==null||d.length<2)return-1;for(var h=(o+l+d.length)%d.length;h!==o;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.length}return o}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.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,s;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),(s=this.tabDropdownList)===null||s===void 0||s.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 n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-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,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.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(),Z(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,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 s=this.tabDropdownContainer[0].getBoundingClientRect(),o=(n=Z(window).height())!==null&&n!==void 0?n:0,l=(i=Z(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=a<o-d.bottom,v=!h&&d.bottom>o*.6,f=Math.min(d.left+(v?d.width:0),l-s.width-this.PADDING),p=v?Math.max(d.top-a,this.PADDING):d.bottom,m=o-p-this.PADDING;this.tabDropdownContainer.css({"max-height":m,top:p,left:f})}}}}_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 n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}le(en,"_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(""));le(en,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(en,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function zr(r,e,t){return e=e0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function e0(r){var e=t0(r,"string");return typeof e=="symbol"?e:String(e)}function t0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Af{constructor(e,t,n){zr(this,"_isVertical",void 0),zr(this,"_size",void 0),zr(this,"_grabSize",void 0),zr(this,"_dragListener",void 0),zr(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new Oi(this.element)}on(e,t,n){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,n)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=Z('<div class="lm_drag_handle"></div>'),t=Z('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,i=n/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const n0=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:If,DragProxy:zn,DragSource:xf,DragSourceFromEvent:Nf,DropTargetIndicator:Di,Header:en,HeaderButton:Jr,Splitter:Af,Tab:Ii},Symbol.toStringTag,{value:"Module"}));var r0={config:eP,container:aP,controls:n0,errors:kP,items:YP,utils:yP};const i0=r0;function tu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function rt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tu(Object(t),!0).forEach(function(n){ue(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):tu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ue(r,e,t){return e=a0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function a0(r){var e=s0(r,"string");return typeof e=="symbol"?e:String(e)}function s0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Rf extends Ft{static minifyConfig(e){return pl(e)}static unminifyConfig(e){return ro(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":Of}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",Z('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Df(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",Z('<div class="lm_drop_tab_placeholder"></div>')),ue(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&&Z("body").css("visibility","hidden"),this._typeToItem={column:ba.bind(this,!0),row:ba.bind(this,!1),stack:oo,component:Ff}}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 n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}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 $e))throw new Error("Root must be a ContentItem");var t={settings:rt({},this.config.settings),dimensions:rt({},this.config.dimensions),labels:rt({},this.config.labels),content:[]},n=function a(s,o){for(var l in o.config)l!=="content"&&(s[l]=o.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),o.contentItems.length){s.content=[];for(var d=0;d<o.contentItems.length;d++)s.content[d]={},a(s.content[d],o.contentItems[d])}};e?n(t,{contentItems:[e]}):n(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){Z(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 Di,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 n=this._reactChildMap.get(e);n===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}updateSize(e,t){var n,i;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n: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,s;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),Z(window).off("resize",this._onResize),Z(window).off("unload beforeunload",this._onUnload),Z(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 n,i;if(typeof e.type!="string")throw new jn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw n="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new jn(n);return e.type==="component"&&!(t instanceof oo)&&t&&!(this.isSubWindow===!0&&t instanceof so)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,t),i}createPopout(e,t,n,i){var a=[],s=e instanceof $e,o=this;if(s){var l;a=this.toConfig(e).content,n=vl();for(var d=e.parent,h=e;((v=d)===null||v===void 0?void 0:v.contentItems.length)===1&&!d.isRoot;){var v;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var f;i=(f=d)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?a=e:a=[e];if(!t&&s){var p,m,b,g=window.screenX||window.screenLeft,C=window.screenY||window.screenTop,y=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:g+y.left,top:C+y.top,width:(m=e.element.width())!==null&&m!==void 0?m:0,height:(b=e.element.height())!==null&&b!==void 0?b:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!n||i===void 0)){var S=new If(a,t,n,i,this);return S.on("initialised",function(){o.emit("windowOpened",S)}),S.on("closed",function(){o._$reconcilePopoutWindows()}),this.openPopouts.push(S),S}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new xf(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Nf(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,n;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((n=this.container.height())!==null&&n!==void 0?n: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 n=1/0,i=null,a=0;a<this._itemAreas.length;a++){var s=this._itemAreas[a];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&n>s.surface&&(n=s.surface,i=s)}return i}_$createRootItemAreas(){var e=50,t=rt({},this.root._$getArea()),n=[rt(rt({},t),{},{side:"left",x2:t.x1+e}),rt(rt({},t),{},{side:"right",x1:t.x2-e}),rt(rt({},t),{},{side:"top",y2:t.y1+e}),rt(rt({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...n)}_$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 n=e[t];if(vi(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var a;this._itemAreas.push(i);var s=rt(rt({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof $e)return e;if(Z.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.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=n=>{if(e.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)t(n.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&Z(window).resize(this._onResize),Z(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,n=Tf("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=ro(e),localStorage.removeItem(n)),e=Z.extend(!0,{},Ef,e);var i=function a(s){for(var o in s){var l=s[o];o!=="props"&&typeof l=="object"&&l!=null?a(l):o==="type"&&l==="react-component"&&(s.type="component",s.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=Z('<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=fl((e=this.config.content[0].title)!==null&&e!==void 0?e:""),Z("head").append(Z("body link, body style, template, .gl_keep")),this.container=Z("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?Z(this._originalContainer):Z("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,Z("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 jn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new jn(t,e);this.root=new so(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,n=e*t;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),a=e-i,s=this.root.contentItems[0],o=this._findAllStackContainers()[0],l=0;l<a;l++){var d=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(o,d)}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(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{vi(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}ue(Rf,"__lm",i0);const jf=Rf,o0="_lm_dragging_k4a5m_1",l0="_lm_goldenlayout_k4a5m_1",d0="_lm_header_k4a5m_1",u0="_lm_controls_k4a5m_1",h0="_lm_tabpreviousbutton_k4a5m_1",c0="_lm_tabnextbutton_k4a5m_1",v0="_lm_tab_k4a5m_1",f0="_lm_active_k4a5m_1",p0="_lm_close_tab_k4a5m_1",m0="_lm_content_k4a5m_1",g0="_lm_dragProxy_k4a5m_1",b0="_lm_dropTargetIndicator_k4a5m_1",C0="_march_k4a5m_1",S0="_lm_inner_k4a5m_1",y0="_lm_splitter_k4a5m_1",E0="_lm_selectable_k4a5m_1",w0="_lm_tabdropdown_list_k4a5m_1",P0="_lm_title_k4a5m_1",_0="_lm_title_before_k4a5m_1",T0="_lm_selected_k4a5m_1",O0="_lm_focusin_k4a5m_1",D0="_lm_window_blur_k4a5m_1",I0="_lm_popout_k4a5m_1",x0="_lm_maximise_k4a5m_1",N0="_lm_tabdropdown_k4a5m_1",M0="_lm_close_k4a5m_1",L0="_lm_tabdropdown_search_k4a5m_1",F0="_lm_tabs_k4a5m_1",A0="_lm_keyboard_active_k4a5m_1",R0="_lm_maximised_k4a5m_1",j0="_lm_items_k4a5m_1",nu={"tab-height":"28px","drag-border-width":"5px",lm_dragging:o0,lm_goldenlayout:l0,lm_header:d0,lm_controls:u0,lm_tabpreviousbutton:h0,lm_tabnextbutton:c0,lm_tab:v0,lm_active:f0,lm_close_tab:p0,lm_content:m0,lm_dragProxy:g0,lm_dropTargetIndicator:b0,march:C0,lm_inner:S0,lm_splitter:y0,lm_selectable:E0,lm_tabdropdown_list:w0,lm_title:P0,lm_title_before:_0,lm_selected:T0,lm_focusin:O0,lm_window_blur:D0,lm_popout:I0,lm_maximise:x0,lm_tabdropdown:N0,lm_close:M0,lm_tabdropdown_search:L0,lm_tabs:F0,lm_keyboard_active:A0,lm_maximised:R0,lm_items:j0},ru=Object.freeze({tabHeight:parseInt(nu["tab-height"],10),dragBorderWidth:parseInt(nu["drag-border-width"],10)});function iu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function zt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?iu(Object(t),!0).forEach(function(n){kf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):iu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kf(r,e,t){return e=k0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function k0(r){var e=$0(r,"string");return typeof e=="symbol"?e:String(e)}function $0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var dn=B.module("LayoutUtils");function $f(r){return r.componentName!==void 0}function ur(r){var e=r;return($f(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function zi(r){return r.focus!==void 0}function au(r){return r.type==="stack"}class A{static activateTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n){dn.error("Could not find stack for config",t);return}var i=A.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return dn.error("Could not find stack for config",t),!1;var i=A.getContentItemInStack(n,t),a=n.getActiveContentItem();return a===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(Lf(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var i=e.contentItems[0],a=t?i.isColumn:i.isRow;if(!a){e.removeChild(i,!0),e.addChild({type:n});var s=document.activeElement;e.contentItems[0].addChild(i),s&&s.focus!=null&&s.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 o=e.contentItems[e.contentItems.length-1],l=t?o.isRow:o.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(o,!0),e.contentItems[e.contentItems.length-1].addChild(o),o=e.contentItems[e.contentItems.length-1]),this.addStack(o,!t)}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&vi(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&&Kl(a.config,t))return e;var s=this.getStackForConfig(a,t,n);if(s)return s}return null}static getStackForRoot(e,t){var n=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,s=this.getStackForConfig(e,t);return!s&&i&&(s=this.getStackForConfig(e,{component:t.component},a)),!s&&n&&(s=this.addStack(e)),s}static getStackForComponentTypes(e,t){for(var n=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,s=0;s<t.length;s+=1){var o=t[s],l=s===t.length-1,d=A.getStackForRoot(e,{component:o},n&&l,i,a);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var i=e.contentItems[n];if(i.isComponent&&i.config!=null&&Kl(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i],{component:s,content:o}=a;if(s){var l=t(s,a);l!=null?n.push(l):dn.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(o){var d=zt(zt({},a),{},{content:A.dehydrateLayoutConfig(o,t)});n.push(d)}else n.push(a)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:i}=n;i!==void 0?(au(n)&&delete n.activeItemIndex,A.dropLayoutMinorChange(i)):ur(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=A.cloneLayout(e),a=A.cloneLayout(t);return n?(A.dropLayoutMinorChange(i),A.dropLayoutMinorChange(a),Mt(i,a)):Mt(i,a)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i];if(ur(a)){var s,{component:o,props:l={}}=a;n.push(zt(zt({},a),{},{id:(s=a==null?void 0:a.id)!==null&&s!==void 0?s:ye(),props:t(o,l)}))}else if(a.content!==void 0){var d=A.hydrateLayoutConfig(a.content,t);au(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=d.length&&(dn.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),n.push(zt(zt({},a),{},{content:d}))}else n.push(a)}return n}static openComponent(){var{root:e,config:t,replaceExisting:n=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:o=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,d=zt({},t);if(d.id==null&&(d.id=ye.generate()),o!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,o);return}var h=i||{id:d.id,component:d.component};z(e);var v=a?A.addStack(e):A.getStackForRoot(e,h);z(v);var f=A.getContentItemInStack(v,h);if(s!=null){var p=b=>{dn.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:g}=b.origin;requestAnimationFrame(()=>{A.focusElement(g[0],s)})};v.on("componentCreated",p)}if(n&&f){var m=v.contentItems.indexOf(f);v.addChild(d,m+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[m])}else v.addChild(d);s==null&&l&&zi(l)&&l.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,a={id:t.id},s=A.getContentItemInStack(e,a);if(n&&s&&e){var o=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,o+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[o])}else e==null||e.addChild(t);i&&zi(i)&&i.focus()}static closeComponent(e,t,n){var i=A.getStackForRoot(e,t,!1,!1,!1);if(!i){dn.warn("Cannot find stack for component, ignoring close",t);return}var a=A.getContentItemInStack(i,t),s=document.activeElement;a&&(ht(a)?a.container.close(n):i.removeChild(a)),s&&document.contains(s)&&zi(s)&&s.focus()}static renameComponent(e,t,n){var i=A.getStackForRoot(e,t,!1);if(!i){dn.error("Could not find stack for config",t);return}var a=A.getContentItemInStack(i,t);a&&a.setTitle(n)}static cloneComponent(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return dn.error("Could not find stack for config",t),null;var{props:i={}}=t,a=A.getPanelComponentState(t),s={type:"react-component",component:t.component,props:zt(zt({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:ye.generate()};return A.openComponentInStack(n,s),s}static getPanelComponentState(e){if($f(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(ur(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ru.tabHeight,borderWidth:ru.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=A.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return A.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=A.getComponentConfigFromContainer(t);if(n&&ur(n)){var i;return(i=n.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,n,i=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.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]:A.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(zi(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}kf(A,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Uf=X.forwardRef((r,e)=>{var t=A.getComponentNameFromPanel({props:r});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Uf.displayName="PanelPlaceholder";const te=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 fi(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function Hf(r){return typeof r.id=="string"&&r.layout instanceof jf&&r.panelManager instanceof Ga&&typeof r.registerComponent=="function"}function Kn(r){if(!Hf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function su(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ou(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?su(Object(t),!0).forEach(function(n){pn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):su(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pn(r,e,t){return e=U0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function U0(r){var e=H0(r,"string");return typeof e=="symbol"?e:String(e)}function H0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var bt=B.module("PanelManager");class Ga{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(o,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(o,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};pn(this,"layout",void 0),pn(this,"hydrateComponent",void 0),pn(this,"dehydrateComponent",void 0),pn(this,"onPanelsUpdated",void 0),pn(this,"closed",void 0),pn(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=n,this.onPanelsUpdated=s,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.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 A.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&ur(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=A.getStackForConfig(this.layout.root,{id:e});return(t=n&&A.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var i=t[n];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>fi(n)&&t instanceof n.WrappedComponent||!fi(n)&&t instanceof n))}updatePanel(e){var t=A.getIdFromPanel(e);if(t==null){bt.error("updatePanel Panel did not have an ID",e);return}bt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=A.getIdFromPanel(e);if(t==null){bt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){bt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){bt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}bt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){bt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){bt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){bt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){bt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var a=ou(ou({},e),{},{props:i}),{root:s}=this.layout;A.openComponent({root:s,config:a,replaceConfig:t})}handleDeleted(e){bt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){bt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;A.closeComponent(n,t)}addClosedPanel(e){var t=A.getComponentConfigFromContainer(e);if(t&&ur(t)){var n=this.dehydrateComponent(t.component,t);n!=null&&this.closed.push(n)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}pn(Ga,"MAX_CLOSED_PANEL_COUNT",100);var V0=B.module("PanelErrorBoundary");class Vf 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,n=A.getIdFromContainer(e);V0.debug("componentWillUnmount",n),t.emit(te.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(He,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function lu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ca(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lu(Object(t),!0).forEach(function(n){B0(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):lu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function B0(r,e,t){return e=W0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function W0(r){var e=G0(r,"string");return typeof e=="symbol"?e:String(e)}function G0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function za(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var a={};return n!=null&&(a.metadata=n),i!=null&&(a.panelState=i),Ca(Ca({},r),{},{componentState:null,props:a,type:"react-component"})}function Ka(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Ca(Ca({},r),{},{localDashboardId:e})}function gl(r){var e=fi(r)&&r.WrappedComponent.prototype!=null&&r.WrappedComponent.prototype.isReactComponent!=null||r.prototype!=null&&r.prototype.isReactComponent!=null,t=!fi(r)&&"$$typeof"in r&&r.$$typeof===Jm.ForwardRef;return e||t}const Bf={dehydrate:za,hydrate:Ka};var qa=X.createContext(void 0),z0=_.shape({on:_.func,off:_.func,isHidden:_.bool,tab:_.shape({header:_.shape({tabs:_.arrayOf(_.shape({contentItem:_.shape({})}))})}),title:_.string,setTitle:_.func,close:_.func}),Wf=_.shape({on:_.func,off:_.func,emit:_.func}),K0=_.shape({registerComponent:_.func,root:_.shape({addChild:_.func}),on:_.func,off:_.func,eventHub:Wf}),Ya=Object.freeze({Container:z0,EventHub:Wf,Layout:K0});function ce(r,e,t){c.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}function An(r,e,t,n){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.");X.useEffect(()=>{var s=r(a,e,t,n);return()=>{s()}},[e,n,t,a,r])}function q0(r){var{dashboardProps:e,componentName:t,component:n,supportedTypes:i,hydrate:a,dehydrate:s}=r,{id:o,layout:l,registerComponent:d}=e,h=c.useCallback(v=>{var{dragEvent:f,panelId:p=ye.generate(),widget:m}=v,{name:b,type:g}=m,C=g!=null&&(Array.isArray(i)&&i.includes(g)||g===i);if(C){var y={localDashboardId:o,metadata:m};a!=null&&(y=a(y,o));var S={type:"react-component",component:t,props:y,title:b,id:p},{root:E}=l;A.openComponent({root:E,config:S,dragEvent:f})}},[t,a,o,l,i]);An(d,n,a,s),ce(l.eventHub,te.OPEN,h)}function Y0(){var r=c.useContext(qa);if(r==null)throw new Error("LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?");return r}function du(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function X0(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?du(Object(t),!0).forEach(function(n){Z0(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):du(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Z0(r,e,t){return e=Q0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Q0(r){var e=J0(r,"string");return typeof e=="symbol"?e:String(e)}function J0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var e_=Object.freeze({}),t_=new Map,Gf=r=>r.api,n_=r=>r.user,zf=r=>r.storage,Kf=r=>zf(r).commandHistoryStorage,qf=r=>zf(r).fileStorage,r_=r=>r.defaultWorkspaceSettings,Yf=r=>{var{workspace:e}=r;return e},xi=r=>{for(var e=Yf(r).data.settings,t=X0({},r_(r)),n=Object.keys(e),i=0;i<n.length;i+=1){var a=n[i];e[a]!==void 0&&(t[a]=e[a])}return t},bl=r=>xi(r).timeZone,i_=r=>{var e;return(e=xi(r).defaultNotebookSettings)!==null&&e!==void 0?e:e_},Cl=r=>r.activeTool,a_=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:t_},Xf="SET_ACTIVE_TOOL",s_="SET_API",o_="SET_COMMAND_HISTORY_STORAGE",l_="SET_FILE_STORAGE",d_="SET_PLUGINS",u_="SET_USER",Zf="SET_WORKSPACE",h_="SET_DEFAULT_WORKSPACE_SETTINGS",c_="SET_WORKSPACE_STORAGE",v_="SET_SERVER_CONFIG_VALUES";function uu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Nn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uu(Object(t),!0).forEach(function(n){f_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function f_(r,e,t){return e=p_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function p_(r){var e=m_(r,"string");return typeof e=="symbol"?e:String(e)}function m_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var g_=r=>({type:Zf,payload:r}),b_=r=>(e,t)=>{e(g_(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i.save(r)},Qf=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n,a=Nn(Nn({},n),{},{data:Nn(Nn(Nn({},i),r),{},{settings:Nn(Nn({},i.settings),r.settings)})});return e(b_(a))},C_=r=>e=>e(Qf({settings:r})),Jf=r=>({type:Xf,payload:r});function hu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function _s(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hu(Object(t),!0).forEach(function(n){S_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function S_(r,e,t){return e=y_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function y_(r){var e=E_(r,"string");return typeof e=="symbol"?e:String(e)}function E_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ep(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:{var i=n.payload;return i==null?null:t!=null?_s(_s({},t),i):_s({},i)}default:return t}}}function cu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cu(Object(t),!0).forEach(function(n){w_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function w_(r,e,t){return e=P_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function P_(r){var e=__(r,"string");return typeof e=="symbol"?e:String(e)}function __(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function T_(r){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 n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case r:{var{id:a,payload:s}=i;return t&&Mt({payload:s},{payload:n[a]})?n:vu(vu({},n),{},{[a]:s})}default:return n}}}function On(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:return n.payload;default:return t}}}const O_=On(s_,null),D_=On(Xf,null),I_=On(d_,null),x_=On(o_,null),N_=On(l_,null),M_=On(c_,null),L_=Eo({commandHistoryStorage:x_,fileStorage:N_,workspaceStorage:M_}),F_=ep(u_,null),A_=ep(Zf,null),R_=On(h_,null),j_=On(v_,null);var k_={activeTool:D_,api:O_,plugins:I_,storage:L_,user:F_,workspace:A_,defaultWorkspaceSettings:R_,serverConfigValues:j_};const $_=k_;function fu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fu(Object(t),!0).forEach(function(n){lo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function lo(r,e,t){return e=U_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function U_(r){var e=H_(r,"string");return typeof e=="symbol"?e:String(e)}function H_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class V_{constructor(){lo(this,"reducers",{}),lo(this,"listener",null)}register(e,t){var n;this.reducers=pu(pu({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var B_=new V_;const Xa=B_;var mu=B.module("redux-logger"),W_=r=>e=>t=>{mu.debug("dispatching",t);var n=e(t);return mu.debug("next state",r.getState()),n};const G_=W_;var z_=B.module("redux-crashReporter"),K_=r=>e=>t=>{try{return e(t)}catch(n){throw z_.error("Error executing",t," with state ",r.getState(),":",n),n}};const q_=K_,Y_=[G_,q_,eg];var Ts;Object.entries($_).map(r=>{var[e,t]=r;return Xa.register(e,t)});var X_=(Ts=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&Ts!==void 0?Ts:rg,tp=tg(Eo(Xa.reducers),X_(ng(...Y_)));Xa.setListener(r=>{tp.replaceReducer(Eo(r))});const Z_=tp;var Sl="SET_DASHBOARD_DATA";const Q_=T_(Sl,{},!1),np={dashboardData:Q_};var J_=new Map,rp=Object.freeze({}),eT=Object.freeze([]),ip=r=>r.dashboardData,Be=(r,e)=>{var t;return(t=ip(r)[e])!==null&&t!==void 0?t:rp},ap=(r,e)=>{var t;return(t=Be(r,e).closed)!==null&&t!==void 0?t:eT},yl=(r,e)=>{var t;return(t=Be(r,e).openedMap)!==null&&t!==void 0?t:J_},El=(r,e)=>{var t;return(t=Be(r,e).pluginDataMap)!==null&&t!==void 0?t:rp},sp=(r,e,t)=>El(r,e)[t];function gu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gu(Object(t),!0).forEach(function(n){tT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tT(r,e,t){return e=nT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nT(r){var e=rT(r,"string");return typeof e=="symbol"?e:String(e)}function rT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wl=(r,e)=>({type:Sl,id:r,payload:e}),At=(r,e)=>(t,n)=>t(wl(r,hr(hr({},Be(n(),r)),e))),op=(r,e,t)=>(n,i)=>n(wl(r,hr(hr({},Be(i(),r)),{},{pluginDataMap:hr(hr({},El(i(),r)),{},{[e]:t})})));function iT(r,e){var t=gi(),n=cc(a=>sp(a,r,e)),i=c.useCallback(a=>t(op(r,e,a)),[r,e,t]);return[n,i]}Object.entries(np).map(r=>{var[e,t]=r;return Xa.register(e,t)});function aT(r){var{children:e}=r;return u.jsx(u.Fragment,{children:e})}function bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Kr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bu(Object(t),!0).forEach(function(n){sT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sT(r,e,t){return e=oT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oT(r){var e=lT(r,"string");return typeof e=="symbol"?e:String(e)}function lT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ki=B.module("DashboardLayout"),dT=Object.freeze({}),uT=[],Cu=()=>{},Su=r=>r;function Pl(r){var e,t,{id:n,children:i,emptyDashboard:a=u.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:o=uT,onLayoutChange:l=Cu,onLayoutInitialized:d=Cu,hydrate:h=Ka,dehydrate:v=za,panelWrapper:f=aT}=r,p=gi(),m=(e=cc(P=>Be(P,n)))!==null&&e!==void 0?e:dT,[b,g]=c.useState(!1),[C,y]=c.useState(!1),[S,E]=c.useState(),[w]=c.useState((t=m==null?void 0:m.closed)!==null&&t!==void 0?t:[]),[I,O]=c.useState(!1),[T,N]=c.useState(s.getReactChildren()),R=c.useMemo(()=>new Map,[]),W=c.useMemo(()=>new Map,[]),L=c.useCallback(function(P,j){var U,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:v;Ki.debug2("registerComponent",P,j,Q,me);function $(ie,ve){var Ee=j,Vr=f,Qn=gl(Ee),{glContainer:Br,glEventHub:xn}=ie;return u.jsx(Vf,{glContainer:Br,glEventHub:xn,children:u.jsx(Vr,Kr(Kr({},ie),{},{children:Qn?u.jsx(Ee,Kr(Kr({},ie),{},{ref:ve})):u.jsx(Ee,Kr({},ie))}))})}$.displayName="DashboardWrapper(".concat((U=j.displayName)!==null&&U!==void 0?U:P,")");var J=s.registerComponent(P,X.forwardRef($));return R.set(P,Q),W.set(P,me),J},[h,v,R,W,s,f]),D=c.useCallback((P,j)=>{var U;return((U=R.get(P))!==null&&U!==void 0?U:Su)(j,n)},[R,n]),M=c.useCallback((P,j)=>{var U;return((U=W.get(P))!==null&&U!==void 0?U:Su)(j,n)},[W,n]),F=c.useMemo(()=>new Ga(s,D,M,new Map,w,P=>{var{closed:j,openedMap:U}=P;p(At(n,{closed:j,openedMap:U}))}),[M,p,D,n,w,s]),k=c.useCallback(()=>{if(!C){I||(d(),O(!0));var P=s.toConfig(),j=P.content,U=A.dehydrateLayoutConfig(j,M),Q=S==null||!A.isEqual(S,U);Ki.debug("handleLayoutStateChanged",Q,j,U),Q&&(g(s.root.contentItems.length===0),E(U),l(U),N(s.getReactChildren()))}},[M,I,C,S,s,l,d]),H=c.useCallback(P=>{var j=A.getIdFromContainer(P);s.eventHub.emit(te.DRAGGING,j),y(!0)},[s.eventHub]),q=c.useCallback(P=>{var j=A.getIdFromContainer(P);s.eventHub.emit(te.DROPPED,j),y(!1)},[s.eventHub]),re=c.useCallback(P=>{if(Ki.debug2("handleComponentCreated",P),!(P==null||P.config==null||P.config.component==null||P.element==null)){var j=P.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),U="".concat(j,"-component");P.element.addClass(U)}},[]),V=c.useCallback(()=>{N(s.getReactChildren())},[s]);ce(s,"stateChanged",k),ce(s,"itemPickedUp",H),ce(s,"itemDropped",q),ce(s,"componentCreated",re),ce(s.eventHub,te.TITLE_CHANGED,k),ce(s,"reactChildrenChanged",V);var x=Pc(o);return c.useEffect(function(){if(x!==o&&o!==S){Ki.debug("Setting new layout content...");for(var j=A.hydrateLayoutConfig(o,D);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var U=0;U<j.length;U+=1)s.root.addChild(j[U]);g(s.root.contentItems.length===0)}},[D,s,o,S,F,x]),u.jsxs(u.Fragment,{children:[b&&a,T,X.Children.map(i,P=>P!=null?X.cloneElement(P,{id:n,layout:s,panelManager:F,registerComponent:L}):null)]})}Pl.propTypes={id:_.string.isRequired,children:_.node,data:_.shape({}),emptyDashboard:_.node,layout:Ya.Layout.isRequired,layoutConfig:_.arrayOf(_.shape({})),onLayoutChange:_.func,onLayoutInitialized:_.func};function yu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hT(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yu(Object(t),!0).forEach(function(n){cT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function cT(r,e,t){return e=vT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vT(r){var e=fT(r,"string");return typeof e=="symbol"?e:String(e)}function fT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var pT=100,Os=()=>{},mT=Object.freeze({});function uo(r){var{id:e="default",children:t,emptyDashboard:n,layoutConfig:i,layoutSettings:a=mT,onLayoutConfigChange:s=Os,onGoldenLayoutChange:o=Os,onLayoutInitialized:l=Os,fallbackComponent:d=Uf,hydrate:h,dehydrate:v,panelWrapper:f}=r,p=c.useRef(null),[m,b]=c.useState(!1),[g,C]=c.useState();c.useEffect(function(){if(!p.current){C(void 0);return}var E=hT({},A.makeDefaultLayout());E.settings===void 0&&(E.settings={}),Object.assign(E.settings,a),E.content=[];var w=new jf(E,p.current),I=()=>{w.off("initialised",I),b(!0)};return w.on("initialised",I),d!=null&&w.setFallbackComponent(d),w.init(),C(w),o(w),()=>{w.destroy()}},[a,d,o,b,C]);var y=c.useMemo(()=>bi(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},pT),[g]);return $o(p.current,y),u.jsxs("div",{className:"dashboard-container w-100 h-100",children:[u.jsx("div",{className:"w-100 h-100",ref:p}),m&&g&&u.jsx(qa.Provider,{value:g,children:u.jsx(Pl,{emptyDashboard:n,id:e,layout:g,layoutConfig:i,onLayoutChange:s,onLayoutInitialized:l,hydrate:h,dehydrate:v,panelWrapper:f,children:t})})]})}var _l="default",Tl="CREATE_DASHBOARD";function gT(r,e){r.on(Tl,e)}function bT(r,e){r.emit(Tl,e)}var CT=["id","isActive","plugins"];function Eu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eu(Object(t),!0).forEach(function(n){ST(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Eu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ST(r,e,t){return e=yT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yT(r){var e=ET(r,"string");return typeof e=="symbol"?e:String(e)}function ET(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function wT(r,e){if(r==null)return{};var t=PT(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function PT(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function _T(r){var{id:e,isActive:t,plugins:n}=r,i=wT(r,CT),[a,s]=c.useState(t),o=gi(),l=c.useCallback(d=>{o(e===_l?Qf({layoutConfig:d}):At(e,{layoutConfig:d}))},[e,o]);return!a&&t&&s(!0),a?u.jsx(uo,wu(wu({id:e,onLayoutConfigChange:l},i),{},{children:n})):u.jsx(He,{})}const TT=Object.freeze(Object.defineProperty({__proto__:null,CREATE_DASHBOARD:Tl,DEFAULT_DASHBOARD_ID:_l,Dashboard:uo,DashboardLayout:Pl,DashboardUtils:Bf,GLPropTypes:Ya,LayoutManagerContext:qa,LayoutUtils:A,LazyDashboard:_T,PanelErrorBoundary:Vf,PanelEvent:te,PanelManager:Ga,SET_DASHBOARD_DATA:Sl,assertIsDashboardPluginProps:Kn,canHaveRef:gl,default:uo,dehydrate:za,emitCreateDashboard:bT,getAllDashboardsData:ip,getClosedPanelsForDashboard:ap,getDashboardData:Be,getOpenedPanelMapForDashboard:yl,getPluginDataForDashboard:sp,getPluginDataMapForDashboard:El,hydrate:Ka,isDashboardPluginProps:Hf,isWrappedComponent:fi,listenForCreateDashboard:gT,reducers:np,setDashboardData:wl,setDashboardPluginData:op,updateDashboardData:At,useDashboardPanel:q0,useDashboardPluginData:iT,useLayoutManager:Y0,useListener:ce,usePanelRegistration:An},Symbol.toStringTag,{value:"Module"}));function OT(r){var{type:e}=r,t=Ve();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ne,{icon:To});case t.VariableType.FIGURE:return u.jsx(ne,{icon:_o});case t.VariableType.PANDAS:return u.jsx(ne,{icon:gc});default:return u.jsx(ne,{icon:mc})}}function Pu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function DT(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Pu(a,n,i,s,o,"next",l)}function o(l){Pu(a,n,i,s,o,"throw",l)}s(void 0)})}}function lp(r){var{children:e,language:t}=r,[n,i]=c.useState(null),{activeThemes:a}=jr();return c.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=DT(function*(){if(e!=null&&a!=null){var d=yield jo.colorize(e.toString(),t,{});s||i(d)}}),l.apply(this,arguments)}return o(),()=>{s=!0}},[a,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class IT{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const dp=IT;class Sa{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:ig.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),n="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(i,".").concat(a)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return Sa.isTableType(e,t)||Sa.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const ho=Sa;function up(r){var{children:e}=r;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}up.propTypes={children:_.node.isRequired};function co(r,e,t){return e=xT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xT(r){var e=NT(r,"string");return typeof e=="symbol"?e:String(e)}function NT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class hp extends c.Component{constructor(e){super(e),co(this,"timer",void 0),co(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return u.jsx("div",{className:Y("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(Ma,{className:"ml-2"}),"Running... ",vr.formatElapsedTime(n)," ",u.jsx(K,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:wo,tooltip:"Cancel",onClick:t,disabled:e})]})})}}co(hp,"defaultProps",{disabled:!1});const MT=hp;function li(r,e,t){return e=LT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function LT(r){var e=FT(r,"string");return typeof e=="symbol"?e:String(e)}function FT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dr extends c.PureComponent{constructor(e){super(e),li(this,"mouseX",void 0),li(this,"mouseY",void 0),li(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Dr.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Dr.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;z(n);var i=n.indexOf(`
4
+ `),a=i>-1,s=n;a&&(s=n.slice(0,i));var o=n.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:Y("error-message",{expanded:e}),children:[a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:u.jsx(ne,{icon:e?sr:Gg,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:s}),e?o:""]})]}),!a&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:s})})]},"error")}}li(Dr,"defaultProps",{message:""});li(Dr,"mouseDragThreshold",5);const AT=Dr;function RT(r,e,t){return e=jT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jT(r){var e=kT(r,"string");return typeof e=="symbol"?e:String(e)}function kT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var _u=B.module("ConsoleHistoryItem");class cp extends c.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){_u.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(_u.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,iconForType:i}=this.props,{disabledObjects:a,result:s}=t,o=t.command!=null&&t.command!=="",l=null;o&&(l=u.jsxs("div",{className:"console-history-item-command",children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsx("div",{className:"console-history-content",children:u.jsx(lp,{language:n,children:t.command})})]}));var d=[],h=!1;if(s){var{error:v,message:f,changes:p}=s;if(p){var{created:m,updated:b}=p;[...m,...b].forEach(I=>{h=!0;var{title:O}=I,T="".concat(O),N=e===void 0||e||(a??[]).indexOf(T)>=0,R=u.jsx(K,{kind:"primary",onClick:()=>this.handleObjectClick(I),className:"btn-console-object",disabled:N,icon:i(I.type),children:O},T);d.push(R)})}if(v!=null&&!o){var g,C="".concat((g=v.message)!==null&&g!==void 0?g:v);C||(C=v);var y=u.jsx(AT,{message:C},"result-error");d.push(y)}if(f!==void 0&&f!==""){var S=u.jsx("div",{className:"log-message",children:f},"log-message");d.push(S)}}else{h=!0;var E=u.jsx(MT,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(E)}var w=null;return d.length>0&&(w=u.jsx(up,{children:d})),u.jsxs("div",{className:Y("console-command-result",{"console-result-buttons":h}),children:[l,w]})}}RT(cp,"defaultProps",{disabled:!1});const $T=cp;function UT(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function HT(r){for(var{disabled:e=!1,items:t,language:n,openObject:i,supportsType:a,iconForType:s}=r,o=[],l=0;l<t.length;l+=1){var d=t[l],h=u.jsx($T,{disabled:e,item:d,openObject:i,language:n,supportsType:a,iconForType:s},UT(l,d));o.push(h)}return u.jsx("div",{className:"container-fluid console-history",children:o})}var VT={name:"Console",CLEAR:qe.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[pe.CTRL,fe.L],macShortcut:[pe.CTRL,fe.C]}),FOCUS_HISTORY:qe.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[pe.CTRL,fe.H],macShortcut:[pe.CTRL,pe.OPTION,fe.H]})},BT={name:"Command History",FOCUS_HISTORY:qe.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[pe.CTRL,fe.H],macShortcut:[pe.CTRL,pe.OPTION,fe.H]}),SEND_TO_CONSOLE:qe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]}),SEND_TO_NOTEBOOK:qe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[pe.CTRL,fe.ENTER],macShortcut:[pe.CMD,fe.ENTER]}),RUN:qe.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[pe.ALT,fe.R],macShortcut:[pe.OPTION,fe.R]})},WT={name:"Notebook",RUN:qe.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[pe.ALT,fe.R],macShortcut:[pe.OPTION,fe.R]}),RUN_SELECTED:qe.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[pe.ALT,pe.SHIFT,fe.R],macShortcut:[pe.OPTION,pe.SHIFT,fe.R]}),FIND:qe.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[pe.CTRL,fe.F],macShortcut:[pe.CMD,fe.F],isEditable:!1}),MINIMAP:qe.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[pe.ALT,fe.M],macShortcut:[pe.OPTION,fe.M]}),WORDWRAP:qe.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[pe.ALT,fe.Z],macShortcut:[pe.OPTION,fe.Z]})},GT={CONSOLE:VT,COMMAND_HISTORY:BT,NOTEBOOK:WT};const et=GT,ke=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"});function Ds(r,e,t){return e=zT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zT(r){var e=KT(r,"string");return typeof e=="symbol"?e:String(e)}function KT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Kt=B.module("MonacoCompletionProvider");class Rn extends c.PureComponent{static lspToMonacoKind(e){var t=ki.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),Ds(this,"registeredCompletionProvider",void 0),Ds(this,"registeredSignatureProvider",void 0),Ds(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=ki.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=ki.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=ki.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,n;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(n=this.registeredHoverProvider)===null||n===void 0||n.dispose()}handleCompletionRequest(e,t,n){var{model:i,session:a}=this.props;if(e!==i)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Rn.monacoToLspPosition(t),context:n},o=a.getCompletionItems(s);Kt.debug("Requested completion items",s);var l=o.then(d=>{Kt.debug("Completion items received: ",s,d);var h=d.map(v=>{var{label:f,kind:p,detail:m,documentation:b,sortText:g,filterText:C,textEdit:y,insertTextFormat:S}=v;return{label:f,kind:Rn.lspToMonacoKind(p),detail:m,documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,sortText:g,filterText:C,insertText:y.text,insertTextRules:S===2?4:S,range:Rn.lspToMonacoRange(y.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(Kt.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,i){var a={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:s,session:o}=this.props;if(e!==s||!o.getSignatureHelp)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Rn.monacoToLspPosition(t),context:i},d=o.getSignatureHelp(l);Kt.debug("Requested signature help",l);var h=d.then(v=>{Kt.debug("Signatures received: ",l,d);var f=v.map(m=>{var{label:b,documentation:g,parameters:C}=m;return{documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,label:b,parameters:C??[]}});if(f.length===0)return a;var p=0;return{value:{signatures:f,activeSignature:p,activeParameter:v[p].activeParameter},dispose:()=>{}}}).catch(v=>(Kt.error("There was an error retrieving completion items",v),a));return h}handleHoverRequest(e,t){var{model:n,session:i}=this.props;if(e!==n||!i.getHover)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Rn.monacoToLspPosition(t)},s=i.getHover(a);Kt.debug("Requested hover",a);var o=s.then(l=>{Kt.debug("Hover received: ",a,l);var{contents:d}=l;return{contents:d?[d]:[]}}).catch(l=>(Kt.error("There was an error retrieving hover",l),{contents:[]}));return o}render(){return null}}const vp=Rn;function qT(r){var{children:e}=r,{activeThemes:t}=jr();return c.useEffect(function(){t!=null&&vt.initTheme()},[t]),u.jsx(u.Fragment,{children:e})}function Tu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function YT(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Tu(a,n,i,s,o,"next",l)}function o(l){Tu(a,n,i,s,o,"throw",l)}s(void 0)})}}function dt(r,e,t){return e=XT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XT(r){var e=ZT(r,"string");return typeof e=="symbol"?e:String(e)}function ZT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Is=B.module("ConsoleInput"),ya=parseInt(Jb["line-height"],10),fp=6,pp=6,QT=ya+fp+pp,xs=100;class Ni extends c.PureComponent{constructor(e){super(e),dt(this,"cancelListener",void 0),dt(this,"resizeObserver",void 0),dt(this,"commandContainer",void 0),dt(this,"commandEditor",void 0),dt(this,"commandHistoryIndex",void 0),dt(this,"commandSuggestionContainer",void 0),dt(this,"loadingPromise",void 0),dt(this,"timestamp",void 0),dt(this,"bufferIndex",void 0),dt(this,"history",void 0),dt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=X.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:ya,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(Is.debug("Command received: ",e),!n){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:ya,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:fp,bottom:pp},value:"",wordWrap:"on"},i=this.commandContainer.current;z(i),this.commandEditor=jo.create(i,n),vt.setEOL(this.commandEditor),vt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:o}=this,l=s==null?void 0:s.getPosition();z(l);var{lineNumber:d}=l,h=s==null?void 0:s.getModel();if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){o!=null?this.loadCommand(o+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===(h==null?void 0:h.getLineCount())){o!=null&&o>0?this.loadCommand(o-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(!a.altKey&&!a.shiftKey&&!a.metaKey&&a.keyCode===oi.Enter&&!this.isSuggestionMenuPopulated()){var v;a.stopPropagation(),a.preventDefault();var f=(v=this.commandEditor)===null||v===void 0?void 0:v.getValue().trim();if(f!==void 0){var p;this.processCommand(f),(p=this.commandEditor)===null||p===void 0||p.setValue("")}}}),vt.disableKeyBindings(this.commandEditor,[qc.CtrlCmd|oi.KeyF]),vt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(vt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,n;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(n=t.getDomNode())===null||n===void 0?void 0:n.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(n=t.querySelector(".monaco-list-rows"))===null||n===void 0?void 0:n.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,n,i,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();z(s);var o=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,o);z(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:o}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(a=this.commandEditor)===null||a===void 0||a.focus()}focusEnd(){var e,t,n,i,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();z(s);var o=s.getLineCount(),l=s.getLineLength(o)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(o,l);z(d),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:o,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(a=this.commandEditor)===null||a===void 0||a.focus()}clear(){var e,t,n;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,n;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),a=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(i??a),e!==null&&e>this.history.length-xs&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return YT(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:i}=e.props;e.loadingPromise=Se.makeCancelable(t.getTable(n,i??"",e.timestamp),o=>o.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+xs-1}),e.loadingPromise=Se.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=xs,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...s.items.filter((o,l,d)=>{var{name:h}=o;return l===0||h!==d[l-1].name}).map(o=>{var{name:l}=o;return l}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(o){if(e.loadingPromise=void 0,Se.isCanceled(o)){Is.debug2("Promise canceled, not loading history");return}Is.error("Error fetching history",o)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),z(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;z(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),QT),i=t>n,a={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:n},()=>{var s,o;(s=this.commandEditor)===null||s===void 0||s.updateOptions(a),(o=this.commandEditor)===null||o===void 0||o.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:i,isFocused:a,model:s}=this.state;return u.jsx("div",{className:Y("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:Y("console-input-inner-wrapper",{focus:a}),children:[u.jsx("div",{className:Ni.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),s&&u.jsx(vp,{model:s,language:t,session:n})]})})}}dt(Ni,"defaultProps",{maxHeight:ya*10,scope:null,disabled:!1});dt(Ni,"INPUT_CLASS_NAME","console-input");const Ou=Ni;function Cn(r,e,t){return e=JT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JT(r){var e=eO(r,"string");return typeof e=="symbol"?e:String(e)}function eO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Du="pasted values",tO=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Ns=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Iu=[".zip"];class Vt extends c.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!tO.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ns.some(n=>e.endsWith(n))||t&&Iu.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Du?Yl:e.endsWith(".csv")?zg:e.endsWith(".zip")?Kg:qg}constructor(e){super(e),Cn(this,"fileElem",void 0),Cn(this,"divElem",void 0),Cn(this,"getValidExtensions",se(t=>t?[...Ns,...Iu]:[...Ns])),Cn(this,"getAcceptString",se(t=>this.getValidExtensions(t).join(", "))),Cn(this,"getFileTypeErrorString",se(t=>Ot.join(this.getValidExtensions(t),"or"))),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=X.createRef(),this.divElem=X.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:n,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){n();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();z(a),Vt.isValidExtension(a.name,t)?this.handleFile(a):this.setState({dropError:Vt.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Du,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Yl,action:this.handleMenuPaste,shortcut:Pr.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:i,dropError:a}=this.state,s=t??a,o=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Vt.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(ae,{actions:o}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(s===void 0||s==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:Yg})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(K,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(s===void 0||s==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ne,{icon:Vt.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!n&&u.jsx(K,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Wn,tooltip:"Remove"})]})]})]}),!!s&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:Oo})}),u.jsx("label",{children:s}),s===Vt.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Cn(Vt,"defaultProps",{allowZip:!1,dragError:null});Cn(Vt,"MULTIPLE_FILE_ERROR","Please select only one file");Cn(Vt,"FILE_TYPE_ERROR","Filetype not supported.");const rr=Vt;function qn(r,e,t){return e=nO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nO(r){var e=rO(r,"string");return typeof e=="symbol"?e:String(e)}function rO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dn{}qn(Dn,"INTEGER","int");qn(Dn,"LONG","long");qn(Dn,"DOUBLE","double");qn(Dn,"BOOLEAN","bool");qn(Dn,"STRING","string");qn(Dn,"DATE_TIME","datetime");qn(Dn,"LOCAL_TIME","localtime");const de=Dn;function mp(r,e){var t=r.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(n,i)=>e(i)),t}function xu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Nu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xu(Object(t),!0).forEach(function(n){Xe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Xe(r,e,t){return e=iO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iO(r){var e=aO(r,"string");return typeof e=="symbol"?e:String(e)}function aO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Mu="unknown",sO=2147483647,oO=-2147483648,Lu=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,Fu=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class ze{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case de.STRING:return de.STRING;case de.INTEGER:return ze.checkInteger(e);case de.LONG:return ze.checkLong(e);case de.DOUBLE:return ze.checkDouble(e);case de.BOOLEAN:return ze.checkBoolean(e);case de.DATE_TIME:return ze.checkDateTime(e);case de.LOCAL_TIME:return ze.checkLocalTime(e);default:return ze.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return ze.isNotParsableNumber(t)?de.STRING:ze.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return ze.isNotParsableNumber(t)?de.STRING:t.includes(".")?de.DOUBLE:de.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return ze.isNotParsableNumber(t)?de.STRING:de.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?de.BOOLEAN:de.STRING}static checkDateTime(e){return Lu.test(e)?de.DATE_TIME:de.STRING}static checkLocalTime(e){return Fu.test(e)?de.LOCAL_TIME:de.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(ze.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?de.BOOLEAN:Lu.test(e)&&e.includes(":")?de.DATE_TIME:Fu.test(e)?de.LOCAL_TIME:de.STRING}return ze.getNumberType(t)}static getNumberType(e){if(e.includes("."))return de.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return de.LONG;var n=parseInt(e,10);return n>sO||n<oO?de.LONG:de.INTEGER}constructor(e,t,n,i,a,s,o,l,d,h){Xe(this,"onFileCompleted",void 0),Xe(this,"file",void 0),Xe(this,"readHeaders",void 0),Xe(this,"nullString",void 0),Xe(this,"onProgress",void 0),Xe(this,"onError",void 0),Xe(this,"types",void 0),Xe(this,"chunks",void 0),Xe(this,"totalChunks",void 0),Xe(this,"rowCount",void 0),Xe(this,"isZip",void 0),Xe(this,"shouldTrim",void 0),Xe(this,"zipProgress",void 0),Xe(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=a,this.onProgress=s,this.onError=o,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Nu(Nu({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)ai.parse(this.file,this.config);else{var e=mp(this.file,this.handleNodeUpdate);ai.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(Mu),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,z(this.types);var i=[...this.types];n.forEach(o=>{if(o.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=ze.determineType(this.shouldTrim?o[l].trim():o[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
5
5
  Expected length `.concat(i.length," but found ").concat(o.length,`.
6
- Row = `).concat(o))}),this.chunks+=1;var a=0;this.totalChunks>0?a=Math.round(this.chunks/this.totalChunks*50):a=Math.round(this.zipProgress/2);var s=this.onProgress(a);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:n}=this;z(t),(e==null||!e.meta.aborted)&&n(t.map(i=>i===Mu||i===de.LOCAL_TIME?de.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const oO=ze;function ge(r,e,t){return e=lO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lO(r){var e=dO(r,"string");return typeof e=="symbol"?e:String(e)}function dO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qi=B.module("CsvParser"),uO=650;class Ir{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(Ir.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor(e){var{onFileCompleted:t,session:n,file:i,type:a,readHeaders:s=!0,onProgress:o,onError:l,timeZone:d,isZip:h}=e;ge(this,"onFileCompleted",void 0),ge(this,"session",void 0),ge(this,"file",void 0),ge(this,"isZip",void 0),ge(this,"type",void 0),ge(this,"readHeaders",void 0),ge(this,"timeZone",void 0),ge(this,"onProgress",void 0),ge(this,"onError",void 0),ge(this,"tables",void 0),ge(this,"headers",void 0),ge(this,"types",void 0),ge(this,"rowCount",void 0),ge(this,"rowsProcessed",void 0),ge(this,"chunks",void 0),ge(this,"totalChunks",void 0),ge(this,"isComplete",void 0),ge(this,"zipProgress",void 0),ge(this,"consolidatedChunks",void 0),ge(this,"numConsolidated",void 0),ge(this,"isCancelled",void 0),ge(this,"config",void 0),this.onFileCompleted=t,this.session=n,this.file=i,this.isZip=h,this.type=a,this.readHeaders=s,this.timeZone=d,this.onProgress=o,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(i.size/ai.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:a.delimiter,newline:a.newline,escapeChar:a.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:a.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var n=t.length,i=new Array(e).fill(null).map(()=>new Array(n)),a=0;a<n;a+=1){var s=t[a];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
7
- `).concat(s));for(var o=0;o<e;o+=1){var l=this.type.shouldTrim?t[a][o].trim():t[a][o];i[o][a]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(n,i)=>{if(this.types=n,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)ai.parse(this.file,this.config);else{var a=mp(this.file,this.handleNodeUpdate);ai.parse(a,this.config),a.resume()}},t=new oO(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:n,onError:i,handleCreateTable:a,isZip:s,tables:o}=this;if(this.isCancelled){qi.debug2("CSV parser cancelled."),t.abort(),o.forEach(c=>c.close());return}var{data:l}=e;this.headers||(n?(this.headers=Vc.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Ir.generateHeaders(l[0].length));var d=[];try{if(d=this.transpose(this.headers.length,l),s)this.consolidateChunks(d,t);else{var h=this.chunks;this.chunks+=1,a(h,d,t)}}catch(c){i(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=uO||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:n}=this,i=this.chunks;this.chunks+=1;var a=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,z(a),n(i,a,e)}handleCreateTable(e,t,n){var{session:i,tables:a,onFileCompleted:s,totalChunks:o,types:l,onProgress:d,onError:h}=this;n&&n.pause(),z(this.headers),z(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(c=>{if(this.isCancelled){qi.debug2("CSV parser cancelled."),n&&n.abort(),a.forEach(p=>p.close());return}n&&n.resume(),a[e]=c;var f=0;o>0?f=Math.round(a.length/o*50)+50:f=Math.round(this.rowsProcessed/this.rowCount*50)+50,qi.debug2("CSV parser progress ".concat(f)),d(f),this.isComplete&&a.length===this.chunks&&(qi.debug2("CSV parser complete."),s(a))}).catch(c=>{!this.isComplete&&n&&n.abort(),h(c)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}ge(Ir,"generateHeaders",r=>{for(var e=[],t=0;t<r;t+=1)e.push(Ir.generateHeaderRecursive(t));return e});const hO=Ir;function Ol(r,e,t){return e=cO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cO(r){var e=vO(r,"string");return typeof e=="symbol"?e:String(e)}function vO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Za{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Ol(Za,"DEFAULT_TYPE","DEFAULT_CSV");Ol(Za,"AUTO","AUTODETECT");Ol(Za,"TYPES",Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
6
+ Row = `).concat(o))}),this.chunks+=1;var a=0;this.totalChunks>0?a=Math.round(this.chunks/this.totalChunks*50):a=Math.round(this.zipProgress/2);var s=this.onProgress(a);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:n}=this;z(t),(e==null||!e.meta.aborted)&&n(t.map(i=>i===Mu||i===de.LOCAL_TIME?de.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const lO=ze;function ge(r,e,t){return e=dO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dO(r){var e=uO(r,"string");return typeof e=="symbol"?e:String(e)}function uO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qi=B.module("CsvParser"),hO=650;class Ir{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(Ir.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor(e){var{onFileCompleted:t,session:n,file:i,type:a,readHeaders:s=!0,onProgress:o,onError:l,timeZone:d,isZip:h}=e;ge(this,"onFileCompleted",void 0),ge(this,"session",void 0),ge(this,"file",void 0),ge(this,"isZip",void 0),ge(this,"type",void 0),ge(this,"readHeaders",void 0),ge(this,"timeZone",void 0),ge(this,"onProgress",void 0),ge(this,"onError",void 0),ge(this,"tables",void 0),ge(this,"headers",void 0),ge(this,"types",void 0),ge(this,"rowCount",void 0),ge(this,"rowsProcessed",void 0),ge(this,"chunks",void 0),ge(this,"totalChunks",void 0),ge(this,"isComplete",void 0),ge(this,"zipProgress",void 0),ge(this,"consolidatedChunks",void 0),ge(this,"numConsolidated",void 0),ge(this,"isCancelled",void 0),ge(this,"config",void 0),this.onFileCompleted=t,this.session=n,this.file=i,this.isZip=h,this.type=a,this.readHeaders=s,this.timeZone=d,this.onProgress=o,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(i.size/ai.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:a.delimiter,newline:a.newline,escapeChar:a.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:a.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var n=t.length,i=new Array(e).fill(null).map(()=>new Array(n)),a=0;a<n;a+=1){var s=t[a];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
7
+ `).concat(s));for(var o=0;o<e;o+=1){var l=this.type.shouldTrim?t[a][o].trim():t[a][o];i[o][a]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(n,i)=>{if(this.types=n,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)ai.parse(this.file,this.config);else{var a=mp(this.file,this.handleNodeUpdate);ai.parse(a,this.config),a.resume()}},t=new lO(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:n,onError:i,handleCreateTable:a,isZip:s,tables:o}=this;if(this.isCancelled){qi.debug2("CSV parser cancelled."),t.abort(),o.forEach(v=>v.close());return}var{data:l}=e;this.headers||(n?(this.headers=Vc.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Ir.generateHeaders(l[0].length));var d=[];try{if(d=this.transpose(this.headers.length,l),s)this.consolidateChunks(d,t);else{var h=this.chunks;this.chunks+=1,a(h,d,t)}}catch(v){i(v)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=hO||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:n}=this,i=this.chunks;this.chunks+=1;var a=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,z(a),n(i,a,e)}handleCreateTable(e,t,n){var{session:i,tables:a,onFileCompleted:s,totalChunks:o,types:l,onProgress:d,onError:h}=this;n&&n.pause(),z(this.headers),z(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(v=>{if(this.isCancelled){qi.debug2("CSV parser cancelled."),n&&n.abort(),a.forEach(p=>p.close());return}n&&n.resume(),a[e]=v;var f=0;o>0?f=Math.round(a.length/o*50)+50:f=Math.round(this.rowsProcessed/this.rowCount*50)+50,qi.debug2("CSV parser progress ".concat(f)),d(f),this.isComplete&&a.length===this.chunks&&(qi.debug2("CSV parser complete."),s(a))}).catch(v=>{!this.isComplete&&n&&n.abort(),h(v)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}ge(Ir,"generateHeaders",r=>{for(var e=[],t=0;t<r;t+=1)e.push(Ir.generateHeaderRecursive(t));return e});const cO=Ir;function Ol(r,e,t){return e=vO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vO(r){var e=fO(r,"string");return typeof e=="symbol"?e:String(e)}function fO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Za{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Ol(Za,"DEFAULT_TYPE","DEFAULT_CSV");Ol(Za,"AUTO","AUTODETECT");Ol(Za,"TYPES",Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
8
8
  `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
9
9
  `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
10
10
  `,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
11
- `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}}));const ei=Za;function gp(r,e,t){return e=fO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fO(r){var e=pO(r,"string");return typeof e=="symbol"?e:String(e)}function pO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Au=B.module("CsvInputBar"),mO=Object.entries(ei.TYPES).map(r=>{var[e,t]=r;return u.jsx("option",{value:e,children:t.name},e)});class bp extends v.Component{constructor(e){super(e),gp(this,"inputRef",void 0),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=X.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:ei.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:n}=this.props,{tableName:i,tableNameSet:a}=this.state;if(!a&&t!=null&&!i){var s,o=t.name.lastIndexOf("."),l=Vc.legalizeTableName(t.name.substring(0,o));this.setState({tableName:l,tableNameSet:!0}),(s=this.inputRef.current)===null||s===void 0||s.focus()}else(t==null&&e.file!=null||n==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});n!=null&&n!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:ei.fromExtension(t.name)}):n!=null&&n!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:ei.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:n}=this.props;Au.error(e),n(e),t()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){var{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();var{file:t,paste:n}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):n!==void 0&&n!==""&&this.handleFile(new Blob([n],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Au.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:n,timeZone:i,onInProgress:a}=this.props,{tableName:s,isFirstRowHeaders:o,type:l}=this.state,d=c=>{c.length===1?n.bindTableToVariable(c[0],s).then(()=>this.openTable()).catch(f=>this.handleError(f)):n.mergeTables(c).then(f=>{n.bindTableToVariable(f,s).then(()=>this.openTable()).catch(p=>this.handleError(p)),c.forEach(p=>p.close())}).catch(f=>this.handleError(f))},h=new hO({onFileCompleted:d,session:n,file:e,type:ei.TYPES[l],readHeaders:o,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});h.parse(),this.setState({showProgress:!0,parser:h}),a(!0)}handleZipFile(e){var{onUpdate:t,unzip:n}=this.props;if(n==null){this.handleError(new Error("No support for zip files available."));return}n(e).then(i=>{for(var a=!1,s=0;s<i.length;s+=1){var o=i[s];if(rr.isValidExtension(o.name)){t("Loading ".concat(o.name," as csv from ").concat(e.name)),a=!0,this.handleFile(o,!0);break}}if(!a)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}handleProgress(e){var{showProgress:t}=this.state;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var{onInProgress:e}=this.props,{parser:t}=this.state;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var{onOpenTable:e,onClose:t}=this.props,{tableName:n}=this.state;e(n),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:n,isFirstRowHeaders:i,showProgress:a,progressValue:s,type:o}=this.state,l=!!t&&!n;return u.jsxs("div",{className:"csv-input-bar",children:[!a&&u.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),u.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:Y("form-control",{"is-invalid":l}),value:n,onChange:this.handleTableName})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"formatSelect",children:"File format"}),u.jsx(Bn,{id:"formatSelect",className:"custom-select",value:o,onChange:this.handleQueryTypeChange,children:mO})]}),u.jsx(ha,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),u.jsxs("div",{className:"csv-input-buttons form-group",children:[u.jsx(K,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!n,children:"Upload"})]})]}),a&&u.jsxs("div",{className:"csv-progress-container",children:[u.jsx("label",{children:"Uploading Table"}),u.jsx("div",{className:"progress",children:u.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(s,"%")},"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100})}),u.jsxs("label",{children:[s,"%"]}),u.jsx(K,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}gp(bp,"defaultProps",{file:null,paste:null,unzip:null});const gO=bp;function Yi(r,e,t){return e=bO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bO(r){var e=CO(r,"string");return typeof e=="symbol"?e:String(e)}function CO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ru=B.module("ConsoleMenu");class Ea extends v.PureComponent{static makeItemActions(e,t,n,i,a){if(e.length===0)return[];var s={menuElement:u.jsx(Ei,{value:t,onChange:i,className:"console-menu",ref:n})},o=e;t&&(o=o.filter(d=>{var{title:h}=d;return h!=null&&h.toLowerCase().indexOf(t.toLowerCase())>=0}));var l=o.map(d=>({title:d.title,action:()=>{a(d)}}));return[s,...l]}constructor(e){super(e),Yi(this,"tableSearchField",void 0),Yi(this,"widgetSearchField",void 0),Yi(this,"makeTableActions",se((t,n,i)=>{var{dh:a}=this.props,s=t.filter(o=>ho.isTableType(a,o.type));return Ea.makeItemActions(s,n,o=>{this.tableSearchField=o},this.handleTableFilterChange,i)})),Yi(this,"makeWidgetActions",se((t,n,i)=>{var{dh:a}=this.props,s=t.filter(o=>ho.isWidgetType(a,o.type));return Ea.makeItemActions(s,n,o=>{this.widgetSearchField=o},this.handleWidgetFilterChange,i)})),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}handleTableFilterChange(e){Ru.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)===null||e===void 0||e.focus()}handleWidgetFilterChange(e){Ru.debug("filtering widgets..."),this.setState({widgetFilterText:e.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var e;(e=this.widgetSearchField)===null||e===void 0||e.focus()}render(){var{overflowActions:e,objects:t,openObject:n}=this.props,{tableFilterText:i,widgetFilterText:a}=this.state,s=this.makeTableActions(t,i,n),o=this.makeWidgetActions(t,a,n),l={placement:"bottom-end"},d=s.length===0,h=o.length===0;return u.jsxs(u.Fragment,{children:[u.jsx(K,{"aria-label":"Tables",kind:"ghost",disabled:d,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:To,icon:sr,transform:"right-5 down-5"}),u.jsx(ne,{icon:sr,transform:"right-8 down-6"})]}),tooltip:d?"No tables available":"Tables",children:u.jsx(En,{actions:s,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions ")}),u.jsx(K,{"aria-label":"Widgets",kind:"ghost",disabled:o.length===0,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:_o,icon:sr,transform:"right-5 down-5"}),u.jsx(ne,{icon:sr,transform:"right-8 down-6"})]}),tooltip:h?"No widgets available":"Widgets",children:u.jsx(En,{actions:o,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions")}),u.jsx(K,{kind:"ghost",icon:bc,tooltip:"More Actions...","aria-label":"More Actions...",onClick:()=>{},children:u.jsx(En,{actions:e,popperOptions:l})})]})}}const SO=Ea;function Cp(r,e,t){return e=yO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yO(r){var e=EO(r,"string");return typeof e=="symbol"?e:String(e)}function EO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Sp extends v.PureComponent{constructor(e){super(e),Cp(this,"pending",void 0),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Tn,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(e){var{result:t}=e.detail;this.pending.add(t).then(()=>this.handleCommandCompleted(null)).catch(n=>this.handleCommandCompleted(n)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof kc||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){var{children:e,dh:t,openObject:n,overflowActions:i,objects:a}=this.props,{isDisconnected:s,isCommandRunning:o}=this.state,l=null,d=null;return s?(l="console-status-icon-disconnected",d="Worker is disconnected"):o?(l="console-status-icon-pending",d="Worker is busy"):(l="console-status-icon-idle",d="Worker is idle"),u.jsxs("div",{className:"console-pane-status-bar",children:[u.jsxs("div",{children:[u.jsx("div",{className:Y("console-status-icon",l)}),u.jsx(wt,{children:d})]}),e,u.jsx(SO,{dh:t,overflowActions:i,openObject:n,objects:a})]})}}Cp(Sp,"defaultProps",{children:null});const wO=Sp;function ju(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Tt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ju(Object(t),!0).forEach(function(n){yt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ju(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yt(r,e,t){return e=PO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PO(r){var e=_O(r,"string");return typeof e=="symbol"?e:String(e)}function _O(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Rt=B.module("Console"),ku={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function TO(){return!0}function OO(r){return u.jsx(u.Fragment,{})}class yn extends v.PureComponent{static isErrorLevel(e){return e===ke.STDERR||e===ke.ERROR||e===ke.FATAL}static isOutputLevel(e){return e===ke.STDOUT||yn.isErrorLevel(e)}constructor(e){super(e),yt(this,"cancelListener",void 0),yt(this,"consolePane",void 0),yt(this,"consoleInput",void 0),yt(this,"consoleHistoryScrollPane",void 0),yt(this,"pending",void 0),yt(this,"queuedLogMessages",void 0),yt(this,"processLogMessageQueue",bi(()=>{this.scrollConsoleHistoryToBottom(),this.setState(i=>{Rt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:a}=i;return a=a.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:a}})},yn.LOG_THROTTLE)),yt(this,"getObjects",se(i=>[...i.values()])),yt(this,"getContextActions",se(i=>[...i,{action:this.handleClearShortcut,shortcut:et.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:et.CONSOLE.FOCUS_HISTORY}])),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=X.createRef(),this.consoleInput=X.createRef(),this.consoleHistoryScrollPane=X.createRef(),this.pending=new Tn,this.queuedLogMessages=[];var{objectMap:t,settings:n}=this.props;this.state=Tt(Tt({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1},ku),n)}componentDidMount(){this.initConsoleLogging();var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){var{props:n,state:i}=this;this.sendSettingsChange(t,i),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:n}=e.detail,i=this.pending.add(n),a={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:i},{commandHistoryStorage:s,language:o,scope:l}=this.props,d=s.addItem(o,l,t,{command:t,startTime:new Date().toJSON()});d.catch(h=>{Rt.debug("Error adding workspace item",h)}),this.setState(h=>({consoleHistory:h.consoleHistory.concat(a)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),i.then(h=>{this.handleCommandResult(h,a,d)}).catch(h=>{this.handleCommandError(h,a,d)})}handleCommandResult(e,t,n){var i=Tt(Tt({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(a=>{var{consoleHistory:s}=a,o=s.lastIndexOf(t);if(o<0)return Rt.error("historyItem not found in consoleHistory"),null;var l=s.concat();return l[o]=i,{consoleHistory:l}}),e&&(this.updateHistory(e,i),this.updateKnownObjects(i),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Se.isCanceled(e)){Rt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},n),this.setState(i=>{var a=i.consoleHistory.concat(),s=a.lastIndexOf(t),o=Tt({},t);return o.wrappedResult=void 0,o.cancelResult=void 0,o.endTime=Date.now(),o.result={error:e},a[s]=o,{consoleHistory:a}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&yn.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var n={};yn.isErrorLevel(t)?n.error=e:n.message=e;var i={command:void 0,result:n};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){Rt.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:n}=this.props;[...e.created,...e.updated].forEach(i=>n(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:n}=e;n.forEach(i=>t(i))}}updateHistory(e,t){var n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(i=>{var a=i.consoleHistory.concat();return{consoleHistory:a}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){Rt.debug2("updateKnownObjects no changes");return}this.setState(n=>{var i,a,s,{consoleHistory:o}=n,l=o.lastIndexOf(e);if(l<0)return Rt.error("historyItem not found in state.consoleHistory"),null;var d=new Map(n.objectHistoryMap),h=new Map(n.objectMap),c=function(p){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:b}=p;z(b);var g=d.get(b);if(g!=null&&g>=0){var C;o===n.consoleHistory&&(o=o.concat());var y=Tt(Tt({},o[g]),{},{disabledObjects:[...(C=o[g].disabledObjects)!==null&&C!==void 0?C:[],b]});o[g]=y}d.set(b,l),m?h.delete(b):h.set(b,p)};return(i=t)===null||i===void 0||i.updated.forEach(f=>c(f)),(a=t)===null||a===void 0||a.removed.forEach(f=>c(f,!0)),(s=t)===null||s===void 0||s.created.forEach(f=>{var{title:p}=f;z(p),d.set(p,l),h.set(p,f)}),{objectHistoryMap:d,objectMap:h,consoleHistory:o}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var n=this.pending.add(t),i=new Date().toJSON();n.then(a=>{var s=Tt(Tt({},a),{},{data:Tt(Tt({},a.data),{},{endTime:i,result:e})}),{commandHistoryStorage:o,language:l}=this.props;o.updateItem(l,s).catch(d=>{Rt.warn("Error updating command history storage",d)})}).catch(a=>{Rt.debug("Error updating workspace history item",a)})}scrollConsoleHistoryToBottom(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.consoleHistoryScrollPane.current;z(t),!(!e&&Math.abs(t.scrollHeight-t.clientHeight-t.scrollTop)>=1)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;z(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")){e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});var{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:rr.MULTIPLE_FILE_ERROR});return}var n=t[0];rr.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:rr.FILE_TYPE_ERROR})}}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){var{dh:t,openObject:n,commandHistoryStorage:i,language:a,scope:s}=this.props,{consoleHistory:o,objectMap:l}=this.state,d={name:e,title:e,type:t.VariableType.TABLE},h=l.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[h?"updated":"created"]:[d]}}},f=o.concat(c);this.setState({consoleHistory:f}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),n({name:e,title:e,type:t.VariableType.TABLE}),i.addItem(a,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:n}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},a=n.concat(i);this.setState({consoleHistory:a})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ae.groups.high,icon:n?cr:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ae.groups.high,icon:e?cr:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ae.groups.high,icon:t?cr:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ae.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var{session:t}=this.props;t.runCode(e).catch(i=>{Rt.error("There was an error initiating the command",i)})}else{var n={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(i=>({consoleHistory:i.consoleHistory.concat(n)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(ku),a={},s=!1,o=0;o<i.length;o+=1){var l=i[o],{[l]:d}=t,{[l]:h}=e;d!==h&&(s=!0),a[l]=d}if(!(n&&!s)){var{onSettingsChange:c}=this.props;c(a)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var{actions:e,dh:t,historyChildren:n,language:i,statusBarChildren:a,openObject:s,session:o,scope:l,commandHistoryStorage:d,timeZone:h,disabled:c,unzip:f,supportsType:p,iconForType:m}=this.props,{consoleHeight:b,consoleHistory:g,isScrollDecorationShown:C,objectMap:y,showCsvOverlay:S,csvFile:E,csvPaste:w,dragError:I,csvUploadInProgress:O}=this.state,T=this.getObjects(y),N=Math.round(b*.7),R=this.getContextActions(e);return u.jsxs("div",{role:"presentation",className:Y("iris-console","h-100","w-100",{disabled:c}),children:[u.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[u.jsx(wO,{dh:t,session:o,overflowActions:this.handleOverflowActions,openObject:s,objects:T,children:a}),u.jsxs("div",{className:"console-csv-container",onDragOver:rr.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[S&&u.jsx(rr,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:I,onError:this.handleCsvError,uploadInProgress:O,allowZip:f!=null}),u.jsxs("div",{role:"presentation",className:Y("scroll-pane no-scroll-x",{"scroll-decoration":C}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[u.jsx(UT,{items:g,openObject:s,language:i,disabled:c,supportsType:p,iconForType:m}),n]})]}),!S&&u.jsx(Ou,{ref:this.consoleInput,session:o,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:N,commandHistoryStorage:d}),S&&u.jsx(gO,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:E??void 0,paste:w??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),u.jsx(ae,{actions:R,ignoreClassNames:[Ou.INPUT_CLASS_NAME]})]})}}yt(yn,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:TO,iconForType:OO});yt(yn,"LOG_THROTTLE",500);const DO=yn;var IO={groovy:"Groovy",python:"Python",scala:"Scala"};class xO{static normalizeScriptLanguage(e){return IO[e]||null}static getDisabledRunTooltip(e,t,n,i){return e?t?null:"".concat(n," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
11
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}}));const ei=Za;function gp(r,e,t){return e=pO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pO(r){var e=mO(r,"string");return typeof e=="symbol"?e:String(e)}function mO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Au=B.module("CsvInputBar"),gO=Object.entries(ei.TYPES).map(r=>{var[e,t]=r;return u.jsx("option",{value:e,children:t.name},e)});class bp extends c.Component{constructor(e){super(e),gp(this,"inputRef",void 0),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=X.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:ei.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:n}=this.props,{tableName:i,tableNameSet:a}=this.state;if(!a&&t!=null&&!i){var s,o=t.name.lastIndexOf("."),l=Vc.legalizeTableName(t.name.substring(0,o));this.setState({tableName:l,tableNameSet:!0}),(s=this.inputRef.current)===null||s===void 0||s.focus()}else(t==null&&e.file!=null||n==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});n!=null&&n!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:ei.fromExtension(t.name)}):n!=null&&n!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:ei.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:n}=this.props;Au.error(e),n(e),t()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){var{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();var{file:t,paste:n}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):n!==void 0&&n!==""&&this.handleFile(new Blob([n],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Au.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:n,timeZone:i,onInProgress:a}=this.props,{tableName:s,isFirstRowHeaders:o,type:l}=this.state,d=v=>{v.length===1?n.bindTableToVariable(v[0],s).then(()=>this.openTable()).catch(f=>this.handleError(f)):n.mergeTables(v).then(f=>{n.bindTableToVariable(f,s).then(()=>this.openTable()).catch(p=>this.handleError(p)),v.forEach(p=>p.close())}).catch(f=>this.handleError(f))},h=new cO({onFileCompleted:d,session:n,file:e,type:ei.TYPES[l],readHeaders:o,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});h.parse(),this.setState({showProgress:!0,parser:h}),a(!0)}handleZipFile(e){var{onUpdate:t,unzip:n}=this.props;if(n==null){this.handleError(new Error("No support for zip files available."));return}n(e).then(i=>{for(var a=!1,s=0;s<i.length;s+=1){var o=i[s];if(rr.isValidExtension(o.name)){t("Loading ".concat(o.name," as csv from ").concat(e.name)),a=!0,this.handleFile(o,!0);break}}if(!a)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}handleProgress(e){var{showProgress:t}=this.state;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var{onInProgress:e}=this.props,{parser:t}=this.state;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var{onOpenTable:e,onClose:t}=this.props,{tableName:n}=this.state;e(n),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:n,isFirstRowHeaders:i,showProgress:a,progressValue:s,type:o}=this.state,l=!!t&&!n;return u.jsxs("div",{className:"csv-input-bar",children:[!a&&u.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),u.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:Y("form-control",{"is-invalid":l}),value:n,onChange:this.handleTableName})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"formatSelect",children:"File format"}),u.jsx(Bn,{id:"formatSelect",className:"custom-select",value:o,onChange:this.handleQueryTypeChange,children:gO})]}),u.jsx(ha,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),u.jsxs("div",{className:"csv-input-buttons form-group",children:[u.jsx(K,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!n,children:"Upload"})]})]}),a&&u.jsxs("div",{className:"csv-progress-container",children:[u.jsx("label",{children:"Uploading Table"}),u.jsx("div",{className:"progress",children:u.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(s,"%")},"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100})}),u.jsxs("label",{children:[s,"%"]}),u.jsx(K,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}gp(bp,"defaultProps",{file:null,paste:null,unzip:null});const bO=bp;function Yi(r,e,t){return e=CO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function CO(r){var e=SO(r,"string");return typeof e=="symbol"?e:String(e)}function SO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ru=B.module("ConsoleMenu");class Ea extends c.PureComponent{static makeItemActions(e,t,n,i,a){if(e.length===0)return[];var s={menuElement:u.jsx(Ei,{value:t,onChange:i,className:"console-menu",ref:n})},o=e;t&&(o=o.filter(d=>{var{title:h}=d;return h!=null&&h.toLowerCase().indexOf(t.toLowerCase())>=0}));var l=o.map(d=>({title:d.title,action:()=>{a(d)}}));return[s,...l]}constructor(e){super(e),Yi(this,"tableSearchField",void 0),Yi(this,"widgetSearchField",void 0),Yi(this,"makeTableActions",se((t,n,i)=>{var{dh:a}=this.props,s=t.filter(o=>ho.isTableType(a,o.type));return Ea.makeItemActions(s,n,o=>{this.tableSearchField=o},this.handleTableFilterChange,i)})),Yi(this,"makeWidgetActions",se((t,n,i)=>{var{dh:a}=this.props,s=t.filter(o=>ho.isWidgetType(a,o.type));return Ea.makeItemActions(s,n,o=>{this.widgetSearchField=o},this.handleWidgetFilterChange,i)})),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}handleTableFilterChange(e){Ru.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)===null||e===void 0||e.focus()}handleWidgetFilterChange(e){Ru.debug("filtering widgets..."),this.setState({widgetFilterText:e.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var e;(e=this.widgetSearchField)===null||e===void 0||e.focus()}render(){var{overflowActions:e,objects:t,openObject:n}=this.props,{tableFilterText:i,widgetFilterText:a}=this.state,s=this.makeTableActions(t,i,n),o=this.makeWidgetActions(t,a,n),l={placement:"bottom-end"},d=s.length===0,h=o.length===0;return u.jsxs(u.Fragment,{children:[u.jsx(K,{"aria-label":"Tables",kind:"ghost",disabled:d,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:To,icon:sr,transform:"right-5 down-5"}),u.jsx(ne,{icon:sr,transform:"right-8 down-6"})]}),tooltip:d?"No tables available":"Tables",children:u.jsx(En,{actions:s,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions ")}),u.jsx(K,{"aria-label":"Widgets",kind:"ghost",disabled:o.length===0,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:_o,icon:sr,transform:"right-5 down-5"}),u.jsx(ne,{icon:sr,transform:"right-8 down-6"})]}),tooltip:h?"No widgets available":"Widgets",children:u.jsx(En,{actions:o,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions")}),u.jsx(K,{kind:"ghost",icon:bc,tooltip:"More Actions...","aria-label":"More Actions...",onClick:()=>{},children:u.jsx(En,{actions:e,popperOptions:l})})]})}}const yO=Ea;function Cp(r,e,t){return e=EO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function EO(r){var e=wO(r,"string");return typeof e=="symbol"?e:String(e)}function wO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Sp extends c.PureComponent{constructor(e){super(e),Cp(this,"pending",void 0),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Tn,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(e){var{result:t}=e.detail;this.pending.add(t).then(()=>this.handleCommandCompleted(null)).catch(n=>this.handleCommandCompleted(n)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof kc||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){var{children:e,dh:t,openObject:n,overflowActions:i,objects:a}=this.props,{isDisconnected:s,isCommandRunning:o}=this.state,l=null,d=null;return s?(l="console-status-icon-disconnected",d="Worker is disconnected"):o?(l="console-status-icon-pending",d="Worker is busy"):(l="console-status-icon-idle",d="Worker is idle"),u.jsxs("div",{className:"console-pane-status-bar",children:[u.jsxs("div",{children:[u.jsx("div",{className:Y("console-status-icon",l)}),u.jsx(wt,{children:d})]}),e,u.jsx(yO,{dh:t,overflowActions:i,openObject:n,objects:a})]})}}Cp(Sp,"defaultProps",{children:null});const PO=Sp;function ju(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Tt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ju(Object(t),!0).forEach(function(n){yt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ju(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yt(r,e,t){return e=_O(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _O(r){var e=TO(r,"string");return typeof e=="symbol"?e:String(e)}function TO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Rt=B.module("Console"),ku={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function OO(){return!0}function DO(r){return u.jsx(u.Fragment,{})}class yn extends c.PureComponent{static isErrorLevel(e){return e===ke.STDERR||e===ke.ERROR||e===ke.FATAL}static isOutputLevel(e){return e===ke.STDOUT||yn.isErrorLevel(e)}constructor(e){super(e),yt(this,"cancelListener",void 0),yt(this,"consolePane",void 0),yt(this,"consoleInput",void 0),yt(this,"consoleHistoryScrollPane",void 0),yt(this,"pending",void 0),yt(this,"queuedLogMessages",void 0),yt(this,"processLogMessageQueue",bi(()=>{this.scrollConsoleHistoryToBottom(),this.setState(i=>{Rt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:a}=i;return a=a.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:a}})},yn.LOG_THROTTLE)),yt(this,"getObjects",se(i=>[...i.values()])),yt(this,"getContextActions",se(i=>[...i,{action:this.handleClearShortcut,shortcut:et.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:et.CONSOLE.FOCUS_HISTORY}])),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=X.createRef(),this.consoleInput=X.createRef(),this.consoleHistoryScrollPane=X.createRef(),this.pending=new Tn,this.queuedLogMessages=[];var{objectMap:t,settings:n}=this.props;this.state=Tt(Tt({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1},ku),n)}componentDidMount(){this.initConsoleLogging();var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){var{props:n,state:i}=this;this.sendSettingsChange(t,i),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:n}=e.detail,i=this.pending.add(n),a={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:i},{commandHistoryStorage:s,language:o,scope:l}=this.props,d=s.addItem(o,l,t,{command:t,startTime:new Date().toJSON()});d.catch(h=>{Rt.debug("Error adding workspace item",h)}),this.setState(h=>({consoleHistory:h.consoleHistory.concat(a)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),i.then(h=>{this.handleCommandResult(h,a,d)}).catch(h=>{this.handleCommandError(h,a,d)})}handleCommandResult(e,t,n){var i=Tt(Tt({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(a=>{var{consoleHistory:s}=a,o=s.lastIndexOf(t);if(o<0)return Rt.error("historyItem not found in consoleHistory"),null;var l=s.concat();return l[o]=i,{consoleHistory:l}}),e&&(this.updateHistory(e,i),this.updateKnownObjects(i),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Se.isCanceled(e)){Rt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},n),this.setState(i=>{var a=i.consoleHistory.concat(),s=a.lastIndexOf(t),o=Tt({},t);return o.wrappedResult=void 0,o.cancelResult=void 0,o.endTime=Date.now(),o.result={error:e},a[s]=o,{consoleHistory:a}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&yn.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var n={};yn.isErrorLevel(t)?n.error=e:n.message=e;var i={command:void 0,result:n};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){Rt.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:n}=this.props;[...e.created,...e.updated].forEach(i=>n(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:n}=e;n.forEach(i=>t(i))}}updateHistory(e,t){var n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(i=>{var a=i.consoleHistory.concat();return{consoleHistory:a}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){Rt.debug2("updateKnownObjects no changes");return}this.setState(n=>{var i,a,s,{consoleHistory:o}=n,l=o.lastIndexOf(e);if(l<0)return Rt.error("historyItem not found in state.consoleHistory"),null;var d=new Map(n.objectHistoryMap),h=new Map(n.objectMap),v=function(p){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:b}=p;z(b);var g=d.get(b);if(g!=null&&g>=0){var C;o===n.consoleHistory&&(o=o.concat());var y=Tt(Tt({},o[g]),{},{disabledObjects:[...(C=o[g].disabledObjects)!==null&&C!==void 0?C:[],b]});o[g]=y}d.set(b,l),m?h.delete(b):h.set(b,p)};return(i=t)===null||i===void 0||i.updated.forEach(f=>v(f)),(a=t)===null||a===void 0||a.removed.forEach(f=>v(f,!0)),(s=t)===null||s===void 0||s.created.forEach(f=>{var{title:p}=f;z(p),d.set(p,l),h.set(p,f)}),{objectHistoryMap:d,objectMap:h,consoleHistory:o}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var n=this.pending.add(t),i=new Date().toJSON();n.then(a=>{var s=Tt(Tt({},a),{},{data:Tt(Tt({},a.data),{},{endTime:i,result:e})}),{commandHistoryStorage:o,language:l}=this.props;o.updateItem(l,s).catch(d=>{Rt.warn("Error updating command history storage",d)})}).catch(a=>{Rt.debug("Error updating workspace history item",a)})}scrollConsoleHistoryToBottom(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.consoleHistoryScrollPane.current;z(t),!(!e&&Math.abs(t.scrollHeight-t.clientHeight-t.scrollTop)>=1)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;z(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")){e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});var{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:rr.MULTIPLE_FILE_ERROR});return}var n=t[0];rr.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:rr.FILE_TYPE_ERROR})}}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){var{dh:t,openObject:n,commandHistoryStorage:i,language:a,scope:s}=this.props,{consoleHistory:o,objectMap:l}=this.state,d={name:e,title:e,type:t.VariableType.TABLE},h=l.has(e),v={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[h?"updated":"created"]:[d]}}},f=o.concat(v);this.setState({consoleHistory:f}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(v),n({name:e,title:e,type:t.VariableType.TABLE}),i.addItem(a,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:n}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},a=n.concat(i);this.setState({consoleHistory:a})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ae.groups.high,icon:n?cr:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ae.groups.high,icon:e?cr:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ae.groups.high,icon:t?cr:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ae.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var{session:t}=this.props;t.runCode(e).catch(i=>{Rt.error("There was an error initiating the command",i)})}else{var n={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(i=>({consoleHistory:i.consoleHistory.concat(n)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(ku),a={},s=!1,o=0;o<i.length;o+=1){var l=i[o],{[l]:d}=t,{[l]:h}=e;d!==h&&(s=!0),a[l]=d}if(!(n&&!s)){var{onSettingsChange:v}=this.props;v(a)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var{actions:e,dh:t,historyChildren:n,language:i,statusBarChildren:a,openObject:s,session:o,scope:l,commandHistoryStorage:d,timeZone:h,disabled:v,unzip:f,supportsType:p,iconForType:m}=this.props,{consoleHeight:b,consoleHistory:g,isScrollDecorationShown:C,objectMap:y,showCsvOverlay:S,csvFile:E,csvPaste:w,dragError:I,csvUploadInProgress:O}=this.state,T=this.getObjects(y),N=Math.round(b*.7),R=this.getContextActions(e);return u.jsxs("div",{role:"presentation",className:Y("iris-console","h-100","w-100",{disabled:v}),children:[u.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[u.jsx(PO,{dh:t,session:o,overflowActions:this.handleOverflowActions,openObject:s,objects:T,children:a}),u.jsxs("div",{className:"console-csv-container",onDragOver:rr.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[S&&u.jsx(rr,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:I,onError:this.handleCsvError,uploadInProgress:O,allowZip:f!=null}),u.jsxs("div",{role:"presentation",className:Y("scroll-pane no-scroll-x",{"scroll-decoration":C}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[u.jsx(HT,{items:g,openObject:s,language:i,disabled:v,supportsType:p,iconForType:m}),n]})]}),!S&&u.jsx(Ou,{ref:this.consoleInput,session:o,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:N,commandHistoryStorage:d}),S&&u.jsx(bO,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:E??void 0,paste:w??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),u.jsx(ae,{actions:R,ignoreClassNames:[Ou.INPUT_CLASS_NAME]})]})}}yt(yn,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:OO,iconForType:DO});yt(yn,"LOG_THROTTLE",500);const IO=yn;var xO={groovy:"Groovy",python:"Python",scala:"Scala"};class NO{static normalizeScriptLanguage(e){return xO[e]||null}static getDisabledRunTooltip(e,t,n,i){return e?t?null:"".concat(n," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
12
12
  `),n=t.reduce((i,a)=>{var s=a.length-a.trimStart().length;return s===a.length?i:s<i?s:i},Number.MAX_SAFE_INTEGER);return t.map(i=>i.slice(n)).join(`
13
- `)}}const vo=xO;function ti(r,e,t){return e=NO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function NO(r){var e=MO(r,"string");return typeof e=="symbol"?e:String(e)}function MO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ct=B.module("ScriptEditor");class yp extends v.Component{constructor(e){super(e),ti(this,"contextActionCleanups",void 0),ti(this,"completionCleanup",void 0),ti(this,"editor",void 0),ti(this,"editorComponent",void 0),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=X.createRef(),this.state={model:null}}componentDidMount(){qe.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var t,n,{sessionLanguage:i,settings:a}=this.props,s=a==null?void 0:a.language,o=s!==((t=e.settings)===null||t===void 0?void 0:t.language);o&&(Ct.debug("Set language",s),this.setLanguage(s));var l=i==null&&e.sessionLanguage!=null,d=s===i,h=((n=e.settings)===null||n===void 0?void 0:n.language)===e.sessionLanguage;(l||i!==void 0&&h&&!d)&&(Ct.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion());var c=i!=null&&e.sessionLanguage==null;(c&&d||i!==void 0&&!h&&d)&&(Ct.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){qe.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Ct.error("Editor not initialized"),null)}getSelectedCommand(){var e,t,n=(e=this.editor)===null||e===void 0?void 0:e.getSelection();z(n);var i=(t=this.editor)===null||t===void 0?void 0:t.getModel();z(i);var{startLineNumber:a,endColumn:s}=n,{endLineNumber:o}=n;s===1&&o>a&&(o-=1);var l=i.getLineMinColumn(a),d=i.getLineMaxColumn(o),h=n.setStartPosition(a,l).setEndPosition(o,d);return vo.outdentCode(i.getValueInRange(h))}handleEditorInitialized(e){var{focusOnMount:t,onChange:n,onEditorInitialized:i,settings:a,session:s,sessionLanguage:o}=this.props;Ct.debug("handleEditorInitialized",o,s,a),this.editor=e,this.setState({model:this.editor.getModel()}),vt.setEOL(e),vt.registerPasteHandler(e),s!=null&&a&&o===a.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(n),t!=null&&t&&e.focus(),i(this.editor)}handleEditorWillDestroy(e){Ct.debug("handleEditorWillDestroy");var{onEditorWillDestroy:t}=this.props;t(e),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){var{onRunCommand:e}=this.props,t=this.getValue();t!=null&&e(t)}handleRunSelected(){var{onRunCommand:e}=this.props,t=this.getSelectedCommand();e(t)}initContextActions(){if(this.contextActionCleanups.length>0){Ct.error("Context actions already initialized.");return}if(this.editor){var e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[vt.getMonacoKeyCodeFromShortcut(et.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[vt.getMonacoKeyCodeFromShortcut(et.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Ct.error("Code completion already initialized.");return}var{session:e}=this.props;Ct.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=vt.openDocument(this.editor,e))}deInitCodeCompletion(){var{session:e}=this.props;Ct.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&vt.closeDocument(this.editor,e))}append(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;z(this.editor);var n=this.editor.getModel();z(n);var i=n.getValue();i?n.setValue("".concat(i,`
14
- `).concat(e)):n.setValue("".concat(e));var a=n.getLineCount(),s=n.getLineLength(a)+1;this.editor.setPosition({lineNumber:a,column:s}),t&&this.editor.focus()}updateDimensions(){Ct.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Ct.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var e,{error:t,isLoaded:n,isLoading:i,session:a,sessionLanguage:s,settings:o}=this.props,{model:l}=this.state,d=t?"Unable to open document. ".concat(t):null,h=o&&(e=o.language)!==null&&e!==void 0?e:null,c=l&&a&&h===s;return u.jsxs(u.Fragment,{children:[(t||i)&&u.jsx("div",{className:"h-100 w-100 position-relative",children:u.jsx(He,{errorMessage:d,isLoading:i,isLoaded:n})}),n&&u.jsx("div",{className:"h-100 w-100 script-editor",children:o&&u.jsxs(u.Fragment,{children:[u.jsx(eC,{ref:this.editorComponent,settings:o,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),c!=null&&c&&u.jsx(vp,{model:l,language:h,session:a})]})})]})}}ti(yp,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});const LO=yp;function ni(r,e,t){return e=FO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function FO(r){var e=AO(r,"string");return typeof e=="symbol"?e:String(e)}function AO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var RO=250,jO=2500;class Qa extends v.Component{static getTimeString(e,t){if(e==null||t===""||t===0)return null;var n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":vr.formatElapsedTime(n)}constructor(e){super(e),ni(this,"timer",void 0),ni(this,"cleanup",void 0),ni(this,"loadData",Le(()=>{var{commandHistoryStorage:t,item:n,language:i}=this.props,{id:a}=n;this.cleanup=t.listenItem(i,a,this.handleUpdate,this.handleError)},RO)),ni(this,"getPreviewText",ot(t=>t.split(`
15
- `,jO).join(`
16
- `),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var n,{data:i}=this.state;this.timer==null&&!(i!=null&&i.result)&&(i!=null&&i.startTime)&&!(i==null||i.endTime===void 0)?this.startTimer():(i!=null&&i.result&&!((n=t.data)!==null&&n!==void 0&&n.result)||i!=null&&i.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var{data:t}=e??{};this.setState({data:t});var{onUpdate:n}=this.props;n==null||n(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:n}=this.props,{currentTime:i,data:a,error:s}=this.state,{result:o,startTime:l,endTime:d}=a??{},h=(e=o==null?void 0:o.error)!==null&&e!==void 0?e:s,c=Qa.getTimeString(l,d??i),f=this.getPreviewText(t),p=!!c;return u.jsxs("div",{className:"command-history-item-tooltip",children:[u.jsxs("div",{className:"scroll-container",children:[u.jsx(lp,{language:n,children:f}),f.length<t.length&&u.jsx("p",{children:"Preview Truncated..."})]}),u.jsxs("div",{className:"result-info",children:[u.jsxs("div",{className:"d-flex justify-content-between",children:[!!h&&u.jsxs("div",{className:"text-danger mr-1",children:[u.jsx(ne,{icon:Oo})," Executed with errors"]}),u.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",p?u.jsx("span",{className:"time-string",children:c}):u.jsx(Ma,{className:"loading-spinner-vertical-align"})]})]}),!!h&&u.jsx("div",{className:"error-message",children:h})]})]})}}ni(Qa,"defaultProps",{onUpdate:()=>{}});const kO=Qa;var $O=512;function Ep(r){var{item:e,language:t,isSelected:n,commandHistoryStorage:i}=r,a=e.name.substring(0,$O),s=v.useRef(null),o=v.useCallback(()=>{var l;(l=s.current)===null||l===void 0||l.update()},[s]);return u.jsxs("div",{className:Y("command-history-item",{selected:n}),children:[a,u.jsx(wt,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:u.jsx(kO,{item:e,language:t,onUpdate:o,commandHistoryStorage:i})})]})}Ep.defaultProps={isSelected:!1};class wa extends v.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{icon:Rs,mask:e.icon,transform:"right-5 down-5 shrink-4"}),u.jsx(ne,{icon:Xg,transform:"shrink-3 right-7 down-6"})]}):u.jsx(ne,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return u.jsx("div",{className:"command-history-actions",children:e.map((n,i)=>u.jsx(K,{kind:"inline",className:Y(n.className),onClick:n.action,tooltip:n.description,disabled:n.selectionRequired!==void 0&&n.selectionRequired&&!t,icon:wa.renderContent(n)},wa.itemKey(i,n)))})}}const UO=wa;var HO=150,$u=3,Uu=B.module("CommandHistoryViewportUpdater");function VO(r){var{table:e,columns:t,top:n=0,bottom:i=0,search:a,isReversed:s=!1,onUpdate:o}=r,l=v.useMemo(()=>bi(d=>{var h=d.bottom-d.top,c=Math.max(0,d.top-h*$u),f=d.bottom+h*$u;e.setViewport({top:c,bottom:f,columns:d.columns})},HO),[e]);return v.useEffect(function(){var h=e.onUpdate(c=>{var f,p;o({items:(f=c.items)!==null&&f!==void 0?f:[],offset:(p=c.offset)!==null&&p!==void 0?p:0})});return()=>{Uu.debug("onUpdate cleanup"),h()}},[e,o]),v.useEffect(function(){e.setSearch(a??"")},[e,a]),v.useEffect(function(){l({top:n,bottom:i,columns:t})},[l,n,i,t,a,s]),v.useEffect(()=>()=>{Uu.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function Hu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Vu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Hu(a,n,i,s,o,"next",l)}function o(l){Hu(a,n,i,s,o,"throw",l)}s(void 0)})}}function Ht(r,e,t){return e=BO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function BO(r){var e=WO(r,"string");return typeof e=="symbol"?e:String(e)}function WO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var un=B.module("CommandHistory");class Je extends v.Component{static getCommandsFromViewport(e,t,n){for(var i=[],a=0;a<n.length;a+=1)for(var s=n[a],o=s[0];o<=s[1];o+=1)if(o>=t&&o<t+e.length){var{name:l}=e[o-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return Vu(function*(){var n=yield e.getSnapshot(t);return[...n.values()].map(i=>i.name)})()}constructor(e){super(e),Ht(this,"itemActions",void 0),Ht(this,"historyActions",void 0),Ht(this,"pending",void 0),Ht(this,"searchInputRef",void 0),Ht(this,"itemListRef",void 0),Ht(this,"debouncedSearchChange",Le(()=>{this.setState(n=>{var{searchText:i}=n;return{debouncedSearchText:i,selectedRanges:[]}})},Je.SET_SEARCH_DEBOUNCE_MS)),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:Zg,shortcut:Pr.COPY,action:this.copySelectedCommands,group:ae.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Xl,shortcut:et.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Je.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:Cc,shortcut:et.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Je.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Zl,shortcut:et.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Je.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Sc,action:this.createNotebook,group:Je.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Xl,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Zl,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Tn,this.searchInputRef=X.createRef(),this.itemListRef=X.createRef();var{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:"",debouncedSearchText:""}}componentWillUnmount(){this.debouncedSearchChange.cancel(),this.pending.cancel()}getSelectedCommands(){var e=this;return Vu(function*(){var{items:t,offset:n,selectedRanges:i}=e.state,a=i.slice().sort((o,l)=>o[0]-l[0]);if(a.length===0)return[];if(a[0][0]>=n&&a[a.length-1][1]<n+t.length)return Je.getCommandsFromViewport(t,n,a);var{table:s}=e.props;return e.pending.add(Je.getCommandsFromSnapshot(s,a))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
17
- `))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,n=t.reduce((i,a)=>i+a[1]-a[0]+1,0);return n>0&&n<Je.MAX_SELECTION_COUNT?(un.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(un.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Bc).catch(un.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(un.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(un.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(un.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(un.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:n,offset:i}=this.state;if(e<i||e>=i+n.length){un.error("Invalid index!",e);return}var{name:a}=n[e-i];t(a)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value}),this.debouncedSearchChange()}handleViewportUpdate(e){var{items:t,offset:n}=e,{table:i}=this.props,a=i.size;this.setState({items:t,itemCount:a,offset:n})}renderItem(e){var{item:t,itemIndex:n,isSelected:i}=e,{language:a,commandHistoryStorage:s}=this.props;return u.jsx(Ep,{isSelected:i,item:t,language:a,commandHistoryStorage:s})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:n}=this.props,{actions:i,historyActions:a,searchText:s,debouncedSearchText:o,top:l,bottom:d,items:h,itemCount:c,offset:f,selectedRanges:p}=this.state,m=(e=dp.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return u.jsxs("div",{className:"command-history",children:[u.jsxs("div",{className:"command-history-search-bar",children:[u.jsx(Ei,{ref:this.searchInputRef,value:s,placeholder:"".concat(m," Command History"),onChange:this.handleSearchChange}),u.jsx(UO,{actions:a,hasSelection:p.length>0})]}),u.jsxs("div",{className:"command-history-list",children:[u.jsx(wr,{ref:this.itemListRef,itemCount:c,items:h,offset:f,selectedRanges:p,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Je.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),u.jsx(VO,{table:n,top:l,bottom:d,search:o,onUpdate:this.handleViewportUpdate}),u.jsx(ae,{actions:i})]})]})}}Ht(Je,"ITEM_HEIGHT",29);Ht(Je,"MAX_SELECTION_COUNT",1e4);Ht(Je,"SET_SEARCH_DEBOUNCE_MS",150);Ht(Je,"menuGroups",{send:ae.groups.medium+100});const GO=Je;class zO extends v.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){var{logLevel:e,onClick:t}=this.props;t(e)}render(){var{logLevel:e,on:t}=this.props;return u.jsxs("div",{className:Y("log-level-menu-item",e),children:[u.jsx(xc,{on:t,onClick:this.handleSwitchClick}),e]})}}const KO=zO;function Bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bu(Object(t),!0).forEach(function(n){ct(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ct(r,e,t){return e=qO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qO(r){var e=YO(r,"string");return typeof e=="symbol"?e:String(e)}function YO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _e extends v.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),n=ho.formatTimestamp(t);return"".concat(n," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),ct(this,"cancelListener",void 0),ct(this,"editor",void 0),ct(this,"editorContainer",void 0),ct(this,"logLevelMenuItems",void 0),ct(this,"flushTimer",void 0),ct(this,"bufferedMessages",void 0),ct(this,"messages",void 0),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();var{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();var{session:i}=this.props;e.session!==i&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){var t=this,n=[];n.push({menuElement:u.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var o=_e.AllLogLevels[a],l=e[o]!=null?e[o]:!1;n.push({title:o,group:1,order:a+100,menuElement:u.jsx(KO,{logLevel:o,on:l,onClick:t.handleMenuItemClick,ref:d=>{d!=null&&(t.logLevelMenuItems[o]=d)}})})},a=0;a<_e.AllLogLevels.length;a+=1)i();return n.push({group:1,order:1e3,menuElement:u.jsxs("div",{className:"log-level-menu-controls",children:[u.jsx(K,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),u.jsx(K,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),n}resetLogLevels(){for(var e={},t=function(){var a=_e.AllLogLevels[n],s=_e.DefaultLogLevels.some(o=>o===a);e[a]=s},n=0;n<_e.AllLogLevels.length;n+=1)t();this.setState({shownLogLevels:e})}startListening(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){z(this.editorContainer),this.editor=jo.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),[[oi.Escape],[qc.Shift|oi.Escape]].forEach(e=>{z(this.editor),vt.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[oi.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,n,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();z(i),(n=this.editor)===null||n===void 0||n.setPosition(i)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,n=0;n<_e.AllLogLevels.length;n+=1){var i=_e.AllLogLevels[n];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var a={},s=0;s<_e.AllLogLevels.length;s+=1){var o=_e.AllLogLevels[s];a[o]=!0}this.setState({shownLogLevels:a})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,n=t[e],i={};i[e]=!n,this.updateLogLevels(i)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=Wu(Wu({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),n=t==null?void 0:t.getLineCount();z(n);var i=t==null?void 0:t.getLineLength(n);z(i);var a=this.isBottomVisible(),s=[];if(i>0&&(s.push({range:{startLineNumber:n,startColumn:i+1,endLineNumber:n,endColumn:i+1},text:`
13
+ `)}}const vo=NO;function ti(r,e,t){return e=MO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MO(r){var e=LO(r,"string");return typeof e=="symbol"?e:String(e)}function LO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ct=B.module("ScriptEditor");class yp extends c.Component{constructor(e){super(e),ti(this,"contextActionCleanups",void 0),ti(this,"completionCleanup",void 0),ti(this,"editor",void 0),ti(this,"editorComponent",void 0),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=X.createRef(),this.state={model:null}}componentDidMount(){qe.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var t,n,{sessionLanguage:i,settings:a}=this.props,s=a==null?void 0:a.language,o=s!==((t=e.settings)===null||t===void 0?void 0:t.language);o&&(Ct.debug("Set language",s),this.setLanguage(s));var l=i==null&&e.sessionLanguage!=null,d=s===i,h=((n=e.settings)===null||n===void 0?void 0:n.language)===e.sessionLanguage;(l||i!==void 0&&h&&!d)&&(Ct.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion());var v=i!=null&&e.sessionLanguage==null;(v&&d||i!==void 0&&!h&&d)&&(Ct.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){qe.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Ct.error("Editor not initialized"),null)}getSelectedCommand(){var e,t,n=(e=this.editor)===null||e===void 0?void 0:e.getSelection();z(n);var i=(t=this.editor)===null||t===void 0?void 0:t.getModel();z(i);var{startLineNumber:a,endColumn:s}=n,{endLineNumber:o}=n;s===1&&o>a&&(o-=1);var l=i.getLineMinColumn(a),d=i.getLineMaxColumn(o),h=n.setStartPosition(a,l).setEndPosition(o,d);return vo.outdentCode(i.getValueInRange(h))}handleEditorInitialized(e){var{focusOnMount:t,onChange:n,onEditorInitialized:i,settings:a,session:s,sessionLanguage:o}=this.props;Ct.debug("handleEditorInitialized",o,s,a),this.editor=e,this.setState({model:this.editor.getModel()}),vt.setEOL(e),vt.registerPasteHandler(e),s!=null&&a&&o===a.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(n),t!=null&&t&&e.focus(),i(this.editor)}handleEditorWillDestroy(e){Ct.debug("handleEditorWillDestroy");var{onEditorWillDestroy:t}=this.props;t(e),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){var{onRunCommand:e}=this.props,t=this.getValue();t!=null&&e(t)}handleRunSelected(){var{onRunCommand:e}=this.props,t=this.getSelectedCommand();e(t)}initContextActions(){if(this.contextActionCleanups.length>0){Ct.error("Context actions already initialized.");return}if(this.editor){var e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[vt.getMonacoKeyCodeFromShortcut(et.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[vt.getMonacoKeyCodeFromShortcut(et.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Ct.error("Code completion already initialized.");return}var{session:e}=this.props;Ct.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=vt.openDocument(this.editor,e))}deInitCodeCompletion(){var{session:e}=this.props;Ct.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&vt.closeDocument(this.editor,e))}append(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;z(this.editor);var n=this.editor.getModel();z(n);var i=n.getValue();i?n.setValue("".concat(i,`
14
+ `).concat(e)):n.setValue("".concat(e));var a=n.getLineCount(),s=n.getLineLength(a)+1;this.editor.setPosition({lineNumber:a,column:s}),t&&this.editor.focus()}updateDimensions(){Ct.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Ct.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var e,{error:t,isLoaded:n,isLoading:i,session:a,sessionLanguage:s,settings:o}=this.props,{model:l}=this.state,d=t?"Unable to open document. ".concat(t):null,h=o&&(e=o.language)!==null&&e!==void 0?e:null,v=l&&a&&h===s;return u.jsxs(u.Fragment,{children:[(t||i)&&u.jsx("div",{className:"h-100 w-100 position-relative",children:u.jsx(He,{errorMessage:d,isLoading:i,isLoaded:n})}),n&&u.jsx("div",{className:"h-100 w-100 script-editor",children:o&&u.jsxs(u.Fragment,{children:[u.jsx(eC,{ref:this.editorComponent,settings:o,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),v!=null&&v&&u.jsx(vp,{model:l,language:h,session:a})]})})]})}}ti(yp,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});const FO=yp;function ni(r,e,t){return e=AO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function AO(r){var e=RO(r,"string");return typeof e=="symbol"?e:String(e)}function RO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var jO=250,kO=2500;class Qa extends c.Component{static getTimeString(e,t){if(e==null||t===""||t===0)return null;var n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":vr.formatElapsedTime(n)}constructor(e){super(e),ni(this,"timer",void 0),ni(this,"cleanup",void 0),ni(this,"loadData",Le(()=>{var{commandHistoryStorage:t,item:n,language:i}=this.props,{id:a}=n;this.cleanup=t.listenItem(i,a,this.handleUpdate,this.handleError)},jO)),ni(this,"getPreviewText",ot(t=>t.split(`
15
+ `,kO).join(`
16
+ `),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var n,{data:i}=this.state;this.timer==null&&!(i!=null&&i.result)&&(i!=null&&i.startTime)&&!(i==null||i.endTime===void 0)?this.startTimer():(i!=null&&i.result&&!((n=t.data)!==null&&n!==void 0&&n.result)||i!=null&&i.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var{data:t}=e??{};this.setState({data:t});var{onUpdate:n}=this.props;n==null||n(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:n}=this.props,{currentTime:i,data:a,error:s}=this.state,{result:o,startTime:l,endTime:d}=a??{},h=(e=o==null?void 0:o.error)!==null&&e!==void 0?e:s,v=Qa.getTimeString(l,d??i),f=this.getPreviewText(t),p=!!v;return u.jsxs("div",{className:"command-history-item-tooltip",children:[u.jsxs("div",{className:"scroll-container",children:[u.jsx(lp,{language:n,children:f}),f.length<t.length&&u.jsx("p",{children:"Preview Truncated..."})]}),u.jsxs("div",{className:"result-info",children:[u.jsxs("div",{className:"d-flex justify-content-between",children:[!!h&&u.jsxs("div",{className:"text-danger mr-1",children:[u.jsx(ne,{icon:Oo})," Executed with errors"]}),u.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",p?u.jsx("span",{className:"time-string",children:v}):u.jsx(Ma,{className:"loading-spinner-vertical-align"})]})]}),!!h&&u.jsx("div",{className:"error-message",children:h})]})]})}}ni(Qa,"defaultProps",{onUpdate:()=>{}});const $O=Qa;var UO=512;function Ep(r){var{item:e,language:t,isSelected:n,commandHistoryStorage:i}=r,a=e.name.substring(0,UO),s=c.useRef(null),o=c.useCallback(()=>{var l;(l=s.current)===null||l===void 0||l.update()},[s]);return u.jsxs("div",{className:Y("command-history-item",{selected:n}),children:[a,u.jsx(wt,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:u.jsx($O,{item:e,language:t,onUpdate:o,commandHistoryStorage:i})})]})}Ep.defaultProps={isSelected:!1};class wa extends c.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{icon:Rs,mask:e.icon,transform:"right-5 down-5 shrink-4"}),u.jsx(ne,{icon:Xg,transform:"shrink-3 right-7 down-6"})]}):u.jsx(ne,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return u.jsx("div",{className:"command-history-actions",children:e.map((n,i)=>u.jsx(K,{kind:"inline",className:Y(n.className),onClick:n.action,tooltip:n.description,disabled:n.selectionRequired!==void 0&&n.selectionRequired&&!t,icon:wa.renderContent(n)},wa.itemKey(i,n)))})}}const HO=wa;var VO=150,$u=3,Uu=B.module("CommandHistoryViewportUpdater");function BO(r){var{table:e,columns:t,top:n=0,bottom:i=0,search:a,isReversed:s=!1,onUpdate:o}=r,l=c.useMemo(()=>bi(d=>{var h=d.bottom-d.top,v=Math.max(0,d.top-h*$u),f=d.bottom+h*$u;e.setViewport({top:v,bottom:f,columns:d.columns})},VO),[e]);return c.useEffect(function(){var h=e.onUpdate(v=>{var f,p;o({items:(f=v.items)!==null&&f!==void 0?f:[],offset:(p=v.offset)!==null&&p!==void 0?p:0})});return()=>{Uu.debug("onUpdate cleanup"),h()}},[e,o]),c.useEffect(function(){e.setSearch(a??"")},[e,a]),c.useEffect(function(){l({top:n,bottom:i,columns:t})},[l,n,i,t,a,s]),c.useEffect(()=>()=>{Uu.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function Hu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Vu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Hu(a,n,i,s,o,"next",l)}function o(l){Hu(a,n,i,s,o,"throw",l)}s(void 0)})}}function Ht(r,e,t){return e=WO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WO(r){var e=GO(r,"string");return typeof e=="symbol"?e:String(e)}function GO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var un=B.module("CommandHistory");class Je extends c.Component{static getCommandsFromViewport(e,t,n){for(var i=[],a=0;a<n.length;a+=1)for(var s=n[a],o=s[0];o<=s[1];o+=1)if(o>=t&&o<t+e.length){var{name:l}=e[o-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return Vu(function*(){var n=yield e.getSnapshot(t);return[...n.values()].map(i=>i.name)})()}constructor(e){super(e),Ht(this,"itemActions",void 0),Ht(this,"historyActions",void 0),Ht(this,"pending",void 0),Ht(this,"searchInputRef",void 0),Ht(this,"itemListRef",void 0),Ht(this,"debouncedSearchChange",Le(()=>{this.setState(n=>{var{searchText:i}=n;return{debouncedSearchText:i,selectedRanges:[]}})},Je.SET_SEARCH_DEBOUNCE_MS)),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:Zg,shortcut:Pr.COPY,action:this.copySelectedCommands,group:ae.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Xl,shortcut:et.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Je.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:Cc,shortcut:et.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Je.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Zl,shortcut:et.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Je.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Sc,action:this.createNotebook,group:Je.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Xl,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Zl,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Tn,this.searchInputRef=X.createRef(),this.itemListRef=X.createRef();var{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:"",debouncedSearchText:""}}componentWillUnmount(){this.debouncedSearchChange.cancel(),this.pending.cancel()}getSelectedCommands(){var e=this;return Vu(function*(){var{items:t,offset:n,selectedRanges:i}=e.state,a=i.slice().sort((o,l)=>o[0]-l[0]);if(a.length===0)return[];if(a[0][0]>=n&&a[a.length-1][1]<n+t.length)return Je.getCommandsFromViewport(t,n,a);var{table:s}=e.props;return e.pending.add(Je.getCommandsFromSnapshot(s,a))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
17
+ `))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,n=t.reduce((i,a)=>i+a[1]-a[0]+1,0);return n>0&&n<Je.MAX_SELECTION_COUNT?(un.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(un.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Bc).catch(un.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(un.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(un.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(un.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(un.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:n,offset:i}=this.state;if(e<i||e>=i+n.length){un.error("Invalid index!",e);return}var{name:a}=n[e-i];t(a)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value}),this.debouncedSearchChange()}handleViewportUpdate(e){var{items:t,offset:n}=e,{table:i}=this.props,a=i.size;this.setState({items:t,itemCount:a,offset:n})}renderItem(e){var{item:t,itemIndex:n,isSelected:i}=e,{language:a,commandHistoryStorage:s}=this.props;return u.jsx(Ep,{isSelected:i,item:t,language:a,commandHistoryStorage:s})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:n}=this.props,{actions:i,historyActions:a,searchText:s,debouncedSearchText:o,top:l,bottom:d,items:h,itemCount:v,offset:f,selectedRanges:p}=this.state,m=(e=dp.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return u.jsxs("div",{className:"command-history",children:[u.jsxs("div",{className:"command-history-search-bar",children:[u.jsx(Ei,{ref:this.searchInputRef,value:s,placeholder:"".concat(m," Command History"),onChange:this.handleSearchChange}),u.jsx(HO,{actions:a,hasSelection:p.length>0})]}),u.jsxs("div",{className:"command-history-list",children:[u.jsx(wr,{ref:this.itemListRef,itemCount:v,items:h,offset:f,selectedRanges:p,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Je.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),u.jsx(BO,{table:n,top:l,bottom:d,search:o,onUpdate:this.handleViewportUpdate}),u.jsx(ae,{actions:i})]})]})}}Ht(Je,"ITEM_HEIGHT",29);Ht(Je,"MAX_SELECTION_COUNT",1e4);Ht(Je,"SET_SEARCH_DEBOUNCE_MS",150);Ht(Je,"menuGroups",{send:ae.groups.medium+100});const zO=Je;class KO extends c.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){var{logLevel:e,onClick:t}=this.props;t(e)}render(){var{logLevel:e,on:t}=this.props;return u.jsxs("div",{className:Y("log-level-menu-item",e),children:[u.jsx(xc,{on:t,onClick:this.handleSwitchClick}),e]})}}const qO=KO;function Bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bu(Object(t),!0).forEach(function(n){ct(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ct(r,e,t){return e=YO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YO(r){var e=XO(r,"string");return typeof e=="symbol"?e:String(e)}function XO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _e extends c.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),n=ho.formatTimestamp(t);return"".concat(n," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),ct(this,"cancelListener",void 0),ct(this,"editor",void 0),ct(this,"editorContainer",void 0),ct(this,"logLevelMenuItems",void 0),ct(this,"flushTimer",void 0),ct(this,"bufferedMessages",void 0),ct(this,"messages",void 0),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();var{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();var{session:i}=this.props;e.session!==i&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){var t=this,n=[];n.push({menuElement:u.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var o=_e.AllLogLevels[a],l=e[o]!=null?e[o]:!1;n.push({title:o,group:1,order:a+100,menuElement:u.jsx(qO,{logLevel:o,on:l,onClick:t.handleMenuItemClick,ref:d=>{d!=null&&(t.logLevelMenuItems[o]=d)}})})},a=0;a<_e.AllLogLevels.length;a+=1)i();return n.push({group:1,order:1e3,menuElement:u.jsxs("div",{className:"log-level-menu-controls",children:[u.jsx(K,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),u.jsx(K,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),n}resetLogLevels(){for(var e={},t=function(){var a=_e.AllLogLevels[n],s=_e.DefaultLogLevels.some(o=>o===a);e[a]=s},n=0;n<_e.AllLogLevels.length;n+=1)t();this.setState({shownLogLevels:e})}startListening(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){z(this.editorContainer),this.editor=jo.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),[[oi.Escape],[qc.Shift|oi.Escape]].forEach(e=>{z(this.editor),vt.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[oi.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,n,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();z(i),(n=this.editor)===null||n===void 0||n.setPosition(i)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,n=0;n<_e.AllLogLevels.length;n+=1){var i=_e.AllLogLevels[n];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var a={},s=0;s<_e.AllLogLevels.length;s+=1){var o=_e.AllLogLevels[s];a[o]=!0}this.setState({shownLogLevels:a})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,n=t[e],i={};i[e]=!n,this.updateLogLevels(i)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=Wu(Wu({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),n=t==null?void 0:t.getLineCount();z(n);var i=t==null?void 0:t.getLineLength(n);z(i);var a=this.isBottomVisible(),s=[];if(i>0&&(s.push({range:{startLineNumber:n,startColumn:i+1,endLineNumber:n,endColumn:i+1},text:`
18
18
  `,forceMoveMarkers:!0}),n+=1,i=0),s.push({range:{startLineNumber:n,startColumn:i,endLineNumber:n,endColumn:i},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(s),a){var o=t==null?void 0:t.getLineCount();z(o),this.editor.revealLine(o,1)}}}refreshLogText(){if(this.editor){this.truncateLogIfNecessary();for(var{shownLogLevels:e}=this.state,t=this.isBottomVisible(),n="",i=0;i<this.messages.length;i+=1){var a=this.messages[i];if(e[a.logLevel]){var s=_e.getLogText(a);s.length>0&&(n+=s,s.charAt(s.length-1)!==`
19
19
  `&&(n+=`
20
20
  `))}}if(n=n.trimRight(),this.editor.setValue(n),t){var o,l=(o=this.editor.getModel())===null||o===void 0?void 0:o.getLineCount();z(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>_e.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-_e.truncateSize))}scrollToBottom(){var e,t,n;if(this.editor){var i=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(n=t.call(e))===null||n===void 0?void 0:n.getLineCount();z(i),this.editor.revealLine(i,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return z(t),this.isLineVisible(t)}isLineVisible(e){var t,n=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(n==null||n.length===0)return!1;for(var i=0;i<n.length;i+=1){var a=n[i];if(a.startLineNumber<=e&&e<=a.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var n=this.bufferedMessages[t],i=_e.getLogText(n);e+=i,i.charAt(i.length-1)!==`
21
21
  `&&(e+=`
22
- `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,_e.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(K,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Qg,tooltip:"Clear log"}),u.jsx(K,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Fa,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(En,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ct(_e,"DefaultLogLevels",[ke.STDOUT,ke.ERROR,ke.FATAL,ke.STDERR,ke.WARN]);ct(_e,"AllLogLevels",[ke.INFO,ke.STDOUT,ke.ERROR,ke.FATAL,ke.STDERR,ke.WARN,ke.DEBUG,ke.TRACE]);ct(_e,"bufferTimeout",16);ct(_e,"maxLogSize",131072);ct(_e,"truncateSize",65536);const XO=_e;function Gu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function ZO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Gu(a,n,i,s,o,"next",l)}function o(l){Gu(a,n,i,s,o,"throw",l)}s(void 0)})}}var QO=B.module("HeapUsage");function JO(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:a=!0,monitorDuration:s}=r,o=dl(),[l,d]=v.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=v.useState(!1),f=v.useRef({timestamps:[],usages:[]}),p=ko(),m=v.useCallback(ZO(function*(){try{var F=yield t.getWorkerHeapInfo();if(!p.current)return;if(d(F),a||h){for(var k=(F.totalHeapSize-F.freeMemory)/F.maximumHeapSize,H=Date.now(),{timestamps:q,usages:re}=f.current;q.length!==0&&H-q[0]>s*1.5;)q.shift(),re.shift();q.push(H),re.push(k)}else f.current={timestamps:[],usages:[]}}catch(V){QO.warn("Unable to get heap usage",V)}}),[t,p,a,h,s]);sv(m,h?i:n);var b=(F,k)=>Math.round(F*10**k)/10**k,g=2,C=1024**3,{freeMemory:y,totalHeapSize:S,maximumHeapSize:E}=l,w=b(y/C,g),I=b(S/C,g),O=b(E/C,g),T=I-w,N=function(k,H){var q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Y("heap-usage-info-row",{"heading-bottom-border":q}),children:[u.jsx("div",{className:"font-weight-bold",children:k}),u.jsx("div",{children:H})]})},{timestamps:R,usages:W}=f.current,L=(e=R[R.length-1])!==null&&e!==void 0?e:0,D=S/E,M=(S-y)/E;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(D*100,"% - ").concat(D*2,"px")}}),u.jsx("div",{className:Y("used-memory",{"heap-overflow":(S-y)/E>.95}),style:{width:"calc(".concat(M*100,"% - ").concat(M*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[O.toFixed(1)," GB"]}),u.jsx(wt,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[N("In use:","".concat(T.toFixed(g)," of ").concat(O.toFixed(g)," GB"),!0),N("Free:","".concat(w.toFixed(g)," GB")),N("Total:","".concat(I.toFixed(g)," GB")),N("Max:","".concat(O.toFixed(g)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(yf,{data:[{x:[...R],y:[...W],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(s/6),gridcolor:o.linecolor,range:[L-s,L],linecolor:o.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:o.linecolor,range:[0,1],linecolor:o.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}function wp(r,e,t){return e=eD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eD(r){var e=tD(r,"string");return typeof e=="symbol"?e:String(e)}function tD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class br{static valueForCell(e,t,n){var i="".concat(e,",").concat(t);return n!==void 0&&n&&(i="(".concat(i,")")),i}constructor(e){wp(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:br.DEFAULT_TYPE,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return new this.dh.Column({index:n,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]:"",n=[],i=0;i<e;i+=1)n.push(this.makeColumn("".concat(t).concat(i),br.DEFAULT_TYPE,i));return n}static makeUserColumnWidths(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5,t=new Map,n=0;n<e;n+=1)t.set(n.toString(),100);return t}makeRow(e){var t=new this.dh.Row({index:e,name:"".concat(e)});return t.get=jest.fn(n=>br.valueForCell(e,n.index)),t}makeFilter(){return new this.dh.FilterCondition}makeSort(){return new this.dh.Sort}makeTable(){var{columns:e=this.makeColumns(),size:t=1e9,sort:n=[],layoutHints:i={}}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=new this.dh.Table({columns:e,size:t,sort:n});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,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=new this.dh.TreeTable({columns:e,size:t,sort:n});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,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;return new tC(i,e,t??new _r(i),n)}}wp(br,"DEFAULT_TYPE","java.lang.String");const nD=br;function kn(r,e,t){return e=rD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rD(r){var e=iD(r,"string");return typeof e=="symbol"?e:String(e)}function iD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qt=B.module("TableViewportUpdater"),aD=150;class Jt extends v.PureComponent{constructor(){super(...arguments),kn(this,"subscription",void 0),kn(this,"getViewportRowRange",se((e,t,n)=>{var i=n-t,a=Math.max(0,t-i*Jt.ROW_BUFFER_PAGES),s=n+i*Jt.ROW_BUFFER_PAGES;return[a,s]})),kn(this,"getViewportColumns",se((e,t,n,i)=>{if(t==null||n==null)return null;for(var a=n-t,s=Math.max(0,t-a*Jt.COLUMN_BUFFER_PAGES),o=Math.min(n+a*Jt.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[],d=s;d<=o;d+=1){var h=nC.getModelIndex(d,i);l.push(e.columns[h])}return l})),kn(this,"updateViewport",bi((e,t,n,i,a)=>{if(t<e){qt.error("Invalid viewport",e,t);return}if(e===0&&t===0){qt.debug2("Ignoring 0-0 viewport");return}var{movedColumns:s,table:o}=this.props,[l,d]=this.getViewportRowRange(o,e,t),h=a??this.getViewportColumns(o,n,i,s);if(qt.debug2("Setting Viewport Top:",l,"Bottom:",d,"Columns:",h),this.subscription==null){qt.debug2("updateViewport creating new subscription"),this.subscription=o.setViewport(l,d,h);var{onSubscription:c}=this.props;c(this.subscription)}else qt.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,d,h)},aD))}componentDidMount(){var{top:e,bottom:t,left:n,right:i,table:a,filters:s,sorts:o,columns:l,customColumns:d}=this.props;a.applyFilter(s),a.applySort(o),a.applyCustomColumns(d),this.updateViewport(e,t,n,i,l)}componentDidUpdate(e){var{top:t,bottom:n,left:i,right:a,table:s,filters:o,sorts:l,customColumns:d,columns:h}=this.props,c=o!==e.filters,f=l!==e.sorts,p=d!==e.customColumns,m=s!==e.table;(c||f||p||m)&&this.closeSubscription(),(c||m)&&(qt.debug("update table filter",o),s.applyFilter(o)),(f||m)&&(qt.debug("update table sort",l),s.applySort(l)),(p||m)&&(qt.debug("update table custom columns",d),s.applyCustomColumns(d)),this.updateViewport(t,n,i,a,h)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(qt.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}}kn(Jt,"ROW_BUFFER_PAGES",3);kn(Jt,"COLUMN_BUFFER_PAGES",1);kn(Jt,"defaultProps",{top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]});const sD=Jt;function Pa(r,e,t){return e=oD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oD(r){var e=lD(r,"string");return typeof e=="symbol"?e:String(e)}function lD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nr=B.module("TreeTableViewportUpdater"),dD=150;class _a extends v.PureComponent{constructor(e){super(e),Pa(this,"listenerCleanup",void 0),Pa(this,"updateViewport",bi((t,n)=>{if(n<t){nr.error("Invalid viewport",t,n);return}if(t===0&&n===0){nr.debug2("Ignoring 0-0 viewport");return}var{table:i,updateInterval:a}=this.props,s=n-t,o=Math.max(0,t-s*3),l=n+s*3+1;if(nr.debug2("Setting Viewport Top:",o,"Bottom:",l,i),!this.listenerCleanup){var{dh:d,onViewportUpdate:h}=this.props;this.listenerCleanup=i.addEventListener(d.TreeTable.EVENT_UPDATED,h)}i.setViewport(o,l,void 0,a)},dD)),this.listenerCleanup=null}componentDidMount(){var{top:e,bottom:t,table:n,filters:i,sorts:a}=this.props;nr.debug("componentDidMount",this.props),n.applyFilter(i),n.applySort(a),this.updateViewport(e,t)}componentDidUpdate(e){var{top:t,bottom:n,table:i,filters:a,sorts:s}=this.props;a!==e.filters&&(nr.debug("update table filter",a),i.applyFilter(a)),s!==e.sorts&&(nr.debug("update table sort",s),i.applySort(s)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}}Pa(_a,"UPDATE_INTERVAL",1e3);Pa(_a,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:_a.UPDATE_INTERVAL});const uD=_a,hD=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:Wc,AdvancedSettingsType:rC,AggregationEdit:iC,AggregationUtils:aC,Aggregations:sC,BarIcon:oC,ChartBuilder:lC,ColumnHeaderGroup:dC,CustomColumnBuilder:uC,DownloadServiceWorkerUtils:hC,FormatColumnWhereIcon:cC,FormatRowWhereIcon:vC,HistogramIcon:fC,InputEditor:pC,IrisGrid:Tr,IrisGridMetricCalculator:mC,IrisGridModel:Yt,IrisGridModelFactory:Ra,IrisGridPartitionedTableModel:gC,IrisGridRenderer:bC,IrisGridTableModel:Gc,IrisGridTableModelTemplate:CC,IrisGridTestUtils:nD,IrisGridThemeContext:SC,IrisGridThemeProvider:zc,IrisGridTreeTableModel:yC,IrisGridUtils:Ze,LineIcon:EC,OptionType:wC,PieIcon:PC,RollupRows:_C,SHORTCUTS:TC,ScatterIcon:OC,TableCsvExporter:DC,TableSaver:IC,TableViewportUpdater:sD,TreeTableViewportUpdater:uD,VisibilityOrderingBuilder:xC,createDefaultIrisGridTheme:NC,default:Tr,isIrisGridTableModelTemplate:aa,isPanelStateV1:MC,isPanelStateV2:LC,isPartitionedGridModel:FC,isPartitionedGridModelProvider:AC},Symbol.toStringTag,{value:"Module"}));function Dl(r,e,t){return e=cD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cD(r){var e=vD(r,"string");return typeof e=="symbol"?e:String(e)}function vD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ja{}Dl(Ja,"OPEN","ChartEvent.OPEN");Dl(Ja,"CLOSE","ChartEvent.CLOSE");Dl(Ja,"COLUMN_SELECTED","ChartEvent.COLUMN_SELECTED");const Ta=Ja;function Mi(r,e,t){return e=fD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fD(r){var e=pD(r,"string");return typeof e=="symbol"?e:String(e)}function pD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kr{}Mi(kr,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Mi(kr,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Mi(kr,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Mi(kr,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Mi(kr,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const pt=kr;function In(r,e,t){return e=mD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mD(r){var e=gD(r,"string");return typeof e=="symbol"?e:String(e)}function gD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class rn{}In(rn,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");In(rn,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");In(rn,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");In(rn,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");In(rn,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");In(rn,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");In(rn,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");In(rn,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Te=rn;function $r(r,e,t){return e=bD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bD(r){var e=CD(r,"string");return typeof e=="symbol"?e:String(e)}function CD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Yn{}$r(Yn,"OPEN_GRID","IrisGridEvent.OPEN_GRID");$r(Yn,"CLOSE_GRID","IrisGridEvent.CLOSE_GRID");$r(Yn,"DATA_SELECTED","IrisGridEvent.DATA_SELECTED");$r(Yn,"COLUMN_SELECTED","IrisGridEvent.COLUMN_SELECTED");$r(Yn,"STATE_CHANGED","IrisGridEvent.STATE_CHANGED");$r(Yn,"CREATE_CHART","IrisGridevent.CREATE_CHART");const Et=Yn,Pp=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function an(r,e,t){return e=SD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function SD(r){var e=yD(r,"string");return typeof e=="symbol"?e:String(e)}function yD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Bt{}an(Bt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");an(Bt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");an(Bt,"CLOSE_FILE","NotebookEvent.closeFile");an(Bt,"RENAME","NotebookEvent.rename");an(Bt,"RENAME_FILE","NotebookEvent.renameFile");an(Bt,"REGISTER_FILE","NotebookEvent.registerFile");an(Bt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");an(Bt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");an(Bt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const he=Bt;function _p(r,e,t){return e=ED(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ED(r){var e=wD(r,"string");return typeof e=="symbol"?e:String(e)}function wD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Il{}_p(Il,"OPEN","PandasEvent.OPEN");_p(Il,"CLOSE","PandasEvent.CLOSE");const PD=Il;function Ur(r,e,t){return e=_D(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _D(r){var e=TD(r,"string");return typeof e=="symbol"?e:String(e)}function TD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Xn{}Ur(Xn,"focus","TabEvent.focus");Ur(Xn,"blur","TabEvent.blur");Ur(Xn,"openPQObject","TabEvent.openPQObject");Ur(Xn,"openControl","TabEvent.openControl");Ur(Xn,"reload","TabEvent.reload");Ur(Xn,"clearAllFilters","TabEvent.clearAllFilters");const ri=Xn;function OD(r,e,t){return e=DD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function DD(r){var e=ID(r,"string");return typeof e=="symbol"?e:String(e)}function ID(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Tp extends v.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var e,t,n,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(n=t.header)===null||n===void 0?void 0:n.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var n;return(n=(t==null?void 0:t.contentItem).container)===null||n===void 0?void 0:n.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=t.length-1;n>0;n-=1){var i,a,s,o,l,d,h;if(((i=t[n].contentItem)===null||i===void 0||(a=i.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(o=s.contentItem)===null||o===void 0||(l=o.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[n])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var a,s,o,l,d,h,c,f;if(((a=t[i].contentItem)===null||a===void 0||(s=a.config)===null||s===void 0?void 0:s.id)===((o=e.tab)===null||o===void 0||(l=o.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var p=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(f=c.config)===null||f===void 0)&&f.isClosable);if(p){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,a,s,o=!!(!((i=e[n])===null||i===void 0||(a=i.contentItem)===null||a===void 0||(s=a.config)===null||s===void 0)&&s.isClosable);if(o){t=!1;break}}return t}render(){var e,t,n,{additionalActions:i,glContainer:a}=this.props,s=[...i],o=(e=a.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(n=t.config)===null||n===void 0?void 0:n.isClosable;return s.push({title:"Close",order:10,group:ae.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ae.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ae.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ae,{actions:s})}}OD(Tp,"defaultProps",{additionalActions:[]});const xD=Tp;function Op(r,e,t){return e=ND(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ND(r){var e=MD(r,"string");return typeof e=="symbol"?e:String(e)}function MD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dp extends v.PureComponent{constructor(e){super(e),Op(this,"renameInputRef",void 0),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=X.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:a}=this.state;return u.jsxs("form",{className:Y("p-3",{"was-validated":a}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:s=>{s.stopPropagation()},onMouseUp:s=>{s.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(n,"-input"),children:["Rename ",n]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(n,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(K,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(yi,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Op(Dp,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function fo(r,e,t){return e=LD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function LD(r){var e=FD(r,"string");return typeof e=="symbol"?e:String(e)}function FD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var AD=B.module("Panel");let Ip=class extends v.PureComponent{constructor(e){super(e),fo(this,"ref",void 0),fo(this,"getAdditionActions",se((n,i,a)=>{var s=[];return i&&s.push(this.getCloneAction()),a&&s.push(this.getRenameAction()),[...s,...n]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=X.createRef();var{glContainer:t}=this.props;this.state={title:A.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:n,glContainer:i,glEventHub:a}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),a.on(pt.SESSION_CLOSED,this.handleSessionClosed),a.on(pt.SESSION_OPENED,this.handleSessionOpened),a.on(ri.focus,this.handleTabFocus),a.on(ri.blur,this.handleTabBlur),a.on(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),a.emit(te.MOUNT,n??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:n}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),n.off(pt.SESSION_CLOSED,this.handleSessionClosed),n.off(pt.SESSION_OPENED,this.handleSessionOpened),n.off(ri.focus,this.handleTabFocus),n.off(ri.blur,this.handleTabBlur),n.off(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:A.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var n=A.getRootFromContainer(t),i=A.getComponentConfigFromContainer(t);z(i),A.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=A.getRootFromContainer(e),i=A.getComponentConfigFromContainer(e);if(i==null){AD.error("Could not get component config from container",e);return}var a=A.cloneComponent(n,i);a!==null&&t.emit(te.CLONED,this,a)}getCloneAction(){return{title:"Copy Panel",order:10,group:ae.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ae.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,additionalActions:a,errorMessage:s,isLoaded:o,isLoading:l,isClonable:d,isRenamable:h}=this.props,{tab:c}=i,{showRenameDialog:f,title:p,isWithinPanel:m}=this.state;return u.jsxs("div",{className:Y("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(He,{errorMessage:s,isLoaded:o,isLoading:l}),!m&&c!=null&&xa.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(xD,{glContainer:i,additionalActions:this.getAdditionActions(a,d,h)}),h&&u.jsx(Dp,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&u.jsx(wt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),c.element[0])]})}};fo(Ip,"defaultProps",{className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1});const Wt=Ip;function Li(r){var{widgetType:e,widgetName:t,glContainer:n,description:i,children:a}=r,s=A.getTitleFromContainer(n);return u.jsxs("div",{className:"tab-tooltip-grid-container",children:[u.jsxs("span",{className:"tab-tooltip-title",children:[e," Name"]}),u.jsxs("div",{className:"tab-tooltip-name-wrapper",children:[u.jsx("span",{className:"tab-tooltip-name",children:t}),u.jsx(Io,{className:"tab-tooltip-copy",tooltip:"Copy name",copy:t})]}),t!==s&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"tab-tooltip-title",children:"Display Name"}),u.jsx("span",{className:"tab-tooltip-name",children:s})]}),i&&u.jsx("div",{className:"tab-tooltip-description",children:i}),a]})}Li.propTypes={glContainer:Ya.Container.isRequired,widgetType:_.string,widgetName:_.string,description:_.string,children:_.node};Li.defaultProps={widgetType:"",widgetName:"",description:null,children:null};function xp(r,e,t){return e=RD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function RD(r){var e=jD(r,"string");return typeof e=="symbol"?e:String(e)}function jD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Np extends v.PureComponent{constructor(e){super(e),xp(this,"getCachedRenderTabTooltip",se((t,n,i,a,s)=>t?()=>u.jsx(Li,{glContainer:n,widgetType:i,widgetName:a,description:s}):null)),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){var{widgetName:e}=this.props;Bc(e)}getErrorMessage(){var{errorMessage:e}=this.props,{isClientDisconnected:t,isPanelDisconnected:n,isWidgetDisconnected:i,isWaitingForReconnect:a}=this.state;if(e)return"".concat(e);if(t&&n&&a)return`Disconnected from server.
22
+ `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,_e.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(K,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Qg,tooltip:"Clear log"}),u.jsx(K,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Fa,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(En,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ct(_e,"DefaultLogLevels",[ke.STDOUT,ke.ERROR,ke.FATAL,ke.STDERR,ke.WARN]);ct(_e,"AllLogLevels",[ke.INFO,ke.STDOUT,ke.ERROR,ke.FATAL,ke.STDERR,ke.WARN,ke.DEBUG,ke.TRACE]);ct(_e,"bufferTimeout",16);ct(_e,"maxLogSize",131072);ct(_e,"truncateSize",65536);const ZO=_e;function Gu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function QO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Gu(a,n,i,s,o,"next",l)}function o(l){Gu(a,n,i,s,o,"throw",l)}s(void 0)})}}var JO=B.module("HeapUsage");function eD(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:a=!0,monitorDuration:s}=r,o=dl(),[l,d]=c.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,v]=c.useState(!1),f=c.useRef({timestamps:[],usages:[]}),p=ko(),m=c.useCallback(QO(function*(){try{var F=yield t.getWorkerHeapInfo();if(!p.current)return;if(d(F),a||h){for(var k=(F.totalHeapSize-F.freeMemory)/F.maximumHeapSize,H=Date.now(),{timestamps:q,usages:re}=f.current;q.length!==0&&H-q[0]>s*1.5;)q.shift(),re.shift();q.push(H),re.push(k)}else f.current={timestamps:[],usages:[]}}catch(V){JO.warn("Unable to get heap usage",V)}}),[t,p,a,h,s]);sv(m,h?i:n);var b=(F,k)=>Math.round(F*10**k)/10**k,g=2,C=1024**3,{freeMemory:y,totalHeapSize:S,maximumHeapSize:E}=l,w=b(y/C,g),I=b(S/C,g),O=b(E/C,g),T=I-w,N=function(k,H){var q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Y("heap-usage-info-row",{"heading-bottom-border":q}),children:[u.jsx("div",{className:"font-weight-bold",children:k}),u.jsx("div",{children:H})]})},{timestamps:R,usages:W}=f.current,L=(e=R[R.length-1])!==null&&e!==void 0?e:0,D=S/E,M=(S-y)/E;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(D*100,"% - ").concat(D*2,"px")}}),u.jsx("div",{className:Y("used-memory",{"heap-overflow":(S-y)/E>.95}),style:{width:"calc(".concat(M*100,"% - ").concat(M*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[O.toFixed(1)," GB"]}),u.jsx(wt,{onEntered:()=>v(!0),onExited:()=>v(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[N("In use:","".concat(T.toFixed(g)," of ").concat(O.toFixed(g)," GB"),!0),N("Free:","".concat(w.toFixed(g)," GB")),N("Total:","".concat(I.toFixed(g)," GB")),N("Max:","".concat(O.toFixed(g)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(yf,{data:[{x:[...R],y:[...W],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(s/6),gridcolor:o.linecolor,range:[L-s,L],linecolor:o.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:o.linecolor,range:[0,1],linecolor:o.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}function wp(r,e,t){return e=tD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tD(r){var e=nD(r,"string");return typeof e=="symbol"?e:String(e)}function nD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class br{static valueForCell(e,t,n){var i="".concat(e,",").concat(t);return n!==void 0&&n&&(i="(".concat(i,")")),i}constructor(e){wp(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:br.DEFAULT_TYPE,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return new this.dh.Column({index:n,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]:"",n=[],i=0;i<e;i+=1)n.push(this.makeColumn("".concat(t).concat(i),br.DEFAULT_TYPE,i));return n}static makeUserColumnWidths(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5,t=new Map,n=0;n<e;n+=1)t.set(n.toString(),100);return t}makeRow(e){var t=new this.dh.Row({index:e,name:"".concat(e)});return t.get=jest.fn(n=>br.valueForCell(e,n.index)),t}makeFilter(){return new this.dh.FilterCondition}makeSort(){return new this.dh.Sort}makeTable(){var{columns:e=this.makeColumns(),size:t=1e9,sort:n=[],layoutHints:i={}}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=new this.dh.Table({columns:e,size:t,sort:n});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,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=new this.dh.TreeTable({columns:e,size:t,sort:n});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,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;return new tC(i,e,t??new _r(i),n)}}wp(br,"DEFAULT_TYPE","java.lang.String");const rD=br;function kn(r,e,t){return e=iD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iD(r){var e=aD(r,"string");return typeof e=="symbol"?e:String(e)}function aD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qt=B.module("TableViewportUpdater"),sD=150;class Jt extends c.PureComponent{constructor(){super(...arguments),kn(this,"subscription",void 0),kn(this,"getViewportRowRange",se((e,t,n)=>{var i=n-t,a=Math.max(0,t-i*Jt.ROW_BUFFER_PAGES),s=n+i*Jt.ROW_BUFFER_PAGES;return[a,s]})),kn(this,"getViewportColumns",se((e,t,n,i)=>{if(t==null||n==null)return null;for(var a=n-t,s=Math.max(0,t-a*Jt.COLUMN_BUFFER_PAGES),o=Math.min(n+a*Jt.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[],d=s;d<=o;d+=1){var h=nC.getModelIndex(d,i);l.push(e.columns[h])}return l})),kn(this,"updateViewport",bi((e,t,n,i,a)=>{if(t<e){qt.error("Invalid viewport",e,t);return}if(e===0&&t===0){qt.debug2("Ignoring 0-0 viewport");return}var{movedColumns:s,table:o}=this.props,[l,d]=this.getViewportRowRange(o,e,t),h=a??this.getViewportColumns(o,n,i,s);if(qt.debug2("Setting Viewport Top:",l,"Bottom:",d,"Columns:",h),this.subscription==null){qt.debug2("updateViewport creating new subscription"),this.subscription=o.setViewport(l,d,h);var{onSubscription:v}=this.props;v(this.subscription)}else qt.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,d,h)},sD))}componentDidMount(){var{top:e,bottom:t,left:n,right:i,table:a,filters:s,sorts:o,columns:l,customColumns:d}=this.props;a.applyFilter(s),a.applySort(o),a.applyCustomColumns(d),this.updateViewport(e,t,n,i,l)}componentDidUpdate(e){var{top:t,bottom:n,left:i,right:a,table:s,filters:o,sorts:l,customColumns:d,columns:h}=this.props,v=o!==e.filters,f=l!==e.sorts,p=d!==e.customColumns,m=s!==e.table;(v||f||p||m)&&this.closeSubscription(),(v||m)&&(qt.debug("update table filter",o),s.applyFilter(o)),(f||m)&&(qt.debug("update table sort",l),s.applySort(l)),(p||m)&&(qt.debug("update table custom columns",d),s.applyCustomColumns(d)),this.updateViewport(t,n,i,a,h)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(qt.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}}kn(Jt,"ROW_BUFFER_PAGES",3);kn(Jt,"COLUMN_BUFFER_PAGES",1);kn(Jt,"defaultProps",{top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]});const oD=Jt;function Pa(r,e,t){return e=lD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lD(r){var e=dD(r,"string");return typeof e=="symbol"?e:String(e)}function dD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nr=B.module("TreeTableViewportUpdater"),uD=150;class _a extends c.PureComponent{constructor(e){super(e),Pa(this,"listenerCleanup",void 0),Pa(this,"updateViewport",bi((t,n)=>{if(n<t){nr.error("Invalid viewport",t,n);return}if(t===0&&n===0){nr.debug2("Ignoring 0-0 viewport");return}var{table:i,updateInterval:a}=this.props,s=n-t,o=Math.max(0,t-s*3),l=n+s*3+1;if(nr.debug2("Setting Viewport Top:",o,"Bottom:",l,i),!this.listenerCleanup){var{dh:d,onViewportUpdate:h}=this.props;this.listenerCleanup=i.addEventListener(d.TreeTable.EVENT_UPDATED,h)}i.setViewport(o,l,void 0,a)},uD)),this.listenerCleanup=null}componentDidMount(){var{top:e,bottom:t,table:n,filters:i,sorts:a}=this.props;nr.debug("componentDidMount",this.props),n.applyFilter(i),n.applySort(a),this.updateViewport(e,t)}componentDidUpdate(e){var{top:t,bottom:n,table:i,filters:a,sorts:s}=this.props;a!==e.filters&&(nr.debug("update table filter",a),i.applyFilter(a)),s!==e.sorts&&(nr.debug("update table sort",s),i.applySort(s)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}}Pa(_a,"UPDATE_INTERVAL",1e3);Pa(_a,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:_a.UPDATE_INTERVAL});const hD=_a,cD=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:Wc,AdvancedSettingsType:rC,AggregationEdit:iC,AggregationUtils:aC,Aggregations:sC,BarIcon:oC,ChartBuilder:lC,ColumnHeaderGroup:dC,CustomColumnBuilder:uC,DownloadServiceWorkerUtils:hC,FormatColumnWhereIcon:cC,FormatRowWhereIcon:vC,HistogramIcon:fC,InputEditor:pC,IrisGrid:Tr,IrisGridMetricCalculator:mC,IrisGridModel:Yt,IrisGridModelFactory:Ra,IrisGridPartitionedTableModel:gC,IrisGridRenderer:bC,IrisGridTableModel:Gc,IrisGridTableModelTemplate:CC,IrisGridTestUtils:rD,IrisGridThemeContext:SC,IrisGridThemeProvider:zc,IrisGridTreeTableModel:yC,IrisGridUtils:Ze,LineIcon:EC,OptionType:wC,PieIcon:PC,RollupRows:_C,SHORTCUTS:TC,ScatterIcon:OC,TableCsvExporter:DC,TableSaver:IC,TableViewportUpdater:oD,TreeTableViewportUpdater:hD,VisibilityOrderingBuilder:xC,createDefaultIrisGridTheme:NC,default:Tr,isIrisGridTableModelTemplate:aa,isPanelStateV1:MC,isPanelStateV2:LC,isPartitionedGridModel:FC,isPartitionedGridModelProvider:AC},Symbol.toStringTag,{value:"Module"}));function Dl(r,e,t){return e=vD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vD(r){var e=fD(r,"string");return typeof e=="symbol"?e:String(e)}function fD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ja{}Dl(Ja,"OPEN","ChartEvent.OPEN");Dl(Ja,"CLOSE","ChartEvent.CLOSE");Dl(Ja,"COLUMN_SELECTED","ChartEvent.COLUMN_SELECTED");const Ta=Ja;function Mi(r,e,t){return e=pD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pD(r){var e=mD(r,"string");return typeof e=="symbol"?e:String(e)}function mD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kr{}Mi(kr,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Mi(kr,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Mi(kr,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Mi(kr,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Mi(kr,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const pt=kr;function In(r,e,t){return e=gD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gD(r){var e=bD(r,"string");return typeof e=="symbol"?e:String(e)}function bD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class rn{}In(rn,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");In(rn,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");In(rn,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");In(rn,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");In(rn,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");In(rn,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");In(rn,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");In(rn,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Te=rn;function $r(r,e,t){return e=CD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function CD(r){var e=SD(r,"string");return typeof e=="symbol"?e:String(e)}function SD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Yn{}$r(Yn,"OPEN_GRID","IrisGridEvent.OPEN_GRID");$r(Yn,"CLOSE_GRID","IrisGridEvent.CLOSE_GRID");$r(Yn,"DATA_SELECTED","IrisGridEvent.DATA_SELECTED");$r(Yn,"COLUMN_SELECTED","IrisGridEvent.COLUMN_SELECTED");$r(Yn,"STATE_CHANGED","IrisGridEvent.STATE_CHANGED");$r(Yn,"CREATE_CHART","IrisGridevent.CREATE_CHART");const Et=Yn,Pp=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function an(r,e,t){return e=yD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yD(r){var e=ED(r,"string");return typeof e=="symbol"?e:String(e)}function ED(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Bt{}an(Bt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");an(Bt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");an(Bt,"CLOSE_FILE","NotebookEvent.closeFile");an(Bt,"RENAME","NotebookEvent.rename");an(Bt,"RENAME_FILE","NotebookEvent.renameFile");an(Bt,"REGISTER_FILE","NotebookEvent.registerFile");an(Bt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");an(Bt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");an(Bt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const he=Bt;function _p(r,e,t){return e=wD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wD(r){var e=PD(r,"string");return typeof e=="symbol"?e:String(e)}function PD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Il{}_p(Il,"OPEN","PandasEvent.OPEN");_p(Il,"CLOSE","PandasEvent.CLOSE");const _D=Il;function Ur(r,e,t){return e=TD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function TD(r){var e=OD(r,"string");return typeof e=="symbol"?e:String(e)}function OD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Xn{}Ur(Xn,"focus","TabEvent.focus");Ur(Xn,"blur","TabEvent.blur");Ur(Xn,"openPQObject","TabEvent.openPQObject");Ur(Xn,"openControl","TabEvent.openControl");Ur(Xn,"reload","TabEvent.reload");Ur(Xn,"clearAllFilters","TabEvent.clearAllFilters");const ri=Xn;function DD(r,e,t){return e=ID(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ID(r){var e=xD(r,"string");return typeof e=="symbol"?e:String(e)}function xD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Tp extends c.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var e,t,n,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(n=t.header)===null||n===void 0?void 0:n.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var n;return(n=(t==null?void 0:t.contentItem).container)===null||n===void 0?void 0:n.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=t.length-1;n>0;n-=1){var i,a,s,o,l,d,h;if(((i=t[n].contentItem)===null||i===void 0||(a=i.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(o=s.contentItem)===null||o===void 0||(l=o.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[n])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var a,s,o,l,d,h,v,f;if(((a=t[i].contentItem)===null||a===void 0||(s=a.config)===null||s===void 0?void 0:s.id)===((o=e.tab)===null||o===void 0||(l=o.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var p=!!(!((h=t[i])===null||h===void 0||(v=h.contentItem)===null||v===void 0||(f=v.config)===null||f===void 0)&&f.isClosable);if(p){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,a,s,o=!!(!((i=e[n])===null||i===void 0||(a=i.contentItem)===null||a===void 0||(s=a.config)===null||s===void 0)&&s.isClosable);if(o){t=!1;break}}return t}render(){var e,t,n,{additionalActions:i,glContainer:a}=this.props,s=[...i],o=(e=a.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(n=t.config)===null||n===void 0?void 0:n.isClosable;return s.push({title:"Close",order:10,group:ae.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ae.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ae.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ae,{actions:s})}}DD(Tp,"defaultProps",{additionalActions:[]});const ND=Tp;function Op(r,e,t){return e=MD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MD(r){var e=LD(r,"string");return typeof e=="symbol"?e:String(e)}function LD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dp extends c.PureComponent{constructor(e){super(e),Op(this,"renameInputRef",void 0),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=X.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:a}=this.state;return u.jsxs("form",{className:Y("p-3",{"was-validated":a}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:s=>{s.stopPropagation()},onMouseUp:s=>{s.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(n,"-input"),children:["Rename ",n]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(n,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(K,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(yi,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Op(Dp,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function fo(r,e,t){return e=FD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function FD(r){var e=AD(r,"string");return typeof e=="symbol"?e:String(e)}function AD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var RD=B.module("Panel");let Ip=class extends c.PureComponent{constructor(e){super(e),fo(this,"ref",void 0),fo(this,"getAdditionActions",se((n,i,a)=>{var s=[];return i&&s.push(this.getCloneAction()),a&&s.push(this.getRenameAction()),[...s,...n]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=X.createRef();var{glContainer:t}=this.props;this.state={title:A.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:n,glContainer:i,glEventHub:a}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),a.on(pt.SESSION_CLOSED,this.handleSessionClosed),a.on(pt.SESSION_OPENED,this.handleSessionOpened),a.on(ri.focus,this.handleTabFocus),a.on(ri.blur,this.handleTabBlur),a.on(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),a.emit(te.MOUNT,n??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:n}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),n.off(pt.SESSION_CLOSED,this.handleSessionClosed),n.off(pt.SESSION_OPENED,this.handleSessionOpened),n.off(ri.focus,this.handleTabFocus),n.off(ri.blur,this.handleTabBlur),n.off(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:A.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var n=A.getRootFromContainer(t),i=A.getComponentConfigFromContainer(t);z(i),A.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=A.getRootFromContainer(e),i=A.getComponentConfigFromContainer(e);if(i==null){RD.error("Could not get component config from container",e);return}var a=A.cloneComponent(n,i);a!==null&&t.emit(te.CLONED,this,a)}getCloneAction(){return{title:"Copy Panel",order:10,group:ae.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ae.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,additionalActions:a,errorMessage:s,isLoaded:o,isLoading:l,isClonable:d,isRenamable:h}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:m}=this.state;return u.jsxs("div",{className:Y("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(He,{errorMessage:s,isLoaded:o,isLoading:l}),!m&&v!=null&&xa.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(ND,{glContainer:i,additionalActions:this.getAdditionActions(a,d,h)}),h&&u.jsx(Dp,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&u.jsx(wt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}};fo(Ip,"defaultProps",{className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1});const Wt=Ip;function Li(r){var{widgetType:e,widgetName:t,glContainer:n,description:i,children:a}=r,s=A.getTitleFromContainer(n);return u.jsxs("div",{className:"tab-tooltip-grid-container",children:[u.jsxs("span",{className:"tab-tooltip-title",children:[e," Name"]}),u.jsxs("div",{className:"tab-tooltip-name-wrapper",children:[u.jsx("span",{className:"tab-tooltip-name",children:t}),u.jsx(Io,{className:"tab-tooltip-copy",tooltip:"Copy name",copy:t})]}),t!==s&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"tab-tooltip-title",children:"Display Name"}),u.jsx("span",{className:"tab-tooltip-name",children:s})]}),i&&u.jsx("div",{className:"tab-tooltip-description",children:i}),a]})}Li.propTypes={glContainer:Ya.Container.isRequired,widgetType:_.string,widgetName:_.string,description:_.string,children:_.node};Li.defaultProps={widgetType:"",widgetName:"",description:null,children:null};function xp(r,e,t){return e=jD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jD(r){var e=kD(r,"string");return typeof e=="symbol"?e:String(e)}function kD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Np extends c.PureComponent{constructor(e){super(e),xp(this,"getCachedRenderTabTooltip",se((t,n,i,a,s)=>t?()=>u.jsx(Li,{glContainer:n,widgetType:i,widgetName:a,description:s}):null)),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){var{widgetName:e}=this.props;Bc(e)}getErrorMessage(){var{errorMessage:e}=this.props,{isClientDisconnected:t,isPanelDisconnected:n,isWidgetDisconnected:i,isWaitingForReconnect:a}=this.state;if(e)return"".concat(e);if(t&&n&&a)return`Disconnected from server.
23
23
  Check your internet connection.`;if(t&&n)return"Disconnected from server.";if(n){var{widgetName:s,widgetType:o}=this.props;return'Variable "'.concat(s,`" not set.
24
- `).concat(o," does not exist yet.")}if(i){var{widgetName:l}=this.props;return"".concat(l," is unavailable.")}}handleSessionClosed(){var{onSessionClose:e}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),e(...arguments)}handleSessionOpened(){var{onSessionOpen:e}=this.props;e(...arguments)}render(){var{children:e,className:t,componentPanel:n,isLoaded:i,isLoading:a,glContainer:s,glEventHub:o,isDisconnected:l,isClonable:d,isRenamable:h,showTabTooltip:c,renderTabTooltip:f,widgetType:p,widgetName:m,description:b,onClearAllFilters:g,onHide:C,onFocus:y,onBlur:S,onResize:E,onShow:w,onTabBlur:I,onTabFocus:O,onTabClicked:T}=this.props,{isPanelDisconnected:N,isWidgetDisconnected:R,isPanelInactive:W}=this.state,L=this.getErrorMessage(),D=f??this.getCachedRenderTabTooltip(c,s,p,m,b),M=[{title:"Copy ".concat(p," Name"),group:ae.groups.medium,order:20,action:this.handleCopyName}];return u.jsxs(Wt,{className:Y(t,{disconnected:N||R||l,inactive:W}),componentPanel:n,glContainer:s,glEventHub:o,onClearAllFilters:g,onHide:C,onFocus:y,onBlur:S,onResize:E,onShow:w,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:O,onTabClicked:T,renderTabTooltip:D,errorMessage:L,isLoaded:i,isLoading:a,isClonable:d,isRenamable:h,additionalActions:M,children:[e,W&&u.jsx("div",{className:"fill-parent-absolute"})]})}}xp(Np,"defaultProps",{className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}});const Fi=Np,Nt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var kD=Object.freeze({}),$D=new Map,es=Object.freeze([]),xl=(r,e)=>{var t;return(t=Be(r,e).columns)!==null&&t!==void 0?t:es},Mp=(r,e)=>{var t;return(t=Be(r,e).filterSets)!==null&&t!==void 0?t:es},ts=(r,e)=>{var t;return(t=Be(r,e).filters)!==null&&t!==void 0?t:es},ns=(r,e)=>{var t;return(t=Be(r,e).tableMap)!==null&&t!==void 0?t:$D},rs=(r,e)=>Be(r,e).isolatedLinkerPanelId,Zn=(r,e)=>{var t;return(t=Be(r,e).links)!==null&&t!==void 0?t:es},is=(r,e)=>Be(r,e).columnSelectionValidator,UD=(r,e)=>{var t;return(t=Be(r,e).consoleSettings)!==null&&t!==void 0?t:kD},HD=(r,e)=>Be(r,e).connection,Hr=(r,e)=>Be(r,e).sessionWrapper,VD=(r,e)=>t=>t(At(r,{connection:e})),BD=(r,e)=>t=>t(At(r,{sessionWrapper:e})),as=(r,e)=>t=>t(At(r,{links:e})),Lp=(r,e)=>(t,n)=>{var i=Zn(n(),r),a=e.filter(s=>i.findIndex(o=>Mt(o.start,s.start)&&Mt(o.end,s.end))<0);return t(as(r,i.concat(a)))},Fp=(r,e)=>(t,n)=>{var i=Zn(n(),r),a=i.filter(s=>!e.includes(s.id));return t(as(r,a))},Nl=(r,e)=>t=>t(At(r,{isolatedLinkerPanelId:e})),Ap=(r,e)=>t=>t(At(r,{columnSelectionValidator:e})),Rp=(r,e)=>t=>t(At(r,{consoleSettings:e})),jp=(r,e)=>t=>t(At(r,{filterSets:e}));function kp(r){var{columnMap:e,inputFilterMap:t,linkedColumnMap:n,onAdd:i,onOpenLinker:a,waitingFilterMap:s,waitingInputMap:o}=r,l=v.useMemo(()=>{var m=Array.from(o.keys()),b=m.find(y=>t.get(y)!=null),g=m.find(y=>n.get(y)!=null),C=Ot.join(m.map(y=>'"'.concat(y,'"')));return b!=null&&b&&g!=null&&g?"Use a filter control or linked table to set a value for ".concat(C):b!=null&&b?"Set a filter control value for ".concat(C):"Double click a row in a linked table to set a value for ".concat(C)},[t,n,o]),d=v.useMemo(()=>Array.from(e.values()),[e]),h=v.useCallback(m=>{m.stopPropagation(),m.preventDefault(),i(Array.from(s.values()))},[i,s]),c=v.useCallback(m=>{m.stopPropagation(),m.preventDefault(),a()},[a]),f=s.size>0,p=!f&&o.size>0;return u.jsx("div",{className:"chart-panel-overlay chart-filter-overlay",children:u.jsxs("div",{className:Y("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":f},{"chart-filter-waiting-input":p}),children:[f&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),u.jsx("div",{className:"waiting-filter-list",children:d.map(m=>{var b=s.has(m.name),g=b?Oo:Jg;return u.jsxs("div",{className:Y("waiting-filter-item",{"is-invalid":b}),children:[u.jsx(ne,{icon:g}),m.name]},m.name)})}),u.jsxs("div",{children:[u.jsx(Hs,{onClick:h,className:"btn-primary",children:"Add Input Filters"}),u.jsx(Hs,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),p&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"info-message",children:"Waiting for User Input"}),u.jsx("div",{className:"",children:l})]})]})})}kp.propTypes={columnMap:_.instanceOf(Map).isRequired,inputFilterMap:_.instanceOf(Map).isRequired,linkedColumnMap:_.instanceOf(Map).isRequired,onAdd:_.func.isRequired,onOpenLinker:_.func.isRequired,waitingFilterMap:_.instanceOf(Map).isRequired,waitingInputMap:_.instanceOf(Map).isRequired};function pi(r){var{columns:e,onColumnSelected:t,onMouseEnter:n,onMouseLeave:i}=r;return u.jsx("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:u.jsxs("div",{className:Y("chart-panel-overlay-content"),children:[u.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),u.jsx("div",{className:"waiting-column-select-list",children:e.map(a=>u.jsx(Bo,{className:Y("btn-chart-column-selector",pi.makeButtonClassName(a.name)),onClick:()=>t(a.name),onMouseEnter:()=>{n&&n(a)},onMouseLeave:i,disabled:!a.isValid,isLinked:a.isActive,children:a.name},a.name))})]})})}pi.makeButtonClassName=r=>"btn-chart-column-selector-".concat(r);pi.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function Cr(r){return r.settings!==void 0}function Ml(r){return r.figure!==void 0}function $p(r){if(r==null)return!1;var{settings:e,tableSettings:t}=r;return typeof e=="object"&&typeof t=="object"}function Up(r){return r!=null&&$p(r.panelState)}function zu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ku(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zu(Object(t),!0).forEach(function(n){Dt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):zu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Dt(r,e,t){return e=WD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WD(r){var e=GD(r,"string");return typeof e=="symbol"?e:String(e)}function GD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var it=B.module("ChartPanel"),zD=150;function KD(r){return r.inputFilters!=null}function qD(r){return r.panelState!=null}class ss extends v.Component{constructor(e){super(e),Dt(this,"panelContainer",void 0),Dt(this,"pending",void 0),Dt(this,"getWaitingInputMap",se((s,o,l)=>{if(!s)return new Map;var d=new Map(o);return l.forEach((h,c)=>{d.delete(c)}),d})),Dt(this,"getWaitingFilterMap",se((s,o,l,d,h)=>{if(!s)return new Map;var c=new Map(o);return l.forEach((f,p)=>{c.delete(p)}),h.forEach((f,p)=>{c.delete(p)}),d.forEach((f,p)=>{c.delete(p)}),c})),Dt(this,"getInputFilterColumnMap",se((s,o)=>{for(var l=new Map,d=0;d<o.length;d+=1){var h=o[d],{name:c,type:f}=h,p=s.get(c);p!=null&&p.type===f&&l.set(c,h)}return l})),Dt(this,"getLinkedColumnMap",se((s,o)=>{for(var l=new Map,d=A.getIdFromPanel(this),h=0;h<o.length;h+=1){var c=o[h],f=null;if(c.start!=null&&c.start.panelId===d&&s.has(c.start.columnName)?f=c.start.columnName:c.end&&c.end.panelId===d&&s.has(c.end.columnName)&&(f=c.end.columnName),f!=null&&s.has(f)){var p=s.get(f);z(p),l.set(f,p)}}return l})),Dt(this,"getSelectorColumns",se((s,o,l)=>Array.from(s.values()).map(d=>({name:d.name,type:d.type,isValid:l?l(this,d):!1,isActive:o.has(d.name)})))),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=Le(this.updateModelFromSource.bind(this),zD),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=X.createRef(),this.pending=new Tn;var{metadata:t,panelState:n}=e,{filterValueMap:i=[],settings:a={}}=n??{};this.state={settings:a,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:t!=null&&Cr(t)&&t.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:n}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,t){var{inputFilters:n,source:i,makeModel:a}=this.props,{columnMap:s,model:o,filterMap:l,filterValueMap:d,isLinked:h,settings:c}=this.state;o&&(a!==e.makeModel&&this.initModel(),s!==t.columnMap&&this.pruneFilterMaps(),n!==e.inputFilters&&this.updateChangedInputFilters(n,e.inputFilters),l!==t.filterMap?this.updateFilters():d!==t.filterValueMap&&this.updatePanelState(),c!==t.settings&&to(o)&&(o.updateSettings(c),this.updatePanelState()),h!==t.isLinked?i&&(h?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):h&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();var{model:e}=this.state,{source:t}=this.props;e!=null&&t&&this.stopListeningToSource(t)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});var{makeModel:e}=this.props;this.pending.add(e(),t=>{t.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){it.debug("startListeningToSource",e);var{model:t}=this.state;z(t);var{dh:n}=t;e.addEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){it.debug("stopListeningToSource",e);var{model:t}=this.state;z(t);var{dh:n}=t;e.removeEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){var{isActive:e,isLoaded:t,isLoading:n}=this.state;e&&!t&&!n&&this.initModel()}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}handleColumnSelected(e){var{glEventHub:t}=this.props,{columnMap:n}=this.state;t.emit(Ta.COLUMN_SELECTED,this,n.get(e))}handleColumnMouseEnter(e){var{type:t,name:n}=e,{columnSelectionValidator:i}=this.props;it.debug("handleColumnMouseEnter",i,t,n),i&&i(this,{type:t,name:n})}handleColumnMouseLeave(){var{columnSelectionValidator:e}=this.props;it.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(var t=0;t<e.length;t+=1)this.openInputFilter(e[t])}handleOpenLinker(){var{localDashboardId:e,setActiveTool:t,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0),t(Nt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){it.debug("handleLoadSuccess");var{model:t}=this.state;this.setState({model:e,isLoaded:!0},()=>{var{inputFilters:n,source:i}=this.props,{filterMap:a,isLinked:s}=this.state;e!==t&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(n,a.size>0||e.isFilterRequired()),i&&s&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){Se.isCanceled(e)||(it.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){var{metadata:e,source:t}=this.props,{isLinked:n,model:i}=this.state;if(!n||!i||!t){it.debug2("updateModelFromSource ignoring",n,i,t);return}var{dh:a}=i;if(this.pending.cancel(),Cr(e)){var{settings:s}=e;this.pending.add(a.plot.Figure.create(new xe(a).makeFigureSettings(s,t))).then(o=>{to(i)&&i.setFigure(o)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){var{sourcePanel:e}=this.props,{panelState:t,filterValueMap:n,settings:i}=this.state,{tableSettings:a}=t??{};if(e&&KD(e.props)&&qD(e.state)){var{inputFilters:s}=e.props,{panelState:o}=e.state;o!=null&&(a=Ze.extractTableSettings(o,s))}this.setState({panelState:{settings:i,tableSettings:a,filterValueMap:Array.from(n)}})}handleError(){this.setState({isLoading:!1})}handleSettingsChanged(e){this.setState(t=>{var{settings:n}=t,i=Ku(Ku({},n),e);return it.debug("Updated settings",i),{settings:i}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){var e=this.isHidden();this.setActive(!e)}handleUpdate(e){var{isLoading:t}=e;this.setState({isLoading:t})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){var{glEventHub:t}=this.props,{name:n,type:i}=e;t.emit(Te.OPEN_INPUT,{title:"".concat(n," Filter"),panelState:{name:n,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&this.loadModelIfNecessary()})}sendColumnChange(){var{model:e}=this.state;if(e){var{glEventHub:t}=this.props;t.emit(Te.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}}getCoordinateForColumn(e){var t,n=pi.makeButtonClassName(e);if(!this.panelContainer.current)return null;var i=this.panelContainer.current.querySelector(".".concat(n)),a=(t=i==null?void 0:i.getBoundingClientRect())!==null&&t!==void 0?t:null;if(a==null||a.width<=0||a.height<=0)return null;var s=a.left+a.width/2,o=a.bottom;return[s,o]}setFilterMap(e){it.debug("setFilterMap",e),this.setState(t=>{var n,{columnMap:i,filterMap:a}=t,s=null,o=new Map(t.filterValueMap);return e.forEach((l,d)=>{var{columnType:h,filterList:c}=l,f=i.get(d);if(!(f==null||f.type!==h)){if(c.length<1){it.debug("Ignoring empty filterList for column",d);return}var{value:p}=c[0];o.set(d,p),a.get(d)!==p&&(s===null&&(s=new Map(a)),s.set(d,p))}}),{filterValueMap:o,filterMap:(n=s)!==null&&n!==void 0?n:a}})}unsetFilterValue(e){this.setState(t=>{var{inputFilters:n}=this.props,{columnMap:i}=t,{filterMap:a,filterValueMap:s}=t;if(!s.has(e))return null;s=new Map(t.filterValueMap),s.delete(e);var o=this.getInputFilterColumnMap(i,n);if(o.has(e)){var l,d=a.get(e),h=(l=o.get(e))===null||l===void 0?void 0:l.value;h!=null&&d!==h&&(a=new Map(t.filterMap),h.length>0?a.set(e,h):a.delete(e))}else a=new Map(t.filterMap),a.delete(e);return{filterMap:a,filterValueMap:s}})}updateChangedInputFilters(e,t){var n=t.filter(a=>e.find(s=>s.name===a.name&&s.type===a.type)===void 0);n.length>0&&this.deleteInputFilters(n);var i=e.filter(a=>!t.includes(a));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i}=n,a=new Map(n.filterValueMap),s=new Map(n.filterMap),o=t?{filterMap:s,filterValueMap:a}:{},l=0;l<e.length;l+=1){var{name:d,type:h,value:c}=e[l],f=i.get(d);f!=null&&f.type===h&&(c!=null&&s.get(d)!==c&&(c===""?s.delete(d):s.set(d,c),o.filterMap=s),a.has(d)&&(a.delete(d),o.filterValueMap=a))}return it.debug("updateInputFilters",o),o})}deleteInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i,filterValueMap:a}=n,s=new Map(n.filterMap),o=t,l=0;l<e.length;l+=1){var{name:d,type:h}=e[l],c=i.get(d);if(c!=null&&c.type===h&&s.has(d)){var f=s.get(d);if(a.has(d)){var p=a.get(d);p!==f&&p!=null&&(o=!0,s.set(d,p))}else o=!0,s.delete(d)}}return it.debug("deleteInputFilters",o),o?{filterMap:s}:null})}updateColumnFilters(){this.setState(e=>{var{model:t}=e;return t?{columnMap:t.getFilterColumnMap()}:null})}updateFilters(){var{columnMap:e,filterMap:t,model:n}=this.state;z(n);var i=this.getWaitingInputMap(n.isFilterRequired(),e,t);if(n.setFilter(t),t.size>0&&i.size===0){var a=n.getDefaultTitle(),s=Ot.join(Array.from(t.entries()).map(o=>{var[l,d]=o;return"".concat(l,": ").concat(d)}));a?n.setTitle("".concat(a,'<br><span style="font-size: smaller">').concat(s,"</span>")):n.setTitle(s),it.debug2("updateFilters filters set",t),this.setState({isLoading:!0})}else it.debug2("updateFilters waiting on inputs",i),n.setTitle(n.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{var{columnMap:t}=e,n=new Map(e.filterMap),i=new Map(e.filterValueMap),a={};return e.filterValueMap.forEach((s,o)=>{t.has(o)||(i.delete(o),a.filterValueMap=i)}),e.filterMap.forEach((s,o)=>{t.has(o)||(n.delete(o),a.filterMap=n)}),a})}render(){var{columnSelectionValidator:e,glContainer:t,glEventHub:n,inputFilters:i,isLinkerActive:a,links:s,metadata:o,settings:l,Plotly:d,containerRef:h}=this.props,{columnMap:c,filterMap:f,error:p,model:m,isActive:b,isDisconnected:g,isLoaded:C,isLoading:y}=this.state,S;Cr(o)?S=o.table:Ml(o)?S=o.figure:S=o.name;var E=this.getInputFilterColumnMap(c,i),w=this.getLinkedColumnMap(c,s),I=m!=null?this.getWaitingInputMap(m.isFilterRequired(),c,f):new Map,O=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),c,f,w,E):new Map,T=p!=null?"Unable to open chart. ".concat(p):void 0,N=I.size>0,R=c.size>0&&a;return u.jsx(Fi,{className:Y("iris-chart-panel",{"input-required":N}),componentPanel:this,glContainer:t,glEventHub:n,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:T,isDisconnected:g,isLoading:y,isLoaded:C,widgetName:S,widgetType:"Chart",children:u.jsxs("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[u.jsx("div",{className:"chart-container h-100 w-100",children:C&&m&&u.jsx(ul,{isActive:b,model:m,settings:l,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged,Plotly:d,containerRef:h})}),u.jsx(Hn,{in:N&&!R&&!y,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(kp,{inputFilterMap:E,linkedColumnMap:w,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:c,waitingFilterMap:O,waitingInputMap:I})}),u.jsx(Hn,{in:R,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(pi,{columns:this.getSelectorColumns(c,w,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Dt(ss,"defaultProps",{columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{},containerRef:null});Dt(ss,"displayName","ChartPanel");Dt(ss,"COMPONENT","ChartPanel");var YD=(r,e)=>{var{localDashboardId:t,metadata:n}=e,i;n!=null&&Cr(n)&&(i=n.sourcePanelId);var a=ns(r,t),s=yl(r,t),o=Cl(r),l=rs(r,t),d=o===Nt.LINKER&&l===void 0;return{columnSelectionValidator:is(r,t),isLinkerActive:d,inputFilters:ts(r,t),links:Zn(r,t),source:i!=null?a.get(i):void 0,sourcePanel:i!=null?s.get(i):void 0,settings:xi(r)}},XD=Pt(YD,{setActiveTool:Jf,setDashboardIsolatedLinkerPanelId:Nl},null,{forwardRef:!0})(ss);const Ai=XD;function Oa(r,e,t){return e=ZD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ZD(r){var e=QD(r,"string");return typeof e=="symbol"?e:String(e)}function QD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Xi=B.module("CommandHistoryPanel");class Ri extends v.Component{static handleError(e){Xi.error(e)}constructor(e){super(e),Oa(this,"container",void 0),Oa(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=X.createRef(),this.pending=new Tn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:et.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(pt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(pt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:n,language:i}=this.state;if(Xi.debug("handleSendToNotebook",n,e),!n){Xi.error("Session is not connected.");return}var{glEventHub:a}=this.props;a.emit(t?he.CREATE_NOTEBOOK:he.SEND_TO_NOTEBOOK,n,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Xi.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(pt.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;z(t),z(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(Ri.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:a,table:s}=this.state;return u.jsxs(Wt,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!s&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),s&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(GO,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:n}),u.jsx(ae,{actions:a})]})]})}}Oa(Ri,"COMPONENT","CommandHistoryPanel");Oa(Ri,"TITLE","Command History");var JD=(r,e)=>{var t=Kf(r),n=Hr(r,e.localDashboardId),{session:i,config:a}=n??{},{type:s,id:o}=a??{};return{commandHistoryStorage:t,language:s,session:i,sessionId:o}},eI=Pt(JD,null,null,{forwardRef:!0})(Ri);const Hp=eI;function qu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Zi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qu(Object(t),!0).forEach(function(n){$n(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function $n(r,e,t){return e=tI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tI(r){var e=nI(r,"string");return typeof e=="symbol"?e:String(e)}function nI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qi=B.module("ConsolePanel"),rI=500,iI=Object.freeze({consoleSettings:{},itemIds:[]});class os extends v.PureComponent{constructor(e){super(e),$n(this,"consoleRef",void 0),$n(this,"objectSubscriptionCleanup",void 0),$n(this,"savePanelState",Le(()=>{var{consoleSettings:s,itemIds:o}=this.state,l={consoleSettings:s,itemIds:[...o]};Qi.debug("Saving panel state",l),this.setState({panelState:l})},rI)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=X.createRef();var{panelState:t}=e,n=Zi(Zi({},iI),t||{}),{consoleSettings:i,itemIds:a}=n;this.state={consoleSettings:i,itemIds:new Map(a),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:i}=this.state;(t.consoleSettings!==n||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(n=>{Qi.debug("Got updates",n),this.setState(i=>{var{objectMap:a}=i,{updated:s,created:o,removed:l}=n,d=[...s,...l],h=new Map(a);d.forEach(f=>{var{title:p}=f;p!==void 0&&h.delete(p)});var c=[...s,...o];return c.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,a=new Map(i);return a.set(e,t),{itemIds:a}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,i=n.get(e);return i==null&&t&&(i=ye.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,i,{itemIds:a}=this.state,s=e==null||(t=e.props)===null||t===void 0?void 0:t.id,o=e==null||(n=e.props)===null||n===void 0||(i=n.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(s&&o){var l=new Set(a.values());l.has(o)&&this.setItemId(s,s)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(pt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&A.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,n)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Qi.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(pt.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;z(n);var{config:i,session:a}=n,{title:s}=e;z(s);var o=this.getItemId(s),l={fetch:()=>a.getObject(e),panelId:o,widget:Zi(Zi({},Lv(e)),{},{sessionId:i.id})};Qi.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,n,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var a=[...n.values()],{glEventHub:s}=this.props;a.forEach(o=>{s.emit(te.CLOSE,o)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(n=>Xs(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Xs(i,e));return n!=null?sf(n):u.jsx(TT,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:a,unzip:s}=this.props;if(i==null)return u.jsx(He,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:o,error:l,objectMap:d}=this.state,{config:h,session:c,connection:f,details:p={},dh:m}=i,{workerName:b,processInfoId:g}=p,{id:C,type:y}=h;return u.jsx(Wt,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(DO,{dh:m,ref:this.consoleRef,settings:o,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:y,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:dp.LANGUAGE_MAP.get(y)}),b!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),b]}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g,u.jsx("div",{children:"•"})]}),u.jsx(JO,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:C,timeZone:a,objectMap:d,unzip:s,supportsType:this.supportsType,iconForType:this.iconForType})})}}$n(os,"COMPONENT","ConsolePanel");$n(os,"TITLE","Console");$n(os,"contextType",qa);var aI=(r,e)=>({commandHistoryStorage:Kf(r),sessionWrapper:Hr(r,e.localDashboardId),timeZone:bl(r),plugins:i_(r)}),sI=Pt(aI,null,null,{forwardRef:!0})(os);const oa=sI;function It(r,e,t){return e=oI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oI(r){var e=lI(r,"string");return typeof e=="symbol"?e:String(e)}function lI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ji=B.module("DropdownFilter"),dI=150;class tn extends v.Component{constructor(e){super(e),It(this,"dropdownRef",void 0),It(this,"getCompatibleColumns",se((a,s)=>a!=null?s.filter(o=>{var{type:l}=o;return l!==void 0&&Ne.isCompatibleType(l,a.columnType)}):[])),It(this,"getColumnOptions",se((a,s)=>{var o=-1,l=[];return l.push(u.jsx("option",{value:"-1",children:"Select a column"},"placeholder")),a.forEach((d,h)=>{l.push(u.jsx("option",{value:h,children:this.getItemLabel(a,h)},"".concat(d.name,"/").concat(d.type))),s!==null&&d.name===s.name&&d.type===s.type&&(o=h)}),[l,o]})),It(this,"getSelectedOptionIndex",se((a,s)=>a.indexOf(s))),It(this,"getValueOptions",se(a=>[u.jsx("option",{value:"-1",children:tn.PLACEHOLDER},"-1"),...a.map((s,o)=>u.jsx("option",{value:o,children:s??"(null)"},"".concat(o,"/").concat(s)))])),It(this,"getItemLabel",ot((a,s)=>{var{name:o,type:l}=a[s];if(s>0&&a[s-1].name===o||s<a.length-1&&a[s+1].name===o){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(o," (").concat(d,")")}return o})),It(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o??void 0})},dI)),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=X.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,id:ye(),selectedColumn:t,disableCancel:!n,isValueShown:n,value:i}}componentDidUpdate(e,t){var{source:n,values:i,isLoaded:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a&&(n!==e.source&&this.sourceUpdated(),i!==e.values&&o!==""&&!i.includes(o)&&this.resetValue(),l!==t.isValueShown&&l&&this.focusInput(),(s!==t.column||o!==t.value||l!==t.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var t=e;if(Ji.debug2("handleColumnChange",t),t!=null&&parseInt(t,10)<0){this.setState({selectedColumn:null});return}var{columns:n,source:i}=this.props,a=this.getCompatibleColumns(i,n);this.setState({selectedColumn:a[parseInt(t,10)]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),Ji.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){var t=e,n=parseInt(t,10),i="",{values:a}=this.props;n>=0&&n<a.length?i=a[n]:Ji.debug2("Selected default item"),Ji.debug2("handleValueChange",i),this.setState({value:i})}handleSettingsCancel(){this.setState(e=>{var{column:t}=e;return{selectedColumn:t,isValueShown:!0}})}handleSettingsSave(){this.setState(e=>{var{column:t,selectedColumn:n,value:i}=e;return{column:n,value:t===n?i:"",isValueShown:!0,disableCancel:!1}})}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState(e){var{name:t,type:n,value:i,isValueShown:a}=e,s=t!=null&&n!=null?{name:t,type:n}:null;this.setState(o=>{var{value:l,isValueShown:d}=o;return{column:s,value:i??l,isValueShown:a??d}})}render(){var e,{columns:t,disableLinking:n,isLinkerActive:i,isLoaded:a,source:s,onColumnSelected:o,onSourceMouseEnter:l,onSourceMouseLeave:d,values:h,settingsError:c}=this.props,{column:f,disableCancel:p,id:m,isValueShown:b,selectedColumn:g,value:C}=this.state,y=s===null,S=this.getCompatibleColumns(s,t),E=s!=null,w=(e=s==null?void 0:s.columnName)!==null&&e!==void 0?e:tn.SOURCE_BUTTON_PLACEHOLDER,I=f!=null?"".concat(f.name," Filter"):null,[O,T]=this.getColumnOptions(S,g),N=this.getValueOptions(h),R=this.getSelectedOptionIndex(h,C),W=!E||g==null,L=b&&!i,D="source-column-btn-".concat(m),M="filter-column-select-".concat(m);return u.jsxs($a,{className:"dropdown-filter fill-parent-absolute",isFlipped:L,children:[u.jsx("div",{className:"dropdown-filter-settings-card",children:u.jsxs("div",{className:"dropdown-filter-card-content",children:[u.jsxs("div",{className:"dropdown-filter-settings-grid",children:[u.jsx("label",{htmlFor:D,children:"Source Column"}),u.jsx(Bo,{id:D,isLinked:E,onClick:o,onMouseEnter:l,onMouseLeave:d,className:tn.SOURCE_BUTTON_CLASS_NAME,disabled:n,children:w}),u.jsx("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),u.jsx("label",{htmlFor:M,children:"Filter Column"}),u.jsx(Bn,{id:M,value:String(T),className:"custom-select",onChange:this.handleColumnChange,disabled:y,children:O}),u.jsx("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),c&&u.jsx("div",{className:"error-message text-center",children:c}),E&&u.jsxs("div",{className:"dropdown-filter-settings-buttons",children:[u.jsx(K,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:p||b||i,tooltip:i?"Cancel disabled while linker open":void 0,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:W||b||i,tooltip:i?"Save disabled while linker open":void 0,children:"Save"})]})]})}),u.jsx("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"dropdown-filter-column",children:u.jsx("div",{className:"dropdown-filter-column-title",children:I})}),u.jsxs("div",{className:"dropdown-filter-card-content",children:[u.jsx("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:u.jsx(Bn,{className:"custom-select",value:String(R),ref:this.dropdownRef,onChange:this.handleValueChange,onKeyDown:this.handleDropdownKeyPress,title:"Select Value",children:N})}),c&&u.jsx("div",{className:"error-message mt-3 text-center",children:c})]}),u.jsx("div",{className:"dropdown-filter-menu",children:u.jsx(K,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:u.jsx(ne,{icon:Fa,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}It(tn,"defaultProps",{column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}});It(tn,"PLACEHOLDER","Select a value...");It(tn,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector");It(tn,"SOURCE_BUTTON_PLACEHOLDER","Select a column");const Yu=tn;function Qe(r,e,t){return e=uI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uI(r){var e=hI(r,"string");return typeof e=="symbol"?e:String(e)}function hI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ce=B.module("DropdownFilterPanel"),cI=250,vI=(r,e)=>{var{localDashboardId:t}=e,n=A.getIdFromPanel({props:e}),i=ns(r,t),a=Zn(r,t),s=Cl(r),o=rs(r,t),l=s===Nt.LINKER&&(o===void 0||o===n),d=s===Nt.LINKER&&o!==void 0&&o!==n;return{columns:xl(r,t),columnSelectionValidator:is(r,t),dh:Gf(r),isLinkerActive:l,disableLinking:d,settings:xi(r),panelTableMap:i,dashboardLinks:a}},fI=Pt(vI,null,null,{forwardRef:!0});class Lt extends v.Component{constructor(e){super(e),Qe(this,"dateTimeFormatter",void 0),Qe(this,"dropdownFilterRef",void 0),Qe(this,"panelContainer",void 0),Qe(this,"pending",void 0),Qe(this,"cleanup",void 0),Qe(this,"columnFormats",void 0),Qe(this,"getCachedValues",ot((c,f,p)=>{var{type:m,name:b}=f;return m!==void 0&&Ne.isDateType(m)?c.map(g=>this.dateTimeFormatter.format(g)):c.map(g=>g!=null&&m!=null?p.getFormattedString(g,m,b):null)})),Qe(this,"getCachedPanelLinks",ot((c,f)=>{var p=A.getIdFromPanel(f);return Ce.debug("getCachedPanelLinks",c,p),c.filter(m=>{var b;return((b=m.end)===null||b===void 0?void 0:b.panelId)===p})})),Qe(this,"getCachedSource",ot(c=>{Ce.debug("getCachedSource",c);var f;if(c.length>0){var[p]=c;f=p.start,c.length>1&&Ce.error("Filter has more that one link",c)}return f})),Qe(this,"getCachedSourceTable",ot((c,f)=>{var p;if(Ce.debug("getCachedSourceTable",c,f),f==null)return null;var{panelId:m}=f;return(p=c.get(m))!==null&&p!==void 0?p:null})),Qe(this,"getCachedSourceColumn",ot((c,f)=>{var p;return Ce.debug("getCachedSourceColumn",c,f),c==null||f==null?null:(p=c.columns.find(m=>{var{name:b,type:g}=m;return b===f.columnName&&g===f.columnType}))!==null&&p!==void 0?p:null})),this.handleChange=Le(this.handleChange.bind(this),cI),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=X.createRef(),this.panelContainer=X.createRef(),this.pending=new Tn;var{dh:t,panelState:n,settings:i}=e;this.columnFormats=wn.getColumnFormats(i),this.dateTimeFormatter=new xo(t,{showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});var{value:a="",isValueShown:s=!1,name:o,type:l,timestamp:d}=n??{},h=o!=null&&l!=null?{name:o,type:l}:void 0;this.state={column:h,formatter:new _r(t,this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:a,timestamp:d,values:[],isValueShown:s,wasFlipped:!1,skipUpdate:!1,panelState:n,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();var{dashboardLinks:e,panelTableMap:t}=this.props,{column:n,value:i,timestamp:a}=this.state,s=this.getSourceTable(t,e);if(s!==null&&this.startListeningToSource(s),n!=null){var{name:o,type:l}=n;this.sendUpdate(o,l,i,a)}}componentDidUpdate(e,t){var{dashboardLinks:n,panelTableMap:i,settings:a}=this.props,{valuesTable:s}=this.state,o=this.getSource(n),l=this.getSourceTable(i,n),d=this.getSource(e.dashboardLinks),h=this.getSourceTable(e.panelTableMap,e.dashboardLinks);a!==e.settings&&a!==void 0&&this.updateFormatterSettings(a),s!==t.valuesTable&&t.valuesTable!=null&&(Ce.debug("Table in state modified, closing the old table."),t.valuesTable.close()),(l!==h||o!==d)&&this.updateValuesTable(),l!==h&&(h!==null&&this.stopListeningToSource(h),l!==null&&this.startListeningToSource(l))}componentWillUnmount(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);this.pending.cancel(),i!==null&&this.stopListeningToSource(i),this.cleanup&&this.cleanup(),n!=null&&n.close()}getCoordinateForColumn(){var e;if(this.panelContainer.current==null)return null;var t=this.panelContainer.current.querySelector(".".concat(Yu.SOURCE_BUTTON_CLASS_NAME)),n=(e=t==null?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null;if(n==null||n.width<=0||n.height<=0)return null;var i=n.left+n.width/2,a=n.bottom;return[i,a]}getSettingsErrorMessage(){var{sourceSize:e}=this.state;if(e>Lt.MAX_TABLE_SIZE)return"Table too large, must have fewer than ".concat(Lt.MAX_TABLE_SIZE," options.")}getPanelErrorMessage(){var{error:e}=this.state;return e!=null?"".concat(e):void 0}getSource(e){var t=this.getCachedPanelLinks(e,this);return this.getCachedSource(t)}getSourceTable(e,t){var n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(e,t){var n=this.getSource(t);return this.getCachedSourceColumn(e,n)}startListeningToSource(e){var{dh:t}=this.props;Ce.debug("startListeningToSource"),e.addEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){var{dh:t}=this.props;Ce.debug("stopListeningToSource"),e.removeEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,{name:a=void 0,type:s=void 0}=t??{},o=!0,l=Date.now();this.setState(d=>{var h,c,{panelState:f,timestamp:p,wasFlipped:m,skipUpdate:b}=d,g=f!=null&&n!==f.isValueShown&&a===f.name&&s===f.type&&i===f.value;return o=(h=!b&&n&&(!g||!m))!==null&&h!==void 0?h:!1,o||(l=p),{panelState:{isValueShown:n,name:a,type:s,value:i,timestamp:(c=l)!==null&&c!==void 0?c:void 0},timestamp:l,wasFlipped:g,skipUpdate:!1}},()=>{o&&this.sendUpdate(a??null,s,i,l)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange(e){var{detail:t}=e;this.setState({sourceSize:t})}handleColumnSelected(){Ce.debug("handleColumnSelected");var{glEventHub:e}=this.props;e.emit(Te.COLUMN_SELECTED,this,Lt.SOURCE_COLUMN)}handleClearAllFilters(){var e,t;(e=this.dropdownFilterRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.clearFilter()}setPanelState(e){var t,n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{dashboardLinks:a}=this.props;if(this.getSource(a)==null){Ce.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!i}),(t=this.dropdownFilterRef)===null||t===void 0||(n=t.current)===null||n===void 0||n.setFilterState(e)}sendUpdate(e,t,n,i){var a,{dashboardLinks:s,glEventHub:o}=this.props,l=(a=this.getSource(s))===null||a===void 0?void 0:a.panelId,d=l===null?[]:[l];Ce.debug("sendUpdate",{name:e,type:t,value:n,timestamp:i,excludePanelIds:d}),o.emit(Te.FILTERS_CHANGED,this,{name:e,type:t,value:n??"=null",timestamp:i,excludePanelIds:d})}updateValuesTable(){var{dashboardLinks:e,panelTableMap:t}=this.props,n=this.getSource(e),i=this.getSourceTable(t,e);if(Ce.debug("updateValuesTable",n,i),this.setState({values:[],valuesTable:void 0,error:null}),n==null){Ce.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),i!=null&&(this.setState({isLoaded:!1,sourceSize:i.size}),this.pending.add(i.copy(),a=>a.close()).then(a=>{this.updateViewportListener(a),this.setState({valuesTable:a})}).catch(a=>{Se.isCanceled(a)||(Ce.error(a),this.setState({isLoading:!1,error:a}))}))}applySourceSorts(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Ce.debug("applySourceSorts",i==null?void 0:i.sort),n==null||i==null){Ce.debug("Table not initialized");return}var a=[...i.sort];n.applySort(a),this.setViewport(n)}applySourceFilters(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Ce.debug("applySourceFilters",i==null?void 0:i.filter),n==null||i==null){Ce.debug("Table not initialized");return}var a=[...i.filter];n.applyFilter(a),this.setViewport(n)}updateViewportListener(e){var{dh:t}=this.props;if(Ce.debug("updateViewportListener",e==null?void 0:e.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=void 0;return}this.cleanup=e.addEventListener(t.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){var{dashboardLinks:t}=this.props,n=this.getValuesColumn(e,t);if(!n){Ce.error("values column is null");return}e.setViewport(0,Lt.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(e){var{dh:t}=this.props,n=wn.getColumnFormats(e);Mt(this.columnFormats,n)||(this.columnFormats=n,this.setState({formatter:new _r(t,n)}))}handleValuesTableUpdate(e){var{detail:t}=e,{rows:n}=t,{dashboardLinks:i}=this.props,{valuesTable:a}=this.state;if(!a){Ce.error("valuesTable is null");return}var s=this.getValuesColumn(a,i);if(!s){Ce.error("Values column not found");return}var o=n.map(l=>l.get(s));this.setState({values:o,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){var{columnSelectionValidator:e}=this.props;e&&e(this,Lt.SOURCE_COLUMN)}handleSourceMouseLeave(){var{columnSelectionValidator:e}=this.props;e&&e(this,void 0)}render(){var{columns:e,dashboardLinks:t,disableLinking:n,glContainer:i,glEventHub:a,isLinkerActive:s}=this.props,{column:o,formatter:l,isDisconnected:d,isValueShown:h,value:c,values:f,valuesColumn:p,isLoading:m,isLoaded:b}=this.state,g=this.getSource(t),C=this.getSettingsErrorMessage(),y=this.getPanelErrorMessage(),S=b&&p!=null?this.getCachedValues(f,p,l):[];return u.jsx(Fi,{errorMessage:y,isLoading:m,isLoaded:b,isDisconnected:d,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:u.jsx("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:u.jsx(Yu,{ref:this.dropdownFilterRef,column:o,columns:e,isValueShown:h,isLinkerActive:s,disableLinking:n,isLoaded:b,settingsError:C,source:g,value:c,values:S,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}}Qe(Lt,"displayName","DropdownFilterPanel");Qe(Lt,"COMPONENT","DropdownFilterPanel");Qe(Lt,"MAX_TABLE_SIZE",256);Qe(Lt,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));var pI=fI(Lt);const Pn=pI;function mt(r){return r.type==="directory"}function mI(r,e,t){return e=gI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gI(r){var e=bI(r,"string");return typeof e=="symbol"?e:String(e)}function bI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class CI extends Error{constructor(){super("No file exists at the path specified"),mI(this,"isFileNotFound",!0)}}const ls=CI;function Xu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Zu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Xu(a,n,i,s,o,"next",l)}function o(l){Xu(a,n,i,s,o,"throw",l)}s(void 0)})}}var Zt;(function(r){r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN=""})(Zt||(Zt={}));class $t{static fileExists(e,t){return Zu(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof ls))throw n;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!$t.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var a=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(a,".").concat(n):a}static getUniqueCopyFileName(e,t){return Zu(function*(){for(var n=$t.getCopyFileName(t);yield $t.fileExists(e,n);)n=$t.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return Zt.GROOVY;case"py":return Zt.PYTHON;case"pyc":return Zt.PYTHON_COMPILED;case"scala":return Zt.SCALA;case"txt":return Zt.PLAIN_TEXT;default:return Zt.UNKNOWN}}static getParent(e){if(!$t.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!$t.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,a=$t.fileExtensionToString(t);return"".concat(i).concat(a)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new si("Name cannot be empty");if(t.includes(e))throw new si('"'.concat(e,'" is a reserved name'));if(n.test(e)){var a,s;throw new si('Invalid characters in name: "'.concat((a=(s=e.match(n))===null||s===void 0?void 0:s.reduce((o,l)=>o.includes(l)?o:[...o,l],[]).map(o=>i.has(o)?i.get(o):o).join('", "'))!==null&&a!==void 0?a:"",'"'))}}static reducePaths(e){var t=e.filter(n=>$t.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const ee=$t;var Ll=26;function po(r){return mt(r)?ee.makePath(r.filename):ee.getPath(r.filename)}function Qu(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=po(e);if(r.some(n=>{var{filename:i}=n;return ee.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>mt(n)&&t.startsWith(ee.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function SI(r){if(mt(r))return r.isExpanded?eb:tb;var e=ee.getMimeType(r.basename);switch(e){case Zt.PYTHON:return rb;default:return nb}}function mo(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:a,isSelected:s,item:o,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:f,onDrop:p}=r,m=(e=n==null?void 0:n.some(O=>O.id===o.id))!==null&&e!==void 0?e:!1,b=po(o),g=i&&d?po(d):null,C=i&&a&&mt(o)&&g===b,y=i&&a&&g===b,S=i&&!a&&g===b,E=SI(o),w=ee.getDepth(o.filename),I=Array(w).fill(null).map((O,T)=>u.jsx("span",{className:"file-list-depth-line"},T));return u.jsxs("div",{className:Y("d-flex w-100 align-items-center","file-list-item",{"is-dragged":m,"is-exact-drop-target":C,"is-in-drop-target":y,"is-invalid-drop-target":S,"is-selected":s}),onDragStart:O=>h(l,O),onDragOver:O=>c(l,O),onDragEnd:O=>f(l,O),onDrop:O=>p(l,O),draggable:!0,role:"presentation","aria-label":o.basename,children:[I," ",u.jsx(ne,{icon:E,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[o.basename,u.jsx(wt,{children:o.basename})]})})]})}function Ju(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ea(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ju(Object(t),!0).forEach(function(n){yI(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ju(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yI(r,e,t){return e=EI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function EI(r){var e=wI(r,"string");return typeof e=="symbol"?e:String(e)}function wI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ye=B.module("FileList"),PI=500,eh="item-list-scroll-pane";function _I(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:a,onSelectionChange:s=()=>{},renderItem:o=mo,rowHeight:l=Ll,overscanCount:d=wr.DEFAULT_OVERSCAN}=r,[h,c]=v.useState(()=>({items:[],offset:0,itemCount:0})),[f,p]=v.useState({top:0,bottom:0}),[m,b]=v.useState(),[g,C]=v.useState(),[y,S]=v.useState(),[E,w]=v.useState([]),I=v.useRef(),O=v.useRef(null),T=v.useRef(null),N=v.useCallback($=>{if($.length===0||h==null)return[];for(var J=[],ie=0;ie<$.length;ie+=1)for(var ve=$[ie],Ee=ve[0];Ee<=ve[1];Ee+=1)Ee>=h.offset&&Ee<h.offset+h.items.length&&J.push(h.items[Ee-h.offset]);return J},[h]),R=v.useCallback($=>{var J=N([[$,$]]);if(J.length>0)return J[0]},[N]),W=v.useCallback(()=>{var $=ua.count(E);if($===0)return null;if($===1){var J=E[0][0],ie=R(J);if(ie!=null)return ie.filename}return"".concat($," items")},[R,E]),L=v.useCallback($=>{if(!(!g||!m)){Ye.debug("dropItems",g,"to",$);try{var{files:J,targetPath:ie}=Qu(g,m);if(i==null||i(J,ie),$!=null){var ve;w([[$,$]]),(ve=O.current)===null||ve===void 0||ve.focusItem($)}}catch(Ee){Ye.error("Unable to complete move",Ee)}}},[g,m,i]),D=v.useCallback(($,J)=>{var ie=h.items[$-h.offset];ie!==void 0&&(Ye.debug("handleItemClick",ie),a(ie,J),mt(ie)&&(t==null||t.setExpanded(ie.filename,!ie.isExpanded)))},[h,a,t]),M=v.useCallback(($,J)=>{var ie;Ye.debug2("handleItemDragStart",$,E);var ve=E;ua.isSelected(E,$)||(ve=[[$,$]],w(ve)),C(N(ve)),(ie=O.current)===null||ie===void 0||ie.resetMouseState();var Ee=document.createElement("div");Ee.innerHTML='<div class="dnd-placeholder-content">'.concat(W(),"</div>"),Ee.className="file-list-dnd-placeholder",document.body.appendChild(Ee),J.dataTransfer.setDragImage(Ee,0,0),J.dataTransfer.effectAllowed="move",S(Ee)},[W,N,E]),F=v.useCallback(($,J)=>{J.preventDefault(),Ye.debug2("handleItemDragOver",J),b(R($))},[R]),k=v.useCallback(($,J)=>{Ye.debug("handleItemDragEnd",$),y==null||y.remove(),C(void 0),b(void 0),S(void 0)},[y]),H=v.useCallback(($,J)=>{L($)},[L]),q=v.useCallback(()=>{Ye.debug2("handleItemDragExit"),b(void 0)},[]),re=v.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(eh)&&($.preventDefault(),Ye.debug2("handleListDragOver",$),b({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),V=v.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(eh)&&(Ye.debug("handleListDrop"),L())},[L]),x=v.useCallback(function($){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ye.debug2("handleSelectionChange",$),J===!0||$!==E){w($);var ie=N($);s(ie)}},[N,s,E]),P=v.useCallback($=>{if(Ye.debug2("handleFocusChange",$),$!=null){var[J]=N([[$,$]]);n(J)}else n();I.current=$},[N,n]),j=v.useCallback(($,J)=>{Ye.debug("handleViewportChange",$,J),($!==f.top||J!==f.bottom)&&p({top:$,bottom:J})},[f]),U=v.useMemo(()=>{if(!g||!m)return!1;try{return Qu(g,m),Ye.debug("handleValidateDropTarget true"),!0}catch{return Ye.debug("handleValidateDropTarget false"),!1}},[g,m]),{focusedPath:Q}=r;v.useEffect(()=>{Q!==void 0&&(Q==="/"?t.collapseAll():(t.setExpanded(Q,!1),t.setExpanded(Q,!0)))},[t,Q]),v.useEffect(function(){Ye.debug("updating table viewport",f),t==null||t.setViewport({top:Math.max(0,f.top-d),bottom:f.bottom+d})},[d,t,f]),v.useEffect(function(){var J=t.onUpdate(ie=>{c({items:ie.items.map(ve=>ea(ea({},ve),{},{itemName:ve.basename})),offset:ie.offset,itemCount:t.size})});return()=>{J()}},[t]),v.useEffect(function(){I.current!=null&&P(I.current),E.length>0&&x(E,!0)},[h,P,x,E]),v.useEffect(function(){if(m!=null&&mt(m)&&m.filename!=="/"){var J=setTimeout(()=>{m.isExpanded||t==null||t.setExpanded(m.filename,!0)},PI);return()=>clearTimeout(J)}},[m,t]);var me=v.useCallback($=>o(ea(ea({},$),{},{isDragInProgress:g!=null,dropTargetItem:m,draggedItems:g,isDropTargetValid:U,onDragStart:M,onDragEnd:k,onDragOver:F,onDragExit:q,onDrop:H})),[k,q,F,M,H,g,m,U,o]);return u.jsx("div",{ref:T,className:Y("file-list",{"is-dragging":g!=null}),onDragOver:re,onDrop:V,children:u.jsx(wr,{ref:O,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:P,onSelect:D,onSelectionChange:x,onViewportChange:j,selectedRanges:E,renderItem:me,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var TI={name:"File Explorer",DELETE:qe.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[fe.DELETE],macShortcut:[pe.CMD,fe.BACKSPACE]}),RENAME:qe.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]})};const th={FILE_EXPLORER:TI};var nh=B.module("FileListItemEditor"),OI=()=>Promise.resolve();function DI(r){var{item:e,onCancel:t,onSubmit:n,validate:i=OI}=r,a=v.useRef(null),[s,o]=v.useState(e.basename),[l,d]=v.useState(),[h,c]=v.useState(Promise.resolve()),f=v.useCallback(()=>{var y;(y=a.current)===null||y===void 0||y.focus()},[a]),p=v.useCallback(y=>y.stopPropagation(),[]),m=v.useCallback(()=>{h.then(()=>{n(s)}).catch(y=>nh.info("Unable to validate name",y))},[n,s,h]);v.useEffect(function(){var S=Se.makeCancelable(i(s));return S.then(()=>d(void 0)).catch(E=>{Se.isCanceled(E)||d(E)}),c(S),()=>S.cancel()},[i,s]),v.useEffect(function(){f()},[f]);var b=v.useCallback(()=>{nh.debug2("handleBlur"),m()},[m]),g=v.useCallback(y=>{var{value:S}=y.target;o(S)},[]),C=v.useCallback(y=>{y.stopPropagation();var{key:S}=y;switch(S){case"Enter":{m();break}case"Escape":{t();break}}},[t,m]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:Y("form-control file-list-item-editor-input",{"is-invalid":l}),value:s,ref:a,onBlur:b,onKeyDown:C,onChange:g,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function rh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ms(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rh(Object(t),!0).forEach(function(n){II(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function II(r,e,t){return e=xI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xI(r){var e=NI(r,"string");return typeof e=="symbol"?e:String(e)}function NI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Vp(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:a,onCopy:s,onDelete:o,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:f,rowHeight:p=Ll,validateRename:m=()=>Promise.resolve()}=r,[b,g]=v.useState(),[C,y]=v.useState([]),[S,E]=v.useState(),w=v.useCallback(H=>{y(H),c==null||c(H)},[c]),I=v.useCallback(H=>{E(H)},[]),O=v.useCallback(()=>{S&&(s==null||s(S))},[S,s]),T=v.useCallback(()=>{C.length>0&&(o==null||o(C))},[o,C]),N=v.useCallback(()=>{i==null||i()},[i]),R=v.useCallback(()=>{S&&(a==null||a(ee.getPath(S.filename)))},[S,a]),W=v.useCallback(()=>{S&&g(S)},[S]),L=v.useCallback(()=>{g(void 0)},[]),D=v.useCallback(H=>{b&&(d==null||d(b,H),g(void 0))},[d,b]),M=v.useMemo(()=>{if(b)return[];var H=[];return i&&H.push({title:"New File",description:"Create new file",action:N,group:ae.groups.medium}),a&&H.push({title:"New Folder",description:"Create new folder",action:R,group:ae.groups.medium}),s&&H.push({title:"Copy File",description:"Copy the selected file",action:O,group:ae.groups.low,disabled:S==null||mt(S)}),o&&C.length>0&&H.push({title:"Delete",description:"Delete",shortcut:th.FILE_EXPLORER.DELETE,action:T,group:ae.groups.low}),d&&H.push({title:"Rename",description:"Rename",shortcut:th.FILE_EXPLORER.RENAME,action:W,group:ae.groups.low,disabled:S==null}),H},[O,T,N,R,W,S,s,i,a,o,d,C,b]),F=v.useCallback(H=>(z(b),m(b,H)),[b,m]),k=v.useCallback(H=>{var{item:q}=H;return b&&b.filename===q.filename?u.jsx(mo,Ms(Ms({},H),{},{children:u.jsx(DI,{item:q,validate:F,onSubmit:D,onCancel:L})})):u.jsx(mo,Ms({},H))},[L,D,b,F]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(_I,{onMove:l,onSelect:h,onSelectionChange:w,onFocusChange:I,renderItem:k,rowHeight:p,table:f,isMultiSelect:e,focusedPath:t}),n&&u.jsx(ae,{actions:M})]})}Vp.displayName="FileListContainer";function ih(r,e,t){return e=MI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MI(r){var e=LI(r,"string");return typeof e=="symbol"?e:String(e)}function LI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class FI extends si{constructor(e){super("Name already exists"),ih(this,"isExistingFile",!0),ih(this,"info",void 0),this.info=e}}const la=FI;function ah(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function sh(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){ah(a,n,i,s,o,"next",l)}function o(l){ah(a,n,i,s,o,"throw",l)}s(void 0)})}}var jt=B.module("FileExplorer");function Fl(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:a=()=>{},onRename:s=()=>{},onCreateFile:o=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Ll}=r,[f,p]=v.useState([]),[m,b]=v.useState();v.useEffect(function(){var D;function M(){return F.apply(this,arguments)}function F(){return F=sh(function*(){jt.debug("initTable"),D=Se.makeCancelable(e.getTable(),k=>k.close());try{b(yield D)}catch(k){Se.isCanceled(k)||jt.error("Unable to initialize table",k)}}),F.apply(this,arguments)}return M(),()=>{D.cancel()}},[e]);var g=v.useCallback(L=>{Se.isCanceled(L)||jt.error(L)},[]),C=v.useCallback(()=>{jt.debug("handleCreateFile"),o()},[o]),y=v.useCallback(()=>{jt.debug("handleCreateFolder"),l()},[l]),S=v.useCallback(L=>{jt.debug("handleCopyFile",L.filename),i(L)},[i]),E=v.useCallback(L=>{jt.debug("handleDelete, pending confirmation",L),p(L)},[]),w=v.useCallback(()=>{jt.debug("handleDeleteConfirm",f),f.forEach(L=>e.deleteFile(mt(L)?ee.makePath(L.filename):L.filename)),a(f),p([])},[f,a,e]),I=v.useCallback(()=>{jt.debug("handleDeleteCancel"),p([])},[]),O=v.useCallback((L,D)=>{var M=ee.reducePaths(L.map(F=>mt(F)?ee.makePath(F.filename):F.filename));M.forEach(F=>{var k=ee.isPath(F)?"".concat(D).concat(ee.getBaseName(F.substring(0,F.length-1)),"/"):"".concat(D).concat(ee.getBaseName(F));e.moveFile(F,k).then(()=>{s(F,k)}).catch(g)})},[g,s,e]),T=v.useCallback((L,D)=>{var M=L.filename,F=mt(L);F&&!M.endsWith("/")&&(M="".concat(M,"/"));var k="".concat(ee.getParent(M)).concat(D);F&&!k.endsWith("/")&&(k="".concat(k,"/")),jt.debug2("handleRename",M,k),e.moveFile(M,k).catch(g),s(M,k)},[g,s,e]),N=v.useCallback(function(){var L=sh(function*(D,M){if(M!==D.basename){ee.validateName(M);var F="".concat(ee.getPath(D.filename)).concat(M);try{var k=yield e.info(F);throw new la(k)}catch(H){if(!(H instanceof ls))throw H}}});return function(D,M){return L.apply(this,arguments)}}(),[e]),R=f.length>0,W=v.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return u.jsxs("div",{className:"file-explorer",children:[m&&u.jsx(Vp,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:S,onCreateFolder:y,onCreateFile:C,onMove:O,onDelete:E,onRename:T,onSelect:d,onSelectionChange:h,rowHeight:c,table:m,validateRename:N}),u.jsx(_n,{isOpen:R,headerText:W,bodyText:"You cannot undo this action.",onCancel:I,onConfirm:w,confirmButtonText:"Delete"})]})}Fl.displayName="FileExplorer";function oh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function AI(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){oh(a,n,i,s,o,"next",l)}function o(l){oh(a,n,i,s,o,"throw",l)}s(void 0)})}}function mn(r,e,t){return e=RI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function RI(r){var e=jI(r,"string");return typeof e=="symbol"?e:String(e)}function jI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Mn=B.module("NewItemModal");class Un extends v.PureComponent{static getValidationMessage(e){return e instanceof la&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Se.isCanceled(e)||Mn.error(e)}constructor(e){super(e),mn(this,"inputRef",X.createRef()),mn(this,"cancelableValidatePromise",void 0),mn(this,"cancelableExistingItemPromise",void 0),mn(this,"pending",new Tn),mn(this,"pathMap",new Map),mn(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,n=ee.hasPath(t)?ee.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:ee.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ee.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:a,path:s}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(s!==t.path||a!==t.value)&&this.updateValidationStatus(s,a),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=ee.hasPath(e)?ee.getPath(e):"/";this.setState({path:t,value:ee.getBaseName(e),validationError:void 0,prevExtension:ee.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Se.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return AI(function*(){ee.validateName(t);var{defaultValue:a,storage:s}=i.props;if(n){var o="".concat(e).concat(t);if(o!==a)try{var l=yield s.info(o);throw new la(l)}catch(d){if(!(d instanceof ls))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Un.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(Mn.debug("handleSelect",e),e.type==="directory")this.setState({path:ee.makePath(e.filename)});else{var t=e.basename,n=ee.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof si))throw e;Mn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:n}=this.state;Mn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){Mn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=ee.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Mn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:n}=e,i=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:i,path:a}=t,{notifyOnExtensionChange:s,type:o}=this.props;Mn.debug("submitModal",n,i);var l=ee.getExtension(i);return s&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(a,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(a).concat(i))}).catch(d=>{if(d instanceof la&&o!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Se.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(Un.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((n,i)=>{for(var a="",s=0;s<i;s+=1)a+="".concat(t[s],"/");return a+="".concat(n,"/"),u.jsxs(X.Fragment,{children:[u.jsx(K,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(a),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ne,{icon:ib,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},a)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:a,type:s}=this.props,{isSubmitting:o,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:f,prevExtension:p,newExtension:m}=this.state,b=s==="directory",g=ee.fileExtensionToString(p),C=ee.fileExtensionToString(m),y=b?"Create":"Save",S=b?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Ci,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Na,{toggle:n,children:a}),u.jsx(Si,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:S}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Y("form-control",{"is-invalid":c}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:Un.getValidationMessage(c)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(Fl,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(ja,{children:[u.jsx(K,{kind:"secondary",onClick:n,children:"Cancel"}),u.jsx(K,{kind:"primary",disabled:o,onClick:this.handleModalSubmit,children:y})]})]}),u.jsx(_n,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(_n,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(g,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(g,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}mn(Un,"propTypes",{isOpen:_.bool,title:_.string.isRequired,defaultValue:_.string,type:_.oneOf(["file","directory"]).isRequired,onSubmit:_.func,onCancel:_.func,placeholder:_.string,storage:_.shape({}).isRequired,notifyOnExtensionChange:_.bool});mn(Un,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});const Bp=Un;function kI(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(K,{kind:"ghost",icon:Sc,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(K,{kind:"ghost",icon:ab,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(Ev,{value:i,onChange:n,placeholder:"Search by name"})})]})}function lh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function $I(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){lh(a,n,i,s,o,"next",l)}function o(l){lh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Wp(r,e,t){return e=UI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function UI(r){var e=HI(r,"string");return typeof e=="symbol"?e:String(e)}function HI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ln=B.module("FileExplorerPanel"),VI=(r,e)=>{var t=qf(r),n=Hr(r,e.localDashboardId),{session:i,config:a}=n??{},s=a==null?void 0:a.type;return{fileStorage:t,language:s,session:i}},BI=Pt(VI,null,null,{forwardRef:!0});function WI(r){var e=r;return e!=null&&typeof e.button=="number"}class xr extends X.Component{static handleError(e){Ln.error(e)}static isFocusEvent(e){return WI(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:n}=this.state,i={language:n,value:""};Ln.debug("handleCreateFile",t,n,i),e.emit(he.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Ln.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){Ln.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(xr.handleError)}handleCopyFile(e){var t=this;return $I(function*(){var{fileStorage:n}=t.props;if(mt(e)){Ln.error("Invalid item in handleCopyItem",e);return}var i=yield ee.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(he.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=ee.makePath(e[0].filename):t=ee.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(Ln.debug("fileSelect",e),e.type!=="directory"){var n=xr.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:a}=this.props,{session:s,language:o}=this.state,l={value:null,language:o};a.emit(he.SELECT_NOTEBOOK,s,o,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;Ln.debug("handleRename",e,t),n.emit(he.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,language:n})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:n}=this.props,{isShown:i,showCreateFolder:a,focusedFilePath:s}=this.state;return u.jsxs(Wt,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(kI,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Fl,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(Bp,{isOpen:a,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}Wp(xr,"COMPONENT","FileExplorerPanel");Wp(xr,"TITLE","File Explorer");var GI=BI(xr);const Gp=GI;function dh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ta(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dh(Object(t),!0).forEach(function(n){ii(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ii(r,e,t){return e=zI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zI(r){var e=KI(r,"string");return typeof e=="symbol"?e:String(e)}function KI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var we=B.module("FilterSetManager"),qI="Enter name...",uh="No Available Filter Sets";class Da extends v.Component{static animateScreenFlash(){var e,t=document.createElement("div");t.classList.add("screen-flash-overlay"),t.addEventListener("animationend",()=>{t.remove()}),(e=document.querySelector("body"))===null||e===void 0||e.appendChild(t)}constructor(e){super(e),ii(this,"renameInputRef",X.createRef()),ii(this,"dropdownRef",X.createRef()),ii(this,"editDropdownRef",X.createRef()),ii(this,"isRenamingExistingSet",se((t,n)=>n!==void 0&&t.some(i=>{var{id:a}=i;return a===n.id}))),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}componentDidMount(){var{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,t){var{isValueShown:n,filterSets:i}=this.props,{modifiedFilterSets:a}=this.state;if(e.isValueShown&&!n&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(t)&&this.focusRenameInput(),i!==e.filterSets)if(!n&&i.length>0&&e.filterSets.length===0&&a.length===0){var{onChange:s}=this.props;s({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){var{filterSets:e,selectedId:t}=this.props;we.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){var{isValueShown:e,filterSets:t,selectedId:n,onChange:i}=this.props;if(we.debug("updateSelectedId",t,n),!!e&&!t.some(s=>{var{id:o}=s;return o===n})){var a=t.length===0;i({isValueShown:!a,selectedId:a?void 0:t[0].id})}}handleEditDropdownChange(e){this.setState({editId:e})}handleFilterChange(e){var t=e,{isValueShown:n,onChange:i}=this.props;this.applyFilterSet(t),i({isValueShown:n,selectedId:t})}handleFilterApply(){var{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){var{onChange:e,selectedId:t,filterSets:n}=this.props;this.setState({modifiedFilterSets:[]}),n.length>0&&e({isValueShown:!0,selectedId:t})}handleSettingsSave(){var{onChange:e,onUpdateSets:t}=this.props,{modifiedFilterSets:n,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),we.debug("Update sets",n,i),t(n),n.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){var{getFilterState:e}=this.props;Da.animateScreenFlash();var t=ye(),n=e(),i={id:t,title:"",panels:n};we.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var t,{renameSet:n,modifiedFilterSets:i}=this.state,a=(t=e==null?void 0:e.trim())!==null&&t!==void 0?t:"";if(a.length===0)return we.debug("Name cannot be empty",a),"Name cannot be empty";if(n!==void 0&&i.some(s=>{var{title:o,id:l}=s;return o===a&&l!==n.id}))return we.debug("Set with this name already exists",a),"Set with this name already exists"}handleRenameConfirm(){var e,{nameInputValue:t,renameSet:n,modifiedFilterSets:i,restoreFullState:a}=this.state;if(n===void 0){we.error("Renamed set undefined.");return}var s=this.getNameError(t);if(we.debug("handleRenameConfirm",t,s),s!==void 0){this.setState({nameInputError:s});return}var o=(e=t==null?void 0:t.trim())!==null&&e!==void 0?e:"",l=ta(ta({},n),{},{title:o,restoreFullState:a}),d=i.findIndex(c=>{var{id:f}=c;return f===n.id}),h=[...i];d>=0?(h[d]=l,we.debug("Renamed existing set",h)):(h.push(l),we.debug("Added new set to modified sets",h)),this.setState({editId:l.id,modifiedFilterSets:h,renameSet:void 0})}handleSetDelete(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.findIndex(l=>{var{id:d}=l;return d===t});if(i<0)return we.error("Unable to find selected filterSet index",n,t),null;var a=n.filter(l=>{var{id:d}=l;return d!==t}),s=Math.max(0,Math.min(a.length-1,i-1)),o=a.length>0?a[s].id:void 0;return we.debug("Deleted selected set",t,n,a),we.debug("New selection",s,o),{modifiedFilterSets:a,editId:o}})}handleSetUpdate(){var{getFilterState:e}=this.props;Da.animateScreenFlash();var t=e();this.setState(n=>{var{modifiedFilterSets:i,editId:a}=n;if(a===void 0)return we.error("Filter for update not selected."),null;var s=[...i],o=s.findIndex(l=>{var{id:d}=l;return d===a});return o<0?(we.error("Selected set for update not found."),null):(s[o]=ta(ta({},s[o]),{},{panels:t}),we.debug("Update set",s,t),{modifiedFilterSets:s})})}handleSetEdit(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.find(o=>{var{id:l}=o;return l===t});if(i===void 0)return we.error("Could not find selected set",t,n),null;var{title:a,restoreFullState:s=!1}=i;return{nameInputValue:a,nameInputError:void 0,renameSet:i,restoreFullState:s}})}handleSettingsClick(e){e.stopPropagation();var{onChange:t,selectedId:n}=this.props;t({isValueShown:!1,selectedId:n})}handleBackgroundClick(e){we.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){var{value:t}=e.target,n=this.getNameError(t);this.setState({nameInputValue:t,nameInputError:n})}handleNameInputKeyPress(e){var{key:t}=e;t==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,{renameSet:t}=e;return t!==void 0}applyFilterSet(e){var{onApply:t,filterSets:n}=this.props;if(e===void 0){we.debug("No filter selected");return}var i=n.find(a=>{var{id:s}=a;return s===e});if(i===void 0){we.debug("Selected id not found in filterSets",e,n);return}we.debug("Apply filterSet",i),t(i)}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)===null||e===void 0||e.focus()}render(){var{nameInputValue:e,nameInputError:t,editId:n,renameSet:i,modifiedFilterSets:a,restoreFullState:s}=this.state,{isValueShown:o,filterSets:l,selectedId:d}=this.props,h=this.isNameInputScreen(),c=this.isRenamingExistingSet(a,i),f=a.length===0,p=!h&&f&&l.length===0,m=!h&&!p,b=u.jsxs("div",{className:"fa-layers mr-3",children:[u.jsx(ne,{icon:Rs,mask:Ql,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:ob,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),g=u.jsxs("div",{className:"fa-layers",children:[u.jsx(ne,{icon:Rs,mask:Ql,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:lb,transform:"shrink-1 down-5 right-7"})]});return u.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:u.jsxs($a,{className:"w-100 h-100",isFlipped:o,children:[u.jsx("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:u.jsxs("div",{className:"filter-set-manager-card-content",children:[p&&u.jsxs("div",{children:[u.jsx(K,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b,children:"Capture filter set"}),u.jsx("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),h&&u.jsxs("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{children:c?"Edit set":"Name captured set"}),u.jsxs("div",{className:"name-input-container",children:[u.jsx("input",{type:"text",className:"input-set-name form-control",placeholder:qI,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),u.jsx(K,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:yc}),u.jsx(K,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:sb})]}),t!==void 0&&u.jsx("div",{className:"error-message",children:t})]}),u.jsx("div",{className:"form-group",children:u.jsxs(Oc,{onChange:this.handleRestoreFullStateChange,value:"".concat(s),children:[u.jsx(ks,{value:"false",children:"Restore only filters"}),u.jsx(ks,{value:"true",children:"Restore full table state"})]})})]}),m&&u.jsxs("div",{className:"filter-set-manager-settings-grid-1",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{children:"Edit filter sets"}),u.jsxs("div",{className:"filter-select-container",children:[u.jsxs(Bn,{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:n??"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:f,children:[f&&u.jsx("option",{value:"-1",disabled:!0,children:uh}),a.map(C=>{var{id:y,title:S}=C;return u.jsx("option",{value:y,children:S},y)})]}),u.jsx(K,{kind:"ghost",onClick:this.handleSetUpdate,disabled:f,icon:g,tooltip:"Update"}),u.jsx(K,{kind:"ghost",onClick:this.handleSetEdit,disabled:f,icon:Ec,tooltip:"Edit"}),u.jsx(K,{kind:"ghost",onClick:this.handleSetDelete,disabled:f,icon:Wn,tooltip:"Delete"})]})]}),u.jsx("div",{children:u.jsx(K,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b,children:"Capture new filter set"})}),u.jsxs("div",{className:"py-3 text-right",children:[u.jsx(K,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"})," ",u.jsx(K,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),u.jsxs("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[u.jsx("div",{className:"filter-set-manager-column",children:u.jsx("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),u.jsx("div",{className:"filter-set-manager-card-content",children:u.jsx("div",{className:"filter-set-manager-value-input",children:u.jsxs("div",{className:"filter-select-container",children:[u.jsxs(Bn,{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d??"-1",className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[l.length===0&&u.jsx("option",{value:"-1",disabled:!0,children:uh}),l.map(C=>{var{id:y,title:S}=C;return u.jsx("option",{value:y,children:S},y)})]}),u.jsx(K,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:wc,tooltip:"Apply Filter Set"})]})})}),u.jsx("div",{className:"filter-set-manager-menu",children:u.jsx(K,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:u.jsx(ne,{icon:Fa,transform:"grow-4"})})})]},"back")]})})}}const zp=Da;function Al(r){var e,t,n,i,a,{model:s,widgetName:o,glContainer:l,description:d}=r,h=((e=s==null?void 0:s.rowCount)!==null&&e!==void 0?e:0)-((t=s==null?void 0:s.pendingRowCount)!==null&&t!==void 0?t:0)-((n=s==null?void 0:s.floatingBottomRowCount)!==null&&n!==void 0?n:0)-((i=s==null?void 0:s.floatingTopRowCount)!==null&&i!==void 0?i:0),c=s==null?void 0:s.displayString(h,"long"),f=(a=s==null?void 0:s.columnCount)!==null&&a!==void 0?a:0,p=s==null?void 0:s.displayString(f,"long");return u.jsxs(Li,{widgetType:"Table",widgetName:o,glContainer:l,description:d,children:[u.jsx("hr",{className:"tab-tooltip-divider"}),u.jsx("span",{children:"Number of Columns"}),u.jsx("span",{className:"tab-tooltip-statistic-value",children:p}),u.jsx("span",{children:"Number of Rows"}),u.jsx("span",{className:"tab-tooltip-statistic-value",children:c})]})}Al.propTypes={glContainer:Ya.Container.isRequired,widgetName:_.string.isRequired,description:_.string};Al.defaultProps={description:null};function Kp(r){if(r==null)return!1;var e=r;return typeof e.table=="string"}function qp(r){if(r==null)return!1;var e=r;return typeof e.name=="string"}function hh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hh(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ie(r,e,t){return e=YI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YI(r){var e=XI(r,"string");return typeof e=="symbol"?e:String(e)}function XI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var kt=B.module("IrisGridPanel"),ZI=500,QI={IrisGrid:Tr,IrisGridTableModel:Gc,ContextMenuRoot:Tc};function ch(r){if(r==null)throw new Error("No metadata provided");if(qp(r))return r.name;if(Kp(r))return r.table;throw new Error("Unable to determine table name from metadata: ".concat(JSON.stringify(r)))}class Nr extends v.PureComponent{constructor(e){super(e),Ie(this,"irisGrid",void 0),Ie(this,"pluginRef",void 0),Ie(this,"modelPromise",void 0),Ie(this,"irisGridState",void 0),Ie(this,"gridState",void 0),Ie(this,"pluginState",void 0),Ie(this,"irisGridUtils",void 0),Ie(this,"getGridInputFilters",se((n,i)=>Ze.getInputFiltersForColumns(n,i.filter(a=>{var{value:s,excludePanelIds:o}=a,l=A.getIdFromPanel(this);return s!=null&&(o==null||l!=null&&!o.includes(l))})))),Ie(this,"getAlwaysFetchColumns",se((n,i)=>{for(var a=A.getIdFromPanel(this),s=new Set(i),o=0;o<n.length;o+=1){var{start:l}=n[o];l!=null&&l.panelId===a&&s.add(l.columnName)}return[...s]})),Ie(this,"getPluginContent",se((n,i,a,s,o)=>{if(!i||!aa(i)||n==null||i.table==null)return null;var l={panel:this,onFilter:this.handlePluginFilter,onFetchColumns:this.handlePluginFetchColumns,user:a,workspace:s,components:QI};return u.jsx("div",{className:"iris-grid-plugin",children:u.jsx(n,hn({ref:this.pluginRef,filter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,model:i,table:i.table,onStateChange:this.handlePluginStateChange,pluginState:o},l))})})),Ie(this,"getDehydratedIrisGridPanelState",se((n,i,a,s)=>Ze.dehydrateIrisGridPanelState(n,{isSelectingPartition:i,partitions:a,advancedSettings:s}))),Ie(this,"getDehydratedIrisGridState",se((n,i,a,s,o,l,d,h,c,f,p,m,b,g,C,y,S,E,w,I,O,T)=>(z(this.irisGridUtils),this.irisGridUtils.dehydrateIrisGridState(n,{advancedFilters:a,aggregationSettings:S,customColumnFormatMap:s,isFilterBarShown:o,metrics:{userColumnWidths:C,userRowHeights:y},quickFilters:l,customColumns:d,reverseType:h,rollupConfig:c,showSearchBar:f,searchValue:p,selectDistinctColumns:m,selectedSearchColumns:b,sorts:i,invertSearchColumns:g,pendingDataMap:E,frozenColumns:w,conditionalFormats:I,columnHeaderGroups:O,partitionConfig:T})))),Ie(this,"getDehydratedGridState",se((n,i,a,s,o)=>Ze.dehydrateGridState(n,{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:a}))),Ie(this,"getCachedPanelState",se((n,i,a,s)=>({irisGridPanelState:n,irisGridState:i,gridState:a,pluginState:s}))),Ie(this,"savePanelState",Le(()=>{var{irisGridState:n,gridState:i,pluginState:a}=this;z(n);var{onPanelStateUpdate:s}=this.props,{model:o,panelState:l,isSelectingPartition:d,partitions:h,advancedSettings:c}=this.state,{advancedFilters:f,aggregationSettings:p,customColumnFormatMap:m,isFilterBarShown:b,quickFilters:g,customColumns:C,reverseType:y,rollupConfig:S,showSearchBar:E,searchValue:w,selectDistinctColumns:I,selectedSearchColumns:O,sorts:T,invertSearchColumns:N,metrics:R,pendingDataMap:W,frozenColumns:L,conditionalFormats:D,columnHeaderGroups:M,partitionConfig:F}=n;z(o),z(R);var{userColumnWidths:k,userRowHeights:H}=R;z(i);var{isStuckToBottom:q,isStuckToRight:re,movedColumns:V,movedRows:x}=i,P=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(o,d,h,c),this.getDehydratedIrisGridState(o,T,f,m,b,g,C,y,S,E,w,I,O,N,k,H,p,W,L,D,M,F),this.getDehydratedGridState(o,V,x,q,re),a);P!==l&&(kt.debug("Saving panel state",this,P),this.setState({panelState:P}),s==null||s(P))},ZI)),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=X.createRef(),this.pluginRef=X.createRef();var{panelState:t}=e;this.pluginState=null,this.irisGridUtils=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Wc.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:Ne.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partitions:[],rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:t,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,t){var{model:n}=this.state,{makeModel:i}=this.props;n!==t.model&&(t.model!=null&&(this.stopModelListening(t.model),t.model.close()),n!=null&&this.startModelListening(n)),i!==e.makeModel&&this.initModel()}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);var{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){var{metadata:e}=this.props;return ch(e)}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});var{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=Se.makeCancelable(e(),t=>t.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){var t=e,{panelState:n,irisGridStateOverrides:i}=this.state,a=[];if(this.irisGridUtils=new Ze(t.dh),n!=null){var{irisGridState:s}=n,{aggregationSettings:o,customColumns:l,selectDistinctColumns:d=[],rollupConfig:h}=hn(hn({},s),i);l.length>0&&a.push(c=>{c.customColumns=l}),h!=null&&h.columns.length>0&&a.push(c=>{c.rollupConfig=Ze.getModelRollupConfig(c.originalColumns,h,o)}),d.length>0&&a.push(c=>{c.selectDistinctColumns=d})}this.setState({model:t,modelQueue:a}),this.initModelQueue(t,a)}initModelQueue(e,t){var n=e;if(t.length===0){this.modelInitialized(n);return}var i=t.shift();kt.debug("initModelQueue",i),i&&i(n),this.setState({modelQueue:t})}handleAdvancedSettingsChange(e,t){kt.debug("handleAdvancedSettingsChange",e,t),this.setState(n=>{var{advancedSettings:i}=n;return i.get(e)===t?null:{advancedSettings:new Map(i).set(e,t)}})}handlePluginFilter(e){var t,n,{model:i}=this.state;z(i);var{columns:a,formatter:s}=i,o=(t=(n=this.irisGridUtils)===null||n===void 0?void 0:n.getFiltersFromInputFilters(a,e,s.timeZone))!==null&&t!==void 0?t:[];this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var t,n,i;return(t=(n=this.pluginRef.current)===null||n===void 0||(i=n.getMenu)===null||i===void 0?void 0:i.call(n,e))!==null&&t!==void 0?t:[]}isColumnSelectionValid(e){var{columnSelectionValidator:t}=this.props;return t&&e?t(this,e):!1}handleGridStateChange(e,t){this.irisGridState=e,this.gridState=t,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();var{glEventHub:n,onStateChange:i}=this.props;n.emit(Et.STATE_CHANGED,this),i==null||i(e,t)}handlePluginStateChange(e){var{irisGridState:t,gridState:n}=this;this.pluginState=e,t!==null&&n!==null&&this.savePanelState()}handleColumnsChanged(e){var{isModelReady:t,model:n,modelQueue:i}=this.state;t?this.sendColumnsChange(e.detail):(z(n),this.initModelQueue(n,i))}handleTableChanged(e){kt.debug("handleTableChanged",e);var{glEventHub:t}=this.props,{detail:n}=e;t.emit(Te.TABLE_CHANGED,this,n)}handleCreateChart(e,t){this.savePanelState.flush(),this.setState(()=>null,()=>{var{glEventHub:n,inputFilters:i}=this.props,a=this.getTableName(),{panelState:s}=this.state,o=A.getIdFromPanel(this),l;s&&(l=Ze.extractTableSettings(s,i)),n.emit(Et.CREATE_CHART,{metadata:{settings:e,sourcePanelId:o,table:a,tableSettings:l},table:aa(t)?t.table:void 0})})}handleColumnSelected(e){var{glEventHub:t}=this.props;t.emit(Et.COLUMN_SELECTED,this,e)}handleDataSelected(e,t){var{glEventHub:n}=this.props;n.emit(Et.DATA_SELECTED,this,t)}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){kt.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){Se.isCanceled(e)||this.handleError(e)}modelInitialized(e){var{glEventHub:t,loadPlugin:n}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),aa(e)){var{table:i}=e,{pluginName:a}=i;if(a!==""&&n!=null&&a!=null){var s=n(a);this.setState({Plugin:s})}t.emit(Te.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){var e=this.irisGrid.current,{isDisconnected:t}=this.state;e!=null&&!t&&e.clearAllFilters()}sendColumnsChange(e){kt.debug2("sendColumnsChange",e);var{glEventHub:t}=this.props;t.emit(Te.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(Yt.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(Yt.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(Yt.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(Yt.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(Yt.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(Yt.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(Yt.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(Yt.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var t,n,i,{model:a}=this.state;if(!a)return null;var s=this.irisGrid.current,{gridWrapper:o}=s||{},l=(t=o==null?void 0:o.getBoundingClientRect())!==null&&t!==void 0?t:null;if(l==null||l.width<=0||l.height<=0)return null;z(s);var{metrics:d}=s.state;z(d);var{columnHeaderHeight:h,allColumnXs:c,allColumnWidths:f,right:p,columnHeaderMaxDepth:m}=d,b=a.getColumnIndexByName(e);z(b);var g=s.getVisibleColumn(b),C=(n=c.get(g))!==null&&n!==void 0?n:0,y=(i=f.get(g))!==null&&i!==void 0?i:0,S=Math.max(l.left,Math.min(g>p?l.right:l.left+C+y*.5,l.right)),E=l.top+h*m;return[S,E]}setFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setFilterMap(e)}setAdvancedFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setAdvancedFilterMap(e)}setFilters(e){var{quickFilters:t,advancedFilters:n}=e;kt.debug("setFilters",t,n);var{model:i,isDisconnected:a}=this.state,s=this.irisGrid.current;if(s==null||a){kt.debug("Ignore setFilters, model disconnected");return}z(i);var{columns:o,formatter:l}=i,d=Ze.changeFilterColumnNamesToIndexes(i.columns,t).filter(c=>{var[f]=c;return i.isFilterable(f)}),h=Ze.changeFilterColumnNamesToIndexes(i.columns,n).filter(c=>{var[f]=c;return i.isFilterable(f)});z(this.irisGridUtils),s.clearAllFilters(),s.setFilters({quickFilters:this.irisGridUtils.hydrateQuickFilters(o,d,l.timeZone),advancedFilters:this.irisGridUtils.hydrateAdvancedFilters(o,h,l.timeZone)})}setStateOverrides(e){kt.debug("setStateOverrides",e);var{irisGridState:t,gridState:n}=e;this.setState({irisGridStateOverrides:t,gridStateOverrides:n},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){var{panelState:t,irisGridStateOverrides:n,gridStateOverrides:i}=this.state;if(t!=null)try{var{gridState:a,irisGridState:s,irisGridPanelState:o}=t,l=hn({},n),{quickFilters:d,advancedFilters:h}=l;d&&(l.quickFilters=Ze.changeFilterColumnNamesToIndexes(e.columns,d)),h&&(l.advancedFilters=Ze.changeFilterColumnNamesToIndexes(e.columns,h));var{isSelectingPartition:c,partitions:f,advancedSettings:p}=Ze.hydrateIrisGridPanelState(e,o);z(this.irisGridUtils);var{advancedFilters:m,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,quickFilters:y,reverseType:S,rollupConfig:E,aggregationSettings:w,sorts:I,userColumnWidths:O,userRowHeights:T,showSearchBar:N,searchValue:R,selectDistinctColumns:W,selectedSearchColumns:L,invertSearchColumns:D,pendingDataMap:M,frozenColumns:F,conditionalFormats:k,columnHeaderGroups:H,partitionConfig:q}=this.irisGridUtils.hydrateIrisGridState(e,hn(hn({},s),l)),{isStuckToBottom:re,isStuckToRight:V,movedColumns:x,movedRows:P}=Ze.hydrateGridState(e,hn(hn({},a),i),s.customColumns);this.setState({advancedFilters:m,advancedSettings:p,conditionalFormats:k,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,isSelectingPartition:c,movedColumns:x,movedRows:P,partitions:f,quickFilters:y,reverseType:S,rollupConfig:E,aggregationSettings:w,sorts:I,userColumnWidths:O,userRowHeights:T,showSearchBar:N,searchValue:R,selectDistinctColumns:W,selectedSearchColumns:L,invertSearchColumns:D,pendingDataMap:M,frozenColumns:F,isStuckToBottom:re,isStuckToRight:V,columnHeaderGroups:H,partitionConfig:q})}catch(j){kt.error("loadPanelState failed to load panelState",t,j)}}updateGrid(){var e,t,n=(e=(t=this.irisGrid.current)===null||t===void 0?void 0:t.grid)!==null&&e!==void 0?e:null;n&&n.handleResize()}render(){var e,t,{children:n,glContainer:i,glEventHub:a,columnSelectionValidator:s,getDownloadWorker:o,inputFilters:l,links:d,metadata:h,panelState:c,user:f,workspace:p,settings:m,theme:b}=this.props,{advancedFilters:g,aggregationSettings:C,advancedSettings:y,conditionalFormats:S,customColumns:E,customColumnFormatMap:w,error:I,isDisconnected:O,isFilterBarShown:T,isSelectingPartition:N,isStuckToBottom:R,isStuckToRight:W,isLoaded:L,isLoading:D,isModelReady:M,model:F,movedColumns:k,movedRows:H,partitions:q,partitionConfig:re,quickFilters:V,reverseType:x,rollupConfig:P,sorts:j,userColumnWidths:U,userRowHeights:Q,showSearchBar:me,searchValue:$,selectDistinctColumns:J,selectedSearchColumns:ie,invertSearchColumns:ve,Plugin:Ee,pluginFilters:Vr,pluginFetchColumns:Qn,pendingDataMap:Br,frozenColumns:xn,columnHeaderGroups:Fm}=this.state,Am=I!=null?"Unable to open table. ".concat(I):void 0,Wl=ch(h),Gl=(e=F==null?void 0:F.description)!==null&&e!==void 0?e:void 0,Rm=(t=c==null?void 0:c.pluginState)!==null&&t!==void 0?t:null,jm=n??this.getPluginContent(Ee,F,f,p,Rm),{permissions:km}=f,{canCopy:$m,canDownloadCsv:Um}=km;return u.jsx(Fi,{errorMessage:Am,isDisconnected:O,isLoading:D,isLoaded:L,className:"iris-grid-panel",glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Wl,widgetType:"Table",description:Gl,componentPanel:this,renderTabTooltip:()=>u.jsx(Al,{model:F,widgetName:Wl,glContainer:i,description:Gl}),children:M&&F&&u.jsx(Tr,{advancedFilters:g,aggregationSettings:C,advancedSettings:y,alwaysFetchColumns:this.getAlwaysFetchColumns(d,Qn),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",customColumns:E,customColumnFormatMap:w,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:S,inputFilters:this.getGridInputFilters(F.columns,l),applyInputFiltersOnInit:c==null,isFilterBarShown:T,isSelectingColumn:s!=null,isSelectingPartition:N,isStuckToBottom:R,isStuckToRight:W,movedColumns:k,movedRows:H,partitions:q,partitionConfig:re,quickFilters:V,reverseType:x,rollupConfig:P,settings:m,sorts:j,userColumnWidths:U,userRowHeights:Q,model:F,showSearchBar:me,searchValue:$,selectedSearchColumns:ie,selectDistinctColumns:J,invertSearchColumns:ve,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:Vr,pendingDataMap:Br,canCopy:$m,canDownloadCsv:Um,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:xn,theme:b,columnHeaderGroups:Fm,children:jm})})}}Ie(Nr,"defaultProps",{onStateChange:()=>{},onPanelStateUpdate:()=>{}});Ie(Nr,"displayName","IrisGridPanel");Ie(Nr,"COMPONENT","IrisGridPanel");var JI=(r,e)=>{var{localDashboardId:t=_l}=e;return{inputFilters:ts(r,t),links:Zn(r,t),columnSelectionValidator:is(r,t),user:t_(r),workspace:Yf(r),settings:xi(r)}},ex=Pt(JI,null,null,{forwardRef:!0})(Nr);const Mr=ex;function di(r,e,t){return e=tx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tx(r){var e=nx(r,"string");return typeof e=="symbol"?e:String(e)}function nx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var vh=B.module("InputFilter"),rx=150;class Lr extends v.Component{constructor(e){super(e),di(this,"inputRef",void 0),di(this,"getItemLabel",ot((a,s)=>{var{name:o,type:l}=a[s];if(s>0&&a[s-1].name===o||s<a.length-1&&a[s+1].name===o){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(o," (").concat(d,")")}return o})),di(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o})},rx)),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=X.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,selectedColumn:t,value:i,isValueShown:n}}componentDidUpdate(e,t){var{column:n}=this.props,{column:i,value:a,isValueShown:s}=this.state;n!==e.column&&this.setState({column:n,selectedColumn:n}),s!==void 0&&s&&s!==t.isValueShown&&this.focusInput(),(i!==t.column||a!==t.value||s!==t.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var{columns:t}=this.props,n=t[parseInt(e,10)];vh.debug2("handleColumnChange",n),this.setState({selectedColumn:n,value:void 0})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(t=>{var{value:n}=t;return n==null?{value:""}:null},()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){var{value:t}=e.target;vh.debug2("handleValueChange",t),this.setState({value:t})}handleSettingsCancel(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){var{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){var{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1}),e.stopPropagation()}handleBackgroundClick(e){e.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState(e){var{name:t,type:n,value:i,isValueShown:a}=e,s=t!=null&&n!=null?{name:t,type:n}:void 0,o=a===void 0?{column:s,value:i}:{column:s,value:i,isValueShown:a};this.setState(o)}render(){var{columns:e}=this.props,{column:t,isValueShown:n,selectedColumn:i,value:a}=this.state,s=a==null||a.length===0?Lr.PLACEHOLDER.length:a.length,o=null;if(t!=null){var l=e.findIndex(d=>d.name===t.name&&d.type===t.type);o=l>=0?this.getItemLabel(e,l):t.name}return u.jsxs($a,{className:"input-filter fill-parent-absolute",isFlipped:n??!1,children:[u.jsx("div",{className:"input-filter-settings-card",children:u.jsxs("div",{className:"input-filter-settings-content",children:[u.jsxs("div",{className:"input-filter-settings-grid",children:[u.jsx("label",{children:"Filter Column"}),u.jsxs(Bn,{value:String(e.findIndex(d=>d.name===(i==null?void 0:i.name)&&d.type===(i==null?void 0:i.type))),className:"custom-select",onChange:this.handleColumnChange,children:[e.map((d,h)=>u.jsx("option",{value:h,children:this.getItemLabel(e,h)},"".concat(d.name,"/").concat(d.type))),e.length===0&&u.jsx("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),u.jsx("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),u.jsxs("div",{className:"input-filter-settings-buttons",children:[u.jsx(K,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:t==null,children:"Cancel"}),u.jsx(K,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:i==null,children:"Save"})]})]})}),u.jsxs("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[u.jsx("div",{className:"input-filter-column",children:u.jsxs("div",{className:"input-filter-column-title",children:[o," Filter"]})}),u.jsx("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:u.jsx("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:u.jsx("input",{type:"text",ref:this.inputRef,placeholder:Lr.PLACEHOLDER,value:a??"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:"".concat(s+3,"ch")},spellCheck:"false"})})}),u.jsx("div",{className:"input-filter-menu",children:u.jsx(K,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:u.jsx(ne,{icon:Fa,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}di(Lr,"PLACEHOLDER","Enter value...");di(Lr,"defaultProps",{column:null,isValueShown:!1,value:null});const ix=Lr;function ds(r,e,t){return e=ax(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ax(r){var e=sx(r,"string");return typeof e=="symbol"?e:String(e)}function sx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ox=250;class us extends v.Component{constructor(e){super(e),ds(this,"inputFilterRef",void 0),this.handleChange=Le(this.handleChange.bind(this),ox),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=X.createRef();var{panelState:t}=e,{value:n,isValueShown:i=!1,name:a,type:s,timestamp:o}=t??{};this.state={columns:[],column:a!=null&&s!=null?{name:a,type:s}:void 0,value:n,timestamp:o,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:t}}componentDidMount(){this.updateColumns();var{column:e,value:t,timestamp:n}=this.state;if(e!=null){var{name:i,type:a}=e;this.sendUpdate(i,a,t,n)}}componentDidUpdate(e){var{columns:t}=this.props;t!==e.columns&&this.updateColumns()}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,a,s;t!=null&&({name:a,type:s}=t);var o=!0,l=Date.now();this.setState(d=>{var h,{panelState:c,timestamp:f,wasFlipped:p,skipUpdate:m}=d,b=c!=null&&n!==c.isValueShown&&a===c.name&&s===c.type&&i===c.value;return o=(h=!m&&n&&(!b||!p))!==null&&h!==void 0?h:!1,o||(l=f),{panelState:{isValueShown:n,name:a,type:s,value:i,timestamp:l},timestamp:l,wasFlipped:b,skipUpdate:!1}},()=>{o&&this.sendUpdate(a,s,i,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)===null||e===void 0||e.clearFilter()}sendUpdate(e,t,n,i){var{glEventHub:a}=this.props;a.emit(Te.FILTERS_CHANGED,this,{name:e,type:t,value:n,timestamp:i})}setPanelState(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState({skipUpdate:!n}),(t=this.inputFilterRef.current)===null||t===void 0||t.setFilterState(e)}updateColumns(){var{columns:e}=this.props;e!=null&&this.setState(t=>{var{column:n}=t;return n==null&&e.length>0?{columns:[...e],column:e[0]}:n!=null&&!e.find(i=>{var{name:a,type:s}=i;return n.name===a&&n.type===s})?{columns:[...e,n]}:{columns:[...e]}})}render(){var{glContainer:e,glEventHub:t}=this.props,{column:n,columns:i,isValueShown:a,value:s}=this.state;return u.jsx(Wt,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:u.jsx(ix,{ref:this.inputFilterRef,column:n,columns:i,onChange:this.handleChange,isValueShown:a,value:s})})}}ds(us,"defaultProps",{panelState:null});ds(us,"COMPONENT","InputFilterPanel");ds(us,"displayName","InputFilterPanel");var lx=(r,e)=>{var{localDashboardId:t}=e;return{columns:xl(r,t)}},dx=Pt(lx,null,null,{forwardRef:!0})(us);const Sr=dx;function fh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function na(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fh(Object(t),!0).forEach(function(n){Rl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Rl(r,e,t){return e=ux(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ux(r){var e=hx(r,"string");return typeof e=="symbol"?e:String(e)}function hx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var We=B.module("FilterSetManagerPanel");function cx(r){return r.setPanelState!=null}class Fr extends v.Component{static changeFilterIndexesToColumnNames(e,t){return t.map(n=>{var[i,a]=n;if(i>=e.columns.length)return null;var{name:s}=e.columns[i];return{name:s,filter:a}}).filter(n=>n!=null)}constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);var{panelState:t,filterSets:n}=e,{selectedId:i=n.length>0?n[0].id:void 0,isValueShown:a=!1}=t??{};this.state={selectedId:i,isValueShown:a,panelState:t}}getFilterState(){var{dashboardOpenedPanelMap:e}=this.props,t=[];return[...e.keys()].forEach(n=>{var i=e.get(n);if(i===void 0){We.error("Could not get panel",i);return}var a=A.getComponentNameFromPanel(i),s=A.getIdFromPanel(i);We.debug("Panel:",i,a);var{glContainer:o=null}=i.props;if(o==null){We.error("Could not get panel container",i);return}var l=A.getComponentConfigFromContainer(o);if(l==null){We.error("Could not get component config from container",o);return}var d=A.getPanelComponentState(l);if(d==null){We.debug("Panel state is null ".concat(s));return}switch(a){case A.getComponentName(Nr):{var h;s!=null&&(h=this.getIrisGridPanelFilters(s,d)),h!=null&&t.push({panelId:s,type:a,state:h});break}case A.getComponentName(Sr):case A.getComponentName(Pn):{var{isValueShown:c,name:f,type:p,value:m}=d;t.push({panelId:s,type:a,state:{isValueShown:c,name:f,type:p,value:m}});break}}}),t}getIrisGridPanelFilters(e,t){var{panelTableMap:n}=this.props,i=n.get(e);if(i==null)return We.error("Unable to get table for panel ".concat(e,".")),null;var{irisGridState:a={advancedFilters:void 0,quickFilters:void 0},gridState:s={}}=t,{advancedFilters:o,quickFilters:l}=a,d;o&&(d=Fr.changeFilterIndexesToColumnNames(i,o));var h;return l&&(h=Fr.changeFilterIndexesToColumnNames(i,l)),{irisGridState:na(na({},a),{},{advancedFilters:d,quickFilters:h}),gridState:na({},s)}}handleGetFilterState(){return this.getFilterState()}handleChange(e){var{isValueShown:t,selectedId:n}=e;We.debug("handleChange",t,n),this.setState({isValueShown:t,selectedId:n}),this.updatePanelState()}handleFilterApply(e){var{dashboardOpenedPanelMap:t}=this.props,{panels:n,restoreFullState:i=!1}=e;We.debug("Apply filters from filter set",e),n.forEach(a=>{var{panelId:s,type:o,state:l}=a;if(s==null){We.debug("panel is null",s);return}if(!t.has(s)){We.debug("Ignore closed panel",s);return}We.debug("Apply panel filters",s,o,l);var d=t.get(s);switch(o){case A.getComponentName(Nr):this.restoreIrisGridFilters(d,l,i);break;case A.getComponentName(Sr):case A.getComponentName(Pn):this.restoreInputFilterState(d,l);break}})}handleSetsUpdate(e){var{setDashboardFilterSets:t,localDashboardId:n}=this.props;We.debug("Saving updated sets",e),t(n,[...e])}updatePanelState(){this.setState(e=>{var{selectedId:t,isValueShown:n}=e;return{panelState:{selectedId:t,isValueShown:n}}})}restoreIrisGridFilters(e,t,n){var{irisGridState:i={},advancedFilters:a=[],quickFilters:s=[]}=t,{advancedFilters:o=a,quickFilters:l=s}=i,{panelTableMap:d}=this.props,h=A.getIdFromPanel(e);if(h==null){We.error("Panel Id is null.");return}var c=d.get(h);if(c==null){We.error("Unable to get table for panel ".concat(h,"."));return}We.debug("restoreIrisGridFilters",h,t,n),n?e.setStateOverrides(t):e.setFilters({quickFilters:l,advancedFilters:o})}restoreInputFilterState(e,t){var n=na({},t);delete n.isValueShown,We.debug("restoreInputFilterState",e,n),e&&cx(e)&&e.setPanelState(n)}render(){var{glContainer:e,glEventHub:t,filterSets:n}=this.props,{isValueShown:i,selectedId:a}=this.state;return u.jsx(Wt,{className:"filter-set-manager-panel",componentPanel:this,glContainer:e,glEventHub:t,isClonable:!0,isRenamable:!0,children:u.jsx("div",{className:"input-filter-container h-100 w-100 container",children:u.jsx(zp,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:i,filterSets:n,selectedId:a,getFilterState:this.handleGetFilterState})})})}}Rl(Fr,"defaultProps",{panelState:null});Rl(Fr,"COMPONENT","FilterSetManagerPanel");var vx=(r,e)=>{var{localDashboardId:t}=e;return{filterSets:Mp(r,t),dashboardOpenedPanelMap:yl(r,t),dashboardInputFilters:ts(r,t),panelTableMap:ns(r,t)}},fx=Pt(vx,{setDashboardFilterSets:jp},null,{forwardRef:!0})(Fr);const da=fx;function mi(r,e,t){return e=px(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function px(r){var e=mx(r,"string");return typeof e=="symbol"?e:String(e)}function mx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ph=B.module("LogPanel");class hs extends v.PureComponent{constructor(e){super(e),mi(this,"isBottomVisible",void 0),mi(this,"logView",void 0),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;var{session:t}=this.props;this.state={session:t}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){ph.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ph.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return u.jsxs(Wt,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&u.jsx(XO,{session:n,ref:i=>{this.logView=i}})]})}}mi(hs,"defaultProps",{session:null});mi(hs,"COMPONENT","LogPanel");mi(hs,"TITLE","Log");var gx=(r,e)=>{var t;return{session:(t=Hr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},bx=Pt(gx,null,null,{forwardRef:!0})(hs);const Yp=bx;function Cx(r,e,t){return e=Sx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sx(r){var e=yx(r,"string");return typeof e=="symbol"?e:String(e)}function yx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Xp extends v.PureComponent{render(){var{isEditing:e,children:t,onDoubleClick:n}=this.props;return u.jsxs("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:n,children:[u.jsx("div",{className:Y("text-muted","edit-hint",{viewing:e===void 0||!e}),children:u.jsxs("span",{children:["double-click to edit ",u.jsx(ne,{icon:Ec})]})}),t]})}}Cx(Xp,"defaultProps",{isEditing:!1});function Ex(r,e,t){return e=wx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wx(r){var e=Px(r,"string");return typeof e=="symbol"?e:String(e)}function Px(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var _x=B.module("MarkdownStartPage");class Zp extends v.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(_x.debug("delete markdown: ",e),e!==void 0){var{onDelete:t}=this.props;t(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){var{closedMarkdowns:e,onOpen:t,onCreate:n}=this.props,{isDeleteModalShown:i,toBeDeleted:a}=this.state;return u.jsx("div",{className:"markdown-panel-start-page h-100 w-100",children:u.jsxs("div",{className:"markdown-panel-start-page-container",children:[u.jsxs("div",{className:"markdown-panel-start-list",children:[u.jsx("h3",{className:"list-title",children:"Start"}),u.jsx("div",{className:"list-item",children:u.jsx(K,{kind:"ghost",className:"title",onClick:n,children:"New Markdown Note"})})]}),u.jsxs("div",{className:"markdown-panel-start-list",children:[u.jsx("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(s=>u.jsxs("div",{className:"list-item",children:[u.jsx(K,{kind:"ghost",className:"title",onClick:()=>t(s),children:s.title}),u.jsx("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(s)},children:u.jsx(ne,{icon:Wn})})]},s.id)),u.jsxs(Ci,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal",children:[u.jsx(Na,{children:"Are you sure you want to permanently delete this note?"}),u.jsx(Si,{children:"You can't undo this action."}),u.jsxs(ja,{children:[u.jsx(K,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),u.jsx(K,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(a)},children:"Delete"})]})]})]})]})})}}Ex(Zp,"defaultProps",{closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}});const Tx=Zp;function ui(r,e,t){return e=Ox(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ox(r){var e=Dx(r,"string");return typeof e=="symbol"?e:String(e)}function Dx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ix=v.lazy(()=>Yc(()=>import("./MarkdownEditor-183fa371.js"),["./MarkdownEditor-183fa371.js","./vendor-c87e2acb.js","./helpers-de833af9.js","./vendor-e1f37c45.css","./useUser-75ea4bfc.js","./index-885889f7.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-fdfd3d2c.css","./useUser-5b7483c1.css","./plotly-37fd1df1.js"],import.meta.url)),ra=B.module("MarkdownPanel");class jl extends v.Component{constructor(e){super(e),ui(this,"markdownEditor",void 0),ui(this,"editor",void 0),ui(this,"getClosedMarkdowns",se(i=>i.filter(a=>a.component==="MarkdownPanel").reverse())),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);var{panelState:t}=e,n=null;t!=null&&t.content!=null&&({content:n}=t),this.state={isStartPageShown:n==null,isEditing:!1,content:n,panelState:t},this.markdownEditor=null}setEditorPosition(e){z(this.markdownEditor);var{container:t}=this.markdownEditor;if(this.editor&&t!=null){var n,i,a=t.getBoundingClientRect().top,s=t.scrollTop,o=t.scrollHeight,l=(n=(i=this.editor.getModel())===null||i===void 0?void 0:i.getLineCount())!==null&&n!==void 0?n:0,d=Math.round((s+e-a)/o*l);d>l&&(d=l),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){var{isEditing:t}=this.state,n=e.clientY;t||this.setState({isEditing:!0},()=>{this.setEditorPosition(n)})}handleEditorInitialized(e){ra.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){ra.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){ra.debug("open markdown...",e);var{glContainer:t,glEventHub:n}=this.props,i=A.getComponentConfigFromContainer(t);n.emit(te.REOPEN,e,i)}handleDeleteMarkdown(e){var{glEventHub:t}=this.props;t.emit(te.DELETE,e)}handleEditorBlur(e){var t;ra.debug("markdown content changed, saving...");var{isEditing:n}=this.state;if(!(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))){var i=(t=this.editor)===null||t===void 0?void 0:t.getValue();this.setState({content:i,isEditing:!1,panelState:{content:i}})}}handleEditorResize(){var{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){var{glContainer:e,glEventHub:t,closedPanels:n}=this.props,{isEditing:i,isStartPageShown:a,content:s}=this.state,o=this.getClosedMarkdowns(n);return u.jsx(Wt,{glContainer:e,glEventHub:t,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:a?u.jsx(Tx,{closedMarkdowns:o,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):u.jsx(Xp,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:u.jsx(v.Suspense,{fallback:u.jsx(He,{}),children:u.jsx(Ix,{ref:l=>{this.markdownEditor=l},isEditing:i,content:s??void 0,onEditorInitialized:this.handleEditorInitialized})})})})}}ui(jl,"defaultProps",{panelState:null});ui(jl,"COMPONENT","MarkdownPanel");var xx=(r,e)=>{var{localDashboardId:t}=e;return{closedPanels:ap(r,t)}},Nx=Pt(xx,null,null,{forwardRef:!0})(jl);const ir=Nx;function mh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function gh(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){mh(a,n,i,s,o,"next",l)}function o(l){mh(a,n,i,s,o,"throw",l)}s(void 0)})}}function bh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function at(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bh(Object(t),!0).forEach(function(n){Ke(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ke(r,e,t){return e=Mx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mx(r){var e=Lx(r,"string");return typeof e=="symbol"?e:String(e)}function Lx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fx=v.lazy(()=>Yc(()=>import("./MarkdownNotebook-eea72e62.js"),["./MarkdownNotebook-eea72e62.js","./vendor-c87e2acb.js","./helpers-de833af9.js","./vendor-e1f37c45.css","./index-885889f7.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-fdfd3d2c.css","./useUser-75ea4bfc.js","./useUser-5b7483c1.css","./plotly-37fd1df1.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),oe=B.module("NotebookPanel"),Ch=400;class je extends v.Component{static handleError(e){Se.isCanceled(e)||oe.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(je.UNSAVED_INDICATOR_CLASS_NAME,".").concat(je.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=ee.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Ke(this,"pending",void 0),Ke(this,"debouncedSavePanelState",void 0),Ke(this,"debouncedLoad",void 0),Ke(this,"notebook",void 0),Ke(this,"tabTitleElement",void 0),Ke(this,"tabInitOnce",void 0),Ke(this,"editor",void 0),Ke(this,"getSettings",se((f,p)=>at(at({},f),{},{minimap:{enabled:p}}))),Ke(this,"getOverflowActions",se((f,p)=>[{title:"Find",icon:ub,action:this.handleFind,group:ae.groups.high,shortcut:et.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:hb,action:this.handleCopy,group:ae.groups.medium,order:20},{title:"Rename File",icon:cb,action:this.handleShowRename,group:ae.groups.medium,order:30},{title:"Delete File",icon:Wn,action:this.handleDelete,group:ae.groups.medium,order:40},{title:"Show Minimap",icon:f?cr:void 0,action:this.handleMinimapChange,group:ae.groups.low,shortcut:et.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?cr:void 0,action:this.handleWordWrapChange,group:ae.groups.low,shortcut:et.NOTEBOOK.WORDWRAP,order:30}])),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Tn,this.debouncedSavePanelState=Le(this.savePanelState.bind(this),Ch),this.debouncedLoad=Le(this.load.bind(this),Ch),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:a}=e,s={value:"",language:"",wordWrap:"off"},o=null,{isPreview:l}=e;a!=null&&({fileMetadata:o=o,isPreview:l=l,settings:s=s}=a);var d=o!=null&&ee.hasPath(o.itemName),h=d===!0&&s.value!=null||!d&&s.value!=null&&s.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:o,settings:s,session:n,sessionLanguage:i,panelState:{fileMetadata:o,settings:s},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},oe.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(he.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(he.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:a}=i,{defaultNotebookSettings:s}=this.props;n!==t.isPreview&&this.setPreviewStatus(),a!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),s.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:i}=this.state;e.off(he.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(he.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(he.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);z(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var a=this.notebook.getValue();return a??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){oe.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){oe.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(he.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:a}=i;n.emit(he.REGISTER_FILE,a,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(he.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;z(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(a=>{var s;oe.debug("Loaded file",a);var{filename:o}=a,{itemName:l}=this.state;if(o!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,ee.getBaseName(o))}var c=at(at({},t),{},{language:(s=je.languageFromFileName(o))!==null&&s!==void 0?s:""});t.value==null&&(c.value=a.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&ee.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){oe.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;oe.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:n,fileMetadata:i,isPreview:a,settings:s}=e,o=this.getNotebookValue(),l=t!==n?o:void 0,d=at(at({},s),{},{value:o}),h=at(at({},s),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:a};return oe.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(he.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return gh(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:a,settings:s}=e.state;z(a);var{language:o}=s,{itemName:l}=a,d=yield ee.getUniqueCopyFileName(t,l);oe.debug("handleCopy",a,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:o};n.emit(he.SELECT_NOTEBOOK,i,o,c,h,!0)})()}handleDelete(){oe.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return gh(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:a}=e.state;oe.debug("handleDeleteConfirm",a==null?void 0:a.itemName),e.setState({showDeleteModal:!1}),a&&(ee.hasPath(a.itemName)&&(yield ee.fileExists(t,a.itemName))?(i.emit(he.CLOSE_FILE,a,{force:!0}),t.deleteFile(a.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){oe.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:a,isRedoing:s}=e;return a?{changeCount:n-1,savedChangeCount:i}:!s&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:n}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};n(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings:at(at({},t),{},{wordWrap:n})}})}handleBlur(){oe.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){oe.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:i}=this.props,{href:a}=e.currentTarget;if(!(!a||!a.startsWith(t))){e.stopPropagation(),e.preventDefault();var s="/".concat(a.substring(t.length)).replace(/%20/g," ");if(s==="/"){oe.debug("Ignoring invalid notebook link",s);return}oe.debug("Notebook link clicked, opening",s);var{glEventHub:o}=this.props,l={value:null,language:i},d={id:s,itemName:s};o.emit(he.SELECT_NOTEBOOK,n,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Se.isCanceled(t)||(Se.isTimedOut(t)&&(t=new Error("File not found.")),oe.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){oe.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},a=(t=je.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(s=>{var{fileMetadata:o}=s,l=at(at({},s.settings),{},{language:a});return oe.debug("handleSaveSuccess",i,o,l),o&&ee.hasPath(o.itemName)&&o.itemName!==i.itemName&&(oe.debug("handleSaveSuccess deleting old file",o.itemName),n.deleteFile(o.itemName).catch(je.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Se.isCanceled(e)||(this.setState({savedChangeCount:0}),oe.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),oe.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:a}=i,s=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),ee.getBaseName(a)!==ee.getBaseName(e)){var{metadata:o}=this.props,{id:l}=o;this.renameTab(l,ee.getBaseName(e))}this.saveContent(e,s)}}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:a}=this.state,{glContainer:s}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(a)!==JSON.stringify(n)){s.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){oe.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){oe.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;oe.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){oe.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];oe.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){oe.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){oe.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=n==null?void 0:n.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var a=new URL(i,t);return new URL(e,a).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:a,sessionLanguage:s,settings:o}=this.state,l=at(at({},o),{},{language:t,value:n}),d={id:null,itemName:e};oe.debug("handleCreateNotebook",a,s,l,d),i.emit(he.CREATE_NOTEBOOK,a,s,l,d)}runCommand(e){if(e===void 0||e===""){oe.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(pt.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:n}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=n.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=n.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,n,{fileStorage:i,glContainer:a,glContainer:{tab:s},glEventHub:o,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:f,isLoaded:p,isLoading:m,isPreview:b,fileMetadata:g,session:C,sessionLanguage:y,settings:S,showCloseModal:E,showDeleteModal:w,showSaveAsModal:I}=this.state,O=f&&!a.isHidden&&!b,T=(e=g==null?void 0:g.itemName)!==null&&e!==void 0?e:je.DEFAULT_NAME,N=T.endsWith(".md"),R=(g==null?void 0:g.id)!=null,W=this.getSettings(S,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=C!=null,D=y===W.language,M=!p||!L||!D,F=!p,k=[{action:this.handleSave,shortcut:Pr.SAVE},{action:this.handleMinimapChange,shortcut:et.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:et.NOTEBOOK.WORDWRAP}],H=vo.getDisabledRunTooltip(L,D,"Notebook extension","Run"),q=vo.getDisabledRunTooltip(L,D,"Notebook extension","Run Selected"),re=[{title:R?"Rename":"Save As…",order:10,group:ae.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ae.groups.high,order:20}],V=s==null?void 0:s.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[V!=null&&xa.createPortal(u.jsx("span",{className:Y(je.UNSAVED_INDICATOR_CLASS_NAME,{[je.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),V),u.jsxs(Wt,{className:"notebook-container",componentPanel:this,glContainer:a,glEventHub:o,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:re,renderTabTooltip:()=>T,children:[!N&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(K,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:M,icon:u.jsx(ne,{icon:Cc,transform:"grow-4"}),tooltip:"Run ".concat(et.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),H!=null&&u.jsx(wt,{children:H})]}),u.jsxs("span",{children:[u.jsx(K,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:M,icon:u.jsx(ne,{icon:db,transform:"grow-4"}),tooltip:"Run Selected ".concat(et.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),q!=null&&u.jsx(wt,{children:q})]}),u.jsx(K,{kind:"ghost",className:"mr-auto",disabled:F,onClick:this.handleSave,icon:yc,tooltip:"Save ".concat(Pr.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(K,{kind:"ghost",className:"btn-overflow",disabled:F,icon:bc,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(En,{actions:this.getDropdownOverflowActions,popperOptions:je.POPPER_OPTIONS})})]}),u.jsx(LO,{isLoaded:p,isLoading:m,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:y,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:W,focusOnMount:O,ref:x=>{this.notebook=x}})]}),N&&u.jsx(v.Suspense,{fallback:u.jsx(He,{}),children:u.jsx(Fx,{content:(n=W.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(Bp,{isOpen:I,type:"file",defaultValue:T,title:R?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(_n,{isOpen:w,headerText:'Are you sure you want to delete "'.concat(T,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(_n,{isOpen:E,headerText:"Do you want to save the changes you made to ".concat(T,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ae,{actions:k})]})]})}}Ke(je,"COMPONENT","NotebookPanel");Ke(je,"POPPER_OPTIONS",{placement:"bottom-end"});Ke(je,"DEFAULT_NAME","Untitled");Ke(je,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Ke(je,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Ke(je,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var Ax=(r,e)=>{var t=qf(r),n=r_(r),i=Hr(r,e.localDashboardId),{session:a,config:s}=i??{},{type:o}=s??{};return{fileStorage:t,defaultNotebookSettings:n,session:a,sessionLanguage:o}},Rx=Pt(Ax,{updateSettings:b_},null,{forwardRef:!0})(je);const fn=Rx;function Qp(r){var{onClick:e}=r,t=v.useRef(null),n=v.useCallback(i=>{var a;(a=t.current)===null||a===void 0||a.blur(),e(i)},[e]);return u.jsxs(K,{ref:t,kind:"primary",className:"btn-pandas",onClick:n,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",u.jsxs("span",{children:[u.jsx(ne,{icon:wc,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})}function Sh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sh(Object(t),!0).forEach(function(n){cs(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function cs(r,e,t){return e=jx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jx(r){var e=kx(r,"string");return typeof e=="symbol"?e:String(e)}function kx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kl extends v.Component{constructor(e){super(e),cs(this,"irisGridRef",void 0),this.irisGridRef=X.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);var{panelState:t}=e;this.state={shouldFocusGrid:!1,panelState:t}}handleReload(){var e;(e=this.irisGridRef.current)===null||e===void 0||e.initModel(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var e,t,n,{shouldFocusGrid:i}=this.state;i&&(e=this.irisGridRef.current)!==null&&e!==void 0&&(t=e.irisGrid)!==null&&t!==void 0&&(n=t.current)!==null&&n!==void 0&&n.grid&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){return u.jsx(Mr,yh(yh({ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate},this.props),{},{children:u.jsx(Qp,{onClick:this.handleReload})}))}}cs(kl,"defaultProps",{panelState:null});cs(kl,"COMPONENT","PandasPanel");const Jp=kl;function Eh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function wh(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Eh(a,n,i,s,o,"next",l)}function o(l){Eh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Ph(r,e,t){return e=$x(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $x(r){var e=Ux(r,"string");return typeof e=="symbol"?e:String(e)}function Ux(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hx{constructor(e){Ph(this,"items",void 0),Ph(this,"onUpdateCallback",void 0),this.items=e}setSearch(e){}setExpanded(e,t){if(e.charAt(e.length-1)==="/")for(var n=0;n<this.items.length;n+=1){var i=this.items[n];mt(i)&&("".concat(i.filename,"/")===e||i.filename===e)&&(i.isExpanded=t)}return Promise.resolve()}collapseAll(){for(var e=0;e<this.items.length;e+=1){var t=this.items[e];mt(t)&&(t.isExpanded=!1)}return Promise.resolve()}getViewportData(){return Promise.resolve({items:this.items,offset:0})}getSnapshot(e){return wh(function*(){throw new Error("Method not implemented.")})()}setViewport(e){var t=this;return wh(function*(){var n,i=yield t.getViewportData();(n=t.onUpdateCallback)===null||n===void 0||n.call(t,i)})()}setFilters(e){}setSorts(e){}setReversed(e){}close(){}onUpdate(e){return this.onUpdateCallback=e,jest.fn()}get size(){return this.items.length}}const Vx=Hx;function _h(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function qr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){_h(a,n,i,s,o,"next",l)}function o(l){_h(a,n,i,s,o,"throw",l)}s(void 0)})}}function Bx(r,e,t){return e=Wx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wx(r){var e=Gx(r,"string");return typeof e=="symbol"?e:String(e)}function Gx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zx{constructor(e){Bx(this,"items",void 0),this.items=e}getTable(){var e=this;return qr(function*(){return new Vx(e.items)})()}saveFile(e){throw new Error("Method not implemented.")}loadFile(e){throw new Error("Method not implemented.")}copyFile(e,t){return qr(function*(){throw new Error("Method not implemented.")})()}deleteFile(e){var t=this;return qr(function*(){t.items=t.items.filter(n=>n.filename!==e)})()}moveFile(e,t){var n=this;return qr(function*(){for(var i=0;i<n.items.length;i+=1)if(n.items[i].filename===e){n.items[i].filename=t,n.items[i].basename=ee.getBaseName(t),n.items[i].id=t;break}})()}info(e){var t=this;return qr(function*(){var n=t.items.filter(a=>a.filename===e);if(n.length===0)throw new ls;if(n.length>1)throw new Error("More than one matching file found");var i=n[0];return{filename:i.filename,basename:i.basename,id:i.filename,type:i.type}})()}createDirectory(e){throw new Error("Method not implemented.")}}const Kx=zx;function Th(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ia(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Th(Object(t),!0).forEach(function(n){qx(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Th(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function qx(r,e,t){return e=Yx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yx(r){var e=Xx(r,"string");return typeof e=="symbol"?e:String(e)}function Xx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Oh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Zx(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Oh(a,n,i,s,o,"next",l)}function o(l){Oh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Qx(r,e,t,n,i){return go.apply(this,arguments)}function go(){return go=Zx(function*(r,e,t,n,i){var a,s,o,l;if(Cr(t)?(a=t.settings,s=t.table,o=void 0,l=t.tableSettings):(a={},s="",o=Ml(t)?t.figure:t.name,l={}),i!=null&&(i.tableSettings!=null&&(l=i.tableSettings),i.table!=null&&(s=i.table),i.figure!=null&&(o=i.figure),i.settings!=null&&(a=Ia(Ia({},a),i.settings))),o==null&&s==null){var d=yield n();return mr.makeModel(r,a,d)}if(o!=null){var h;if(t.type===r.VariableType.FIGURE){var c={name:o,type:r.VariableType.FIGURE};h=yield e(c)}else h=yield n();return mr.makeModel(r,a,h)}var f={name:s,type:r.VariableType.TABLE},p=yield e(f);return new Ze(r).applyTableSettings(p,l,bl(X_.getState())),mr.makeModelFromSettings(r,a,p)}),go.apply(this,arguments)}var $l=v.forwardRef((r,e)=>{var t=Ve(),n=Fv(),i=Up(r)?r.panelState:void 0,{fetch:a,metadata:s,localDashboardId:o}=r,l=v.useMemo(()=>({metadata:s,localDashboardId:o,makeModel:()=>{if(s==null)throw new Error("Metadata is required for chart panel");return Qx(t,n,s,a,i)}}),[s,o,t,n,a,i]);return u.jsx(Ai,Ia(Ia({ref:e},r),l))});$l.displayName="ChartPanelPlugin";const Jx=$l;function Dh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function eN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Dh(a,n,i,s,o,"next",l)}function o(l){Dh(a,n,i,s,o,"throw",l)}s(void 0)})}}function em(r){var e=Ve(),[t,n]=v.useState(),{fetch:i}=r;return v.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=eN(function*(){var l=yield i(),d=yield mr.makeModel(e,void 0,l);a||n(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(ul,{model:t}):null}var tN={name:"ChartPanel",title:"Chart",type:nt.WIDGET_PLUGIN,component:em,panelComponent:$l,supportedTypes:"Figure",icon:_o};const nN=tN;function tm(r){Kn(r);var{id:e,layout:t}=r,n=Ve(),i=v.useCallback(a=>{var{metadata:s,panelId:o=ye.generate(),table:l}=a,{settings:d}=s,h=()=>mr.makeModelFromSettings(n,d,l),c=xe.titleFromSettings(d),f={type:"react-component",component:Ai.COMPONENT,props:{localDashboardId:e,id:o,metadata:s,makeModel:h},title:c,id:o},{root:p}=t;A.openComponent({root:p,config:f})},[n,e,t]);return ce(t.eventHub,Et.CREATE_CHART,i),null}var rN={name:"ChartBuilderPlugin",type:nt.DASHBOARD_PLUGIN,component:tm};const iN=rN;function Ih(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ih(Object(t),!0).forEach(function(n){aN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ih(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function aN(r,e,t){return e=sN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sN(r){var e=oN(r,"string");return typeof e=="symbol"?e:String(e)}function oN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Oe=B.module("ConsolePlugin");function Nh(r){return r.notebook!==void 0}function lN(r){Kn(r)}function dN(r){lN(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:a,notebooksUrl:s}=r,o=v.useRef(0),[l,d]=v.useState(new Map),[h,c]=v.useState(new Map),f=gi(),p=v.useCallback(()=>i.getLastUsedPanelOfType(oa),[i]),m=v.useCallback((x,P)=>{d(j=>new Map(j.set(x,P)))},[d]),b=v.useCallback(x=>{d(P=>(P.delete(x),new Map(P)))},[d]),g=v.useCallback((x,P)=>{c(j=>new Map(j.set(x,P)))},[c]),C=v.useCallback(x=>{c(P=>(P.delete(x),new Map(P)))},[c]),y=v.useCallback(function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,U=x&&x.trim();if(!U)Oe.info("Ignoring empty code");else{var Q=p();if(!Q||!(Q instanceof oa.WrappedComponent)){Oe.error("Console panel not found");return}Oe.debug("Send command: ",x,P,j),Q.addCommand(x,P,j)}},[p]),S=v.useCallback(x=>{f(Rp(e,x))},[f,e]),E=v.useCallback(x=>{var{language:P}=x,j=P==="python"?"py":P,U=null;return j==null?(Oe.debug("No extension for language",P),U="Untitled-".concat(o.current)):U="Untitled-".concat(o.current,".").concat(j),o.current+=1,U},[]),w=v.useCallback(function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:j}=x;if(j!=null&&l.has(j))return l.get(j);if(j!=null&&h.has(j))return h.get(j);if(P)return ye.generate()},[l,h]),I=v.useCallback((x,P)=>{A.renameComponent(n.root,{id:x},P)},[n.root]),O=v.useCallback((x,P)=>{Oe.debug("Rename file panel",x,P);var j;if(l.has(x)&&(j=l.get(x),b(x),j!=null&&m(P,j)),h.has(x)&&(j=h.get(x),C(x),j!=null&&g(P,j)),j===void 0){Oe.debug2("File ".concat(x," isn't open, no need to rename the tab"));return}I(j,ee.getBaseName(P))},[l,h,I,m,g,b,C]),T=v.useCallback(x=>{var P=w(x,!1);if(P==null){Oe.error("Could not find panel id for file metadata",x);return}A.activateTab(n.root,{id:P})},[w,n.root]),N=v.useCallback((x,P,j)=>{if(Oe.debug("registerFilePanel",x,P,j),P==null||P.id==null){Oe.debug("Ignore empty file id",P);return}var{id:U}=P;if(j){g(U,x);return}if(l.has(U)){var Q=l.get(U);if(x===Q){Oe.debug("Update tab title for file ".concat(U));var{itemName:me}=P;O(U,me)}else Oe.error("File ".concat(U," already associated with a different tab ").concat(Q));return}m(U,x),h.has(U)&&C(U)},[l,h,O,m,g,C]),R=v.useCallback((x,P)=>{if(Oe.debug("unregisterFileTab",x,P),x==null||x.id==null){Oe.debug("Ignore empty file id",x);return}var{id:j}=x;if(P){C(j);return}b(j)},[b,C]),W=v.useCallback((x,P)=>{Oe.debug("closeFilePanel",x);var{id:j}=x,U=null,Q=!1;if(l.has(j))U=l.get(j);else if(h.has(j))U=h.get(j),Q=!0;else{Oe.debug("File ".concat(j," isn't open, ignore close event"));return}R(x,Q),A.closeComponent(n.root,{id:U},P)},[n.root,l,h,R]),L=v.useCallback(x=>{var{itemName:P}=x;return ee.getBaseName(P)},[]),D=v.useCallback(x=>{var{id:P}=x;return Oe.debug("fileIsOpen",x,P,l),P!=null&&l.has(P)},[l]),M=v.useCallback(x=>{var{id:P}=x;return Oe.debug("fileIsOpenAsPreview",x,P,h),P!=null&&h.has(P)},[h]),F=v.useCallback(x=>{if(x!=null){var P=i.getOpenedPanelById(x);P&&Nh(P)&&P.focus()}},[i]),k=v.useCallback(x=>{var{id:P,settings:j,fileMetadata:U,session:Q,sessionLanguage:me,isPreview:$=!1}=x,J={settings:j,fileMetadata:U},ie=L(U);return{type:"react-component",component:fn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:P},session:Q,sessionLanguage:me,panelState:J,isPreview:$,notebooksUrl:s},title:ie,id:P}},[L,e,s]),H=v.useCallback(function(x,P,j){var U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:E(j)},Q=w(U);if(D(U)&&Q!=null){Oe.debug("File is already open, focus panel"),T(U),F(Q);return}var me=A.getStackForComponentTypes(n.root,[fn.COMPONENT]),$=k({id:Q,settings:j,fileMetadata:U,session:x,sessionLanguage:P});Oe.debug("createNotebook",$,l),A.openComponentInStack(me,$)},[D,F,E,w,n.root,k,l,T]),q=v.useCallback(function(x,P,j,U){var Q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;Oe.debug("selectNotebook",U,Q);var me=D(U),$=M(U),[J]=[...h.values()],ie=!Q,ve=ie&&J?J:w(U);if(ve==null||ve==="")throw new Error("Unable to retrieve or create panelId for metadata",U);if(me||$)T(U);else{var Ee=A.getStackForComponentTypes(n.root,[fn.COMPONENT]),Vr=k({id:ve,settings:j,fileMetadata:U,session:x,sessionLanguage:P,isPreview:ie});A.openComponentInStack(Ee,Vr)}if($&&Q){var Qn=U.id,Br=A.getStackForConfig(n.root,{component:fn.COMPONENT,id:ve}),xn=A.getContentItemInStack(Br,{component:fn.COMPONENT,id:ve});xn&&ht(xn)&&(xn.container.emit(he.PROMOTE_FROM_PREVIEW),C(Qn),m(Qn,ve))}Q&&F(ve)},[T,D,M,F,w,n.root,k,h,C,m]),re=v.useCallback(function(x,P){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,Q=i.getLastUsedPanelOfType(fn);Q&&Nh(Q)?j!=null&&j.value!=null&&Q.notebook!=null&&Q.notebook.append(j.value):U&&H(x,P,j)},[H,i]),V=v.useCallback((x,P)=>Bf.hydrate(xh(xh({},x),{},{notebooksUrl:s}),P),[s]);return An(a,oa,t),An(a,Hp),An(a,Gp),An(a,Yp),An(a,fn,V),ce(n.eventHub,pt.SEND_COMMAND,y),ce(n.eventHub,pt.SETTINGS_CHANGED,S),ce(n.eventHub,he.CLOSE_FILE,W),ce(n.eventHub,he.CREATE_NOTEBOOK,H),ce(n.eventHub,he.SELECT_NOTEBOOK,q),ce(n.eventHub,he.RENAME,I),ce(n.eventHub,he.RENAME_FILE,O),ce(n.eventHub,he.SEND_TO_NOTEBOOK,re),ce(n.eventHub,he.REGISTER_FILE,N),ce(n.eventHub,he.UNREGISTER_FILE,R),null}var Yr=B.module("FilterPlugin");function Mh(r,e){return r.concat(e)}function nm(r){Kn(r);var{id:e,layout:t,registerComponent:n}=r,i=gi(),[a]=v.useState(()=>new Map),[s]=v.useState(()=>new Map),[o]=v.useState(()=>new Map),l=v.useCallback(()=>{var g=Array.from(a.values()).reduce(Mh,[]).sort((S,E)=>{var w=Ot.toLower(S.name),I=Ot.toLower(E.name);if(w!==I)return w>I?1:-1;var O=Ot.toLower(S.type),T=Ot.toLower(E.type);return O!==T?O>T?1:-1:0}).reduce((S,E)=>((S.length===0||Ot.toLower(S[S.length-1].name)!==Ot.toLower(E.name)||Ot.toLower(S[S.length-1].type)!==Ot.toLower(E.type))&&S.push(E),S),[]),C=Array.from(s.values()).reduce(Mh,[]).sort((S,E)=>S.timestamp-E.timestamp),y=new Map(o);Yr.debug("sendUpdate",{columns:g,filters:C,tableMap:y}),i(At(e,{columns:g,filters:C,tableMap:y}))},[i,e,a,s,o]),d=v.useCallback((g,C)=>{Yr.debug2("handleColumnsChanged",g,C),a.set(g,[].concat(C)),l()},[a,l]),h=v.useCallback((g,C)=>{Yr.debug2("handleFiltersChanged",g,C),s.set(g,[].concat(C)),l()},[s,l]),c=v.useCallback((g,C)=>{Yr.debug2("handleTableChanged",g,C),o.set(A.getIdFromPanel(g),C),l()},[o,l]),f=v.useCallback(g=>{Yr.debug2("handlePanelUnmount",g),a.delete(g),s.delete(g),o.delete(A.getIdFromPanel(g)),l()},[a,s,o,l]),p=v.useCallback(g=>{var{title:C="DropdownFilter",metadata:y={},panelState:S=null,id:E=ye.generate(),focusElement:w=A.DEFAULT_FOCUS_SELECTOR,createNewStack:I=!1,dragEvent:O=null}=g,T={type:"react-component",component:Pn.COMPONENT,props:{id:E,metadata:y,panelState:S,localDashboardId:e},title:C,id:E},{root:N}=t;A.openComponent({root:N,config:T,focusElement:w,createNewStack:I,dragEvent:O})},[t,e]),m=v.useCallback(g=>{var{title:C="InputFilter",metadata:y={},panelState:S=null,id:E=ye.generate(),focusElement:w=A.DEFAULT_FOCUS_SELECTOR,createNewStack:I=!1,dragEvent:O=void 0}=g,T={type:"react-component",component:Sr.COMPONENT,props:{id:E,metadata:y,panelState:S,localDashboardId:e},title:C,id:E},{root:N}=t;A.openComponent({root:N,config:T,focusElement:w,createNewStack:I,dragEvent:O})},[t,e]),b=v.useCallback(g=>{var{title:C="FilterSets",metadata:y={},panelState:S=null,id:E=ye.generate(),focusElement:w=A.DEFAULT_FOCUS_SELECTOR,createNewStack:I=!1,dragEvent:O=null}=g,T={type:"react-component",component:da.COMPONENT,props:{id:E,metadata:y,panelState:S,localDashboardId:e},title:C,id:E},{root:N}=t;A.openComponent({root:N,config:T,focusElement:w,createNewStack:I,dragEvent:O})},[t,e]);return v.useEffect(function(){var C=[n(Pn.COMPONENT,Pn),n(Sr.COMPONENT,Sr),n(da.COMPONENT,da)];return()=>{C.forEach(y=>y())}},[n]),ce(t.eventHub,Te.COLUMNS_CHANGED,d),ce(t.eventHub,Te.FILTERS_CHANGED,h),ce(t.eventHub,Te.TABLE_CHANGED,c),ce(t.eventHub,Te.OPEN_DROPDOWN,p),ce(t.eventHub,Te.OPEN_INPUT,m),ce(t.eventHub,Te.OPEN_FILTER_SET_MANAGER,b),ce(t.eventHub,te.UNMOUNT,f),null}var uN={name:"FilterPlugin",type:nt.DASHBOARD_PLUGIN,component:nm};const hN=uN;var cN=B.module("@deephaven/app-utils/useTablePlugin");function rm(){var r=Ba(),e=v.useCallback(t=>{var n=r.get(t);if(n!=null){if(nf(n))return n.component;if(al(n))return n.TablePlugin}var i="Unable to find table plugin ".concat(t,".");throw cN.error(i),new Error(i)},[r]);return e}function Lh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function vN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Lh(a,n,i,s,o,"next",l)}function o(l){Lh(a,n,i,s,o,"throw",l)}s(void 0)})}}function im(r,e,t){var n=Ve(),i=rm(),a=v.useMemo(()=>({loadPlugin:i,localDashboardId:e,makeModel:function(){var s=vN(function*(){var l=yield r();return Ra.makeModel(n,l)});function o(){return s.apply(this,arguments)}return o}(),metadata:t}),[n,r,e,i,t]);return a}function Fh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ah(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fh(Object(t),!0).forEach(function(n){fN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fN(r,e,t){return e=pN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pN(r){var e=mN(r,"string");return typeof e=="symbol"?e:String(e)}function mN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ul=v.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=im(n,t,i);return u.jsx(Mr,Ah(Ah({ref:e},r),a))});Ul.displayName="GridPanelPlugin";const gN=Ul;function Rh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function bN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Rh(a,n,i,s,o,"next",l)}function o(l){Rh(a,n,i,s,o,"throw",l)}s(void 0)})}}function am(r){var e=Ve(),[t,n]=v.useState(),{fetch:i}=r;return v.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=bN(function*(){var l=yield i(),d=yield Ra.makeModel(e,l);a||n(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(Tr,{model:t}):null}var CN={name:"IrisGridPanel",title:"Table",type:nt.WIDGET_PLUGIN,component:am,panelComponent:Ul,supportedTypes:["Table","TreeTable","HierarchicalTable","PartitionedTable"],icon:To};const SN=CN;function jh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function cn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jh(Object(t),!0).forEach(function(n){sm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sm(r,e,t){return e=yN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yN(r){var e=EN(r,"string");return typeof e=="symbol"?e:String(e)}function EN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function om(r){var e=r;return typeof e.getCoordinateForColumn=="function"}function kh(r){var e=r;return om(r)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function $h(r){var e;return r.description===void 0||!((e=r.description)!==null&&e!==void 0&&e.startsWith("Preview of type: "))}var Xr=B.module("LinkerUtils");class vs{static getLinkType(e,t,n){var i;if((e==null?void 0:e.panelId)==null||(t==null?void 0:t.panelId)==null||e.panelId===t.panelId||n!=null&&n!==e.panelId&&n!==t.panelId)return Xr.debug2("Incompatible panel ids",e,t,n),"invalid";if(e.panelComponent==null||t.panelComponent==null)return Xr.error("PanelComponent should not be null",e,t),"invalid";var a=(i=vs.ALLOWED_LINKS.get(e.panelComponent))===null||i===void 0?void 0:i.includes(t.panelComponent);if(a===void 0||!a)return Xr.debug2("Incompatible panel components",e,t),"invalid";var{columnType:s}=e,{columnType:o}=t,l=o===null||Ne.isCompatibleType(s,o);if(!l)return Xr.debug2("Incompatible type",s,o),"invalid";switch(t.panelComponent){case A.getComponentName(Ai):return"chartLink";case A.getComponentName(Mr):return"tableLink";case A.getComponentName(Pn):return"filterSource"}return Xr.debug2("Incompatible target panel component",t.panelComponent),"invalid"}static findColumn(e,t){var{columnName:n,columnType:i}=t;return e.find(a=>{var{name:s,type:o}=a;return s===n&&o===i})}static cloneLinksForPanel(e,t,n){var i=[];return e.forEach(a=>{var s;a.start.panelId===t&&a.type!=="filterSource"?i.push(cn(cn({},a),{},{id:ye.generate(),start:cn(cn({},a.start),{},{panelId:n})})):((s=a.end)===null||s===void 0?void 0:s.panelId)===t&&i.push(cn(cn({},a),{},{id:ye.generate(),end:cn(cn({},a.end),{},{panelId:n})}))}),i}}sm(vs,"ALLOWED_LINKS",new Map([[A.getComponentName(Mr),[A.getComponentName(Mr),A.getComponentName(Ai),A.getComponentName(Pn)]]]));const Fn=vs;function lm(r,e,t){return e=wN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wN(r){var e=PN(r,"string");return typeof e=="symbol"?e:String(e)}function PN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var _N=B.module("LinkerLink"),Uh=.015,Hh=1.5,dm=12,um=12,Vh=2,ia=Math.sqrt((um*.5)**2+dm**2),Bh=Math.asin(um*.5/dm),Wh=15,vn=Math.PI*.5;class yr extends v.Component{static makeCirclePath(e,t,n){return"M ".concat(e," ").concat(t," m -").concat(n,",0 a ").concat(n,",").concat(n," 0 1,0 ").concat(n*2,",0 a ").concat(n,",").concat(n," 0 1,0 -").concat(n*2,",0 z")}static getLabelForLinkFilter(e,t){try{if(Ne.isNumberType(e)||Ne.isCharType(e))return RC(t);if(Ne.isTextType(e))return jC(t);if(Ne.isDateType(e))return kC(t);if(Ne.isBooleanType(e)){if(t===Qr.eq)return"is equal to";if(t===Qr.notEq)return"is not equal to"}throw new Error("Unrecognized column type: ".concat(e))}catch(n){return _N.warn(n),""}}constructor(e){super(e),lm(this,"getOperators",se((t,n)=>{var{onOperatorChanged:i}=this.props,a=Ne.getFilterTypes(n);return Ne.isBooleanType(n)&&(a=[Qr.eq,Qr.notEq]),a.flatMap((s,o)=>{if(s==="eqIgnoreCase"||s==="notEqIgnoreCase")return[];var l="";return s==="startsWith"?l="a*":s==="endsWith"?l="*z":l=Ne.getFilterOperatorString(s),[{title:yr.getLabelForLinkFilter(n,s),icon:u.jsx("b",{children:l}),action:()=>i(t,s),order:o}]})})),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}handleClick(e){e.stopPropagation(),e.preventDefault();var{id:t,onClick:n,onDelete:i}=this.props;e.altKey?i(t):n(t)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){var{id:e,onDelete:t}=this.props;t(e)}getDropdownActions(){var{id:e,startColumnType:t}=this.props;return t!=null?this.getOperators(e,t):[]}render(){var{className:e,operator:t,isSelected:n,x1:i,y1:a,x2:s,y2:o,id:l,startColumnType:d,type:h}=this.props,{isHovering:c}=this.state,f=Math.sqrt((i-s)**2+(a-o)**2),p=Math.atan2(o-a,s-i),m=Math.sin(p),b=Math.cos(p)+2,g=window.innerWidth,C=window.innerHeight,y=0,S=0,E=Math.max(y,Math.min(i+(s-i)/2+m*(f*Uh)**Hh,g)),w=Math.max(S,Math.min(a+(o-a)/2+b*(f*Uh)**Hh,C)),I="M ".concat(i," ").concat(a," Q ").concat(E," ").concat(w," ").concat(s," ").concat(o),O="M ".concat(y," ").concat(S," L ").concat(y," ").concat(C," L ").concat(g," ").concat(C," L ").concat(g," ").concat(S,` z
24
+ `).concat(o," does not exist yet.")}if(i){var{widgetName:l}=this.props;return"".concat(l," is unavailable.")}}handleSessionClosed(){var{onSessionClose:e}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),e(...arguments)}handleSessionOpened(){var{onSessionOpen:e}=this.props;e(...arguments)}render(){var{children:e,className:t,componentPanel:n,isLoaded:i,isLoading:a,glContainer:s,glEventHub:o,isDisconnected:l,isClonable:d,isRenamable:h,showTabTooltip:v,renderTabTooltip:f,widgetType:p,widgetName:m,description:b,onClearAllFilters:g,onHide:C,onFocus:y,onBlur:S,onResize:E,onShow:w,onTabBlur:I,onTabFocus:O,onTabClicked:T}=this.props,{isPanelDisconnected:N,isWidgetDisconnected:R,isPanelInactive:W}=this.state,L=this.getErrorMessage(),D=f??this.getCachedRenderTabTooltip(v,s,p,m,b),M=[{title:"Copy ".concat(p," Name"),group:ae.groups.medium,order:20,action:this.handleCopyName}];return u.jsxs(Wt,{className:Y(t,{disconnected:N||R||l,inactive:W}),componentPanel:n,glContainer:s,glEventHub:o,onClearAllFilters:g,onHide:C,onFocus:y,onBlur:S,onResize:E,onShow:w,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:I,onTabFocus:O,onTabClicked:T,renderTabTooltip:D,errorMessage:L,isLoaded:i,isLoading:a,isClonable:d,isRenamable:h,additionalActions:M,children:[e,W&&u.jsx("div",{className:"fill-parent-absolute"})]})}}xp(Np,"defaultProps",{className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}});const Fi=Np,Nt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var $D=Object.freeze({}),UD=new Map,es=Object.freeze([]),xl=(r,e)=>{var t;return(t=Be(r,e).columns)!==null&&t!==void 0?t:es},Mp=(r,e)=>{var t;return(t=Be(r,e).filterSets)!==null&&t!==void 0?t:es},ts=(r,e)=>{var t;return(t=Be(r,e).filters)!==null&&t!==void 0?t:es},ns=(r,e)=>{var t;return(t=Be(r,e).tableMap)!==null&&t!==void 0?t:UD},rs=(r,e)=>Be(r,e).isolatedLinkerPanelId,Zn=(r,e)=>{var t;return(t=Be(r,e).links)!==null&&t!==void 0?t:es},is=(r,e)=>Be(r,e).columnSelectionValidator,HD=(r,e)=>{var t;return(t=Be(r,e).consoleSettings)!==null&&t!==void 0?t:$D},VD=(r,e)=>Be(r,e).connection,Hr=(r,e)=>Be(r,e).sessionWrapper,BD=(r,e)=>t=>t(At(r,{connection:e})),WD=(r,e)=>t=>t(At(r,{sessionWrapper:e})),as=(r,e)=>t=>t(At(r,{links:e})),Lp=(r,e)=>(t,n)=>{var i=Zn(n(),r),a=e.filter(s=>i.findIndex(o=>Mt(o.start,s.start)&&Mt(o.end,s.end))<0);return t(as(r,i.concat(a)))},Fp=(r,e)=>(t,n)=>{var i=Zn(n(),r),a=i.filter(s=>!e.includes(s.id));return t(as(r,a))},Nl=(r,e)=>t=>t(At(r,{isolatedLinkerPanelId:e})),Ap=(r,e)=>t=>t(At(r,{columnSelectionValidator:e})),Rp=(r,e)=>t=>t(At(r,{consoleSettings:e})),jp=(r,e)=>t=>t(At(r,{filterSets:e}));function kp(r){var{columnMap:e,inputFilterMap:t,linkedColumnMap:n,onAdd:i,onOpenLinker:a,waitingFilterMap:s,waitingInputMap:o}=r,l=c.useMemo(()=>{var m=Array.from(o.keys()),b=m.find(y=>t.get(y)!=null),g=m.find(y=>n.get(y)!=null),C=Ot.join(m.map(y=>'"'.concat(y,'"')));return b!=null&&b&&g!=null&&g?"Use a filter control or linked table to set a value for ".concat(C):b!=null&&b?"Set a filter control value for ".concat(C):"Double click a row in a linked table to set a value for ".concat(C)},[t,n,o]),d=c.useMemo(()=>Array.from(e.values()),[e]),h=c.useCallback(m=>{m.stopPropagation(),m.preventDefault(),i(Array.from(s.values()))},[i,s]),v=c.useCallback(m=>{m.stopPropagation(),m.preventDefault(),a()},[a]),f=s.size>0,p=!f&&o.size>0;return u.jsx("div",{className:"chart-panel-overlay chart-filter-overlay",children:u.jsxs("div",{className:Y("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":f},{"chart-filter-waiting-input":p}),children:[f&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),u.jsx("div",{className:"waiting-filter-list",children:d.map(m=>{var b=s.has(m.name),g=b?Oo:Jg;return u.jsxs("div",{className:Y("waiting-filter-item",{"is-invalid":b}),children:[u.jsx(ne,{icon:g}),m.name]},m.name)})}),u.jsxs("div",{children:[u.jsx(Hs,{onClick:h,className:"btn-primary",children:"Add Input Filters"}),u.jsx(Hs,{onClick:v,className:"btn-primary",children:"Open Linker Tool"})]})]}),p&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"info-message",children:"Waiting for User Input"}),u.jsx("div",{className:"",children:l})]})]})})}kp.propTypes={columnMap:_.instanceOf(Map).isRequired,inputFilterMap:_.instanceOf(Map).isRequired,linkedColumnMap:_.instanceOf(Map).isRequired,onAdd:_.func.isRequired,onOpenLinker:_.func.isRequired,waitingFilterMap:_.instanceOf(Map).isRequired,waitingInputMap:_.instanceOf(Map).isRequired};function pi(r){var{columns:e,onColumnSelected:t,onMouseEnter:n,onMouseLeave:i}=r;return u.jsx("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:u.jsxs("div",{className:Y("chart-panel-overlay-content"),children:[u.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),u.jsx("div",{className:"waiting-column-select-list",children:e.map(a=>u.jsx(Bo,{className:Y("btn-chart-column-selector",pi.makeButtonClassName(a.name)),onClick:()=>t(a.name),onMouseEnter:()=>{n&&n(a)},onMouseLeave:i,disabled:!a.isValid,isLinked:a.isActive,children:a.name},a.name))})]})})}pi.makeButtonClassName=r=>"btn-chart-column-selector-".concat(r);pi.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function Cr(r){return r.settings!==void 0}function Ml(r){return r.figure!==void 0}function $p(r){if(r==null)return!1;var{settings:e,tableSettings:t}=r;return typeof e=="object"&&typeof t=="object"}function Up(r){return r!=null&&$p(r.panelState)}function zu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ku(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zu(Object(t),!0).forEach(function(n){Dt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):zu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Dt(r,e,t){return e=GD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GD(r){var e=zD(r,"string");return typeof e=="symbol"?e:String(e)}function zD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var it=B.module("ChartPanel"),KD=150;function qD(r){return r.inputFilters!=null}function YD(r){return r.panelState!=null}class ss extends c.Component{constructor(e){super(e),Dt(this,"panelContainer",void 0),Dt(this,"pending",void 0),Dt(this,"getWaitingInputMap",se((s,o,l)=>{if(!s)return new Map;var d=new Map(o);return l.forEach((h,v)=>{d.delete(v)}),d})),Dt(this,"getWaitingFilterMap",se((s,o,l,d,h)=>{if(!s)return new Map;var v=new Map(o);return l.forEach((f,p)=>{v.delete(p)}),h.forEach((f,p)=>{v.delete(p)}),d.forEach((f,p)=>{v.delete(p)}),v})),Dt(this,"getInputFilterColumnMap",se((s,o)=>{for(var l=new Map,d=0;d<o.length;d+=1){var h=o[d],{name:v,type:f}=h,p=s.get(v);p!=null&&p.type===f&&l.set(v,h)}return l})),Dt(this,"getLinkedColumnMap",se((s,o)=>{for(var l=new Map,d=A.getIdFromPanel(this),h=0;h<o.length;h+=1){var v=o[h],f=null;if(v.start!=null&&v.start.panelId===d&&s.has(v.start.columnName)?f=v.start.columnName:v.end&&v.end.panelId===d&&s.has(v.end.columnName)&&(f=v.end.columnName),f!=null&&s.has(f)){var p=s.get(f);z(p),l.set(f,p)}}return l})),Dt(this,"getSelectorColumns",se((s,o,l)=>Array.from(s.values()).map(d=>({name:d.name,type:d.type,isValid:l?l(this,d):!1,isActive:o.has(d.name)})))),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=Le(this.updateModelFromSource.bind(this),KD),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=X.createRef(),this.pending=new Tn;var{metadata:t,panelState:n}=e,{filterValueMap:i=[],settings:a={}}=n??{};this.state={settings:a,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:t!=null&&Cr(t)&&t.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:n}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,t){var{inputFilters:n,source:i,makeModel:a}=this.props,{columnMap:s,model:o,filterMap:l,filterValueMap:d,isLinked:h,settings:v}=this.state;o&&(a!==e.makeModel&&this.initModel(),s!==t.columnMap&&this.pruneFilterMaps(),n!==e.inputFilters&&this.updateChangedInputFilters(n,e.inputFilters),l!==t.filterMap?this.updateFilters():d!==t.filterValueMap&&this.updatePanelState(),v!==t.settings&&to(o)&&(o.updateSettings(v),this.updatePanelState()),h!==t.isLinked?i&&(h?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):h&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();var{model:e}=this.state,{source:t}=this.props;e!=null&&t&&this.stopListeningToSource(t)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});var{makeModel:e}=this.props;this.pending.add(e(),t=>{t.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){it.debug("startListeningToSource",e);var{model:t}=this.state;z(t);var{dh:n}=t;e.addEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){it.debug("stopListeningToSource",e);var{model:t}=this.state;z(t);var{dh:n}=t;e.removeEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){var{isActive:e,isLoaded:t,isLoading:n}=this.state;e&&!t&&!n&&this.initModel()}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}handleColumnSelected(e){var{glEventHub:t}=this.props,{columnMap:n}=this.state;t.emit(Ta.COLUMN_SELECTED,this,n.get(e))}handleColumnMouseEnter(e){var{type:t,name:n}=e,{columnSelectionValidator:i}=this.props;it.debug("handleColumnMouseEnter",i,t,n),i&&i(this,{type:t,name:n})}handleColumnMouseLeave(){var{columnSelectionValidator:e}=this.props;it.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(var t=0;t<e.length;t+=1)this.openInputFilter(e[t])}handleOpenLinker(){var{localDashboardId:e,setActiveTool:t,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0),t(Nt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){it.debug("handleLoadSuccess");var{model:t}=this.state;this.setState({model:e,isLoaded:!0},()=>{var{inputFilters:n,source:i}=this.props,{filterMap:a,isLinked:s}=this.state;e!==t&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(n,a.size>0||e.isFilterRequired()),i&&s&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){Se.isCanceled(e)||(it.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){var{metadata:e,source:t}=this.props,{isLinked:n,model:i}=this.state;if(!n||!i||!t){it.debug2("updateModelFromSource ignoring",n,i,t);return}var{dh:a}=i;if(this.pending.cancel(),Cr(e)){var{settings:s}=e;this.pending.add(a.plot.Figure.create(new xe(a).makeFigureSettings(s,t))).then(o=>{to(i)&&i.setFigure(o)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){var{sourcePanel:e}=this.props,{panelState:t,filterValueMap:n,settings:i}=this.state,{tableSettings:a}=t??{};if(e&&qD(e.props)&&YD(e.state)){var{inputFilters:s}=e.props,{panelState:o}=e.state;o!=null&&(a=Ze.extractTableSettings(o,s))}this.setState({panelState:{settings:i,tableSettings:a,filterValueMap:Array.from(n)}})}handleError(){this.setState({isLoading:!1})}handleSettingsChanged(e){this.setState(t=>{var{settings:n}=t,i=Ku(Ku({},n),e);return it.debug("Updated settings",i),{settings:i}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){var e=this.isHidden();this.setActive(!e)}handleUpdate(e){var{isLoading:t}=e;this.setState({isLoading:t})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){var{glEventHub:t}=this.props,{name:n,type:i}=e;t.emit(Te.OPEN_INPUT,{title:"".concat(n," Filter"),panelState:{name:n,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&this.loadModelIfNecessary()})}sendColumnChange(){var{model:e}=this.state;if(e){var{glEventHub:t}=this.props;t.emit(Te.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}}getCoordinateForColumn(e){var t,n=pi.makeButtonClassName(e);if(!this.panelContainer.current)return null;var i=this.panelContainer.current.querySelector(".".concat(n)),a=(t=i==null?void 0:i.getBoundingClientRect())!==null&&t!==void 0?t:null;if(a==null||a.width<=0||a.height<=0)return null;var s=a.left+a.width/2,o=a.bottom;return[s,o]}setFilterMap(e){it.debug("setFilterMap",e),this.setState(t=>{var n,{columnMap:i,filterMap:a}=t,s=null,o=new Map(t.filterValueMap);return e.forEach((l,d)=>{var{columnType:h,filterList:v}=l,f=i.get(d);if(!(f==null||f.type!==h)){if(v.length<1){it.debug("Ignoring empty filterList for column",d);return}var{value:p}=v[0];o.set(d,p),a.get(d)!==p&&(s===null&&(s=new Map(a)),s.set(d,p))}}),{filterValueMap:o,filterMap:(n=s)!==null&&n!==void 0?n:a}})}unsetFilterValue(e){this.setState(t=>{var{inputFilters:n}=this.props,{columnMap:i}=t,{filterMap:a,filterValueMap:s}=t;if(!s.has(e))return null;s=new Map(t.filterValueMap),s.delete(e);var o=this.getInputFilterColumnMap(i,n);if(o.has(e)){var l,d=a.get(e),h=(l=o.get(e))===null||l===void 0?void 0:l.value;h!=null&&d!==h&&(a=new Map(t.filterMap),h.length>0?a.set(e,h):a.delete(e))}else a=new Map(t.filterMap),a.delete(e);return{filterMap:a,filterValueMap:s}})}updateChangedInputFilters(e,t){var n=t.filter(a=>e.find(s=>s.name===a.name&&s.type===a.type)===void 0);n.length>0&&this.deleteInputFilters(n);var i=e.filter(a=>!t.includes(a));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i}=n,a=new Map(n.filterValueMap),s=new Map(n.filterMap),o=t?{filterMap:s,filterValueMap:a}:{},l=0;l<e.length;l+=1){var{name:d,type:h,value:v}=e[l],f=i.get(d);f!=null&&f.type===h&&(v!=null&&s.get(d)!==v&&(v===""?s.delete(d):s.set(d,v),o.filterMap=s),a.has(d)&&(a.delete(d),o.filterValueMap=a))}return it.debug("updateInputFilters",o),o})}deleteInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i,filterValueMap:a}=n,s=new Map(n.filterMap),o=t,l=0;l<e.length;l+=1){var{name:d,type:h}=e[l],v=i.get(d);if(v!=null&&v.type===h&&s.has(d)){var f=s.get(d);if(a.has(d)){var p=a.get(d);p!==f&&p!=null&&(o=!0,s.set(d,p))}else o=!0,s.delete(d)}}return it.debug("deleteInputFilters",o),o?{filterMap:s}:null})}updateColumnFilters(){this.setState(e=>{var{model:t}=e;return t?{columnMap:t.getFilterColumnMap()}:null})}updateFilters(){var{columnMap:e,filterMap:t,model:n}=this.state;z(n);var i=this.getWaitingInputMap(n.isFilterRequired(),e,t);if(n.setFilter(t),t.size>0&&i.size===0){var a=n.getDefaultTitle(),s=Ot.join(Array.from(t.entries()).map(o=>{var[l,d]=o;return"".concat(l,": ").concat(d)}));a?n.setTitle("".concat(a,'<br><span style="font-size: smaller">').concat(s,"</span>")):n.setTitle(s),it.debug2("updateFilters filters set",t),this.setState({isLoading:!0})}else it.debug2("updateFilters waiting on inputs",i),n.setTitle(n.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{var{columnMap:t}=e,n=new Map(e.filterMap),i=new Map(e.filterValueMap),a={};return e.filterValueMap.forEach((s,o)=>{t.has(o)||(i.delete(o),a.filterValueMap=i)}),e.filterMap.forEach((s,o)=>{t.has(o)||(n.delete(o),a.filterMap=n)}),a})}render(){var{columnSelectionValidator:e,glContainer:t,glEventHub:n,inputFilters:i,isLinkerActive:a,links:s,metadata:o,settings:l,Plotly:d,containerRef:h}=this.props,{columnMap:v,filterMap:f,error:p,model:m,isActive:b,isDisconnected:g,isLoaded:C,isLoading:y}=this.state,S;Cr(o)?S=o.table:Ml(o)?S=o.figure:S=o.name;var E=this.getInputFilterColumnMap(v,i),w=this.getLinkedColumnMap(v,s),I=m!=null?this.getWaitingInputMap(m.isFilterRequired(),v,f):new Map,O=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),v,f,w,E):new Map,T=p!=null?"Unable to open chart. ".concat(p):void 0,N=I.size>0,R=v.size>0&&a;return u.jsx(Fi,{className:Y("iris-chart-panel",{"input-required":N}),componentPanel:this,glContainer:t,glEventHub:n,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:T,isDisconnected:g,isLoading:y,isLoaded:C,widgetName:S,widgetType:"Chart",children:u.jsxs("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[u.jsx("div",{className:"chart-container h-100 w-100",children:C&&m&&u.jsx(ul,{isActive:b,model:m,settings:l,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged,Plotly:d,containerRef:h})}),u.jsx(Hn,{in:N&&!R&&!y,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(kp,{inputFilterMap:E,linkedColumnMap:w,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:v,waitingFilterMap:O,waitingInputMap:I})}),u.jsx(Hn,{in:R,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(pi,{columns:this.getSelectorColumns(v,w,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Dt(ss,"defaultProps",{columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{},containerRef:null});Dt(ss,"displayName","ChartPanel");Dt(ss,"COMPONENT","ChartPanel");var XD=(r,e)=>{var{localDashboardId:t,metadata:n}=e,i;n!=null&&Cr(n)&&(i=n.sourcePanelId);var a=ns(r,t),s=yl(r,t),o=Cl(r),l=rs(r,t),d=o===Nt.LINKER&&l===void 0;return{columnSelectionValidator:is(r,t),isLinkerActive:d,inputFilters:ts(r,t),links:Zn(r,t),source:i!=null?a.get(i):void 0,sourcePanel:i!=null?s.get(i):void 0,settings:xi(r)}},ZD=Pt(XD,{setActiveTool:Jf,setDashboardIsolatedLinkerPanelId:Nl},null,{forwardRef:!0})(ss);const Ai=ZD;function Oa(r,e,t){return e=QD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function QD(r){var e=JD(r,"string");return typeof e=="symbol"?e:String(e)}function JD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Xi=B.module("CommandHistoryPanel");class Ri extends c.Component{static handleError(e){Xi.error(e)}constructor(e){super(e),Oa(this,"container",void 0),Oa(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=X.createRef(),this.pending=new Tn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:et.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(pt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(pt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:n,language:i}=this.state;if(Xi.debug("handleSendToNotebook",n,e),!n){Xi.error("Session is not connected.");return}var{glEventHub:a}=this.props;a.emit(t?he.CREATE_NOTEBOOK:he.SEND_TO_NOTEBOOK,n,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Xi.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(pt.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;z(t),z(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(Ri.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:a,table:s}=this.state;return u.jsxs(Wt,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!s&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),s&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(zO,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:n}),u.jsx(ae,{actions:a})]})]})}}Oa(Ri,"COMPONENT","CommandHistoryPanel");Oa(Ri,"TITLE","Command History");var eI=(r,e)=>{var t=Kf(r),n=Hr(r,e.localDashboardId),{session:i,config:a}=n??{},{type:s,id:o}=a??{};return{commandHistoryStorage:t,language:s,session:i,sessionId:o}},tI=Pt(eI,null,null,{forwardRef:!0})(Ri);const Hp=tI;function qu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Zi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qu(Object(t),!0).forEach(function(n){$n(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function $n(r,e,t){return e=nI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nI(r){var e=rI(r,"string");return typeof e=="symbol"?e:String(e)}function rI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qi=B.module("ConsolePanel"),iI=500,aI=Object.freeze({consoleSettings:{},itemIds:[]});class os extends c.PureComponent{constructor(e){super(e),$n(this,"consoleRef",void 0),$n(this,"objectSubscriptionCleanup",void 0),$n(this,"savePanelState",Le(()=>{var{consoleSettings:s,itemIds:o}=this.state,l={consoleSettings:s,itemIds:[...o]};Qi.debug("Saving panel state",l),this.setState({panelState:l})},iI)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=X.createRef();var{panelState:t}=e,n=Zi(Zi({},aI),t||{}),{consoleSettings:i,itemIds:a}=n;this.state={consoleSettings:i,itemIds:new Map(a),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:i}=this.state;(t.consoleSettings!==n||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(n=>{Qi.debug("Got updates",n),this.setState(i=>{var{objectMap:a}=i,{updated:s,created:o,removed:l}=n,d=[...s,...l],h=new Map(a);d.forEach(f=>{var{title:p}=f;p!==void 0&&h.delete(p)});var v=[...s,...o];return v.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,a=new Map(i);return a.set(e,t),{itemIds:a}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,i=n.get(e);return i==null&&t&&(i=ye.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,i,{itemIds:a}=this.state,s=e==null||(t=e.props)===null||t===void 0?void 0:t.id,o=e==null||(n=e.props)===null||n===void 0||(i=n.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(s&&o){var l=new Set(a.values());l.has(o)&&this.setItemId(s,s)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(pt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&A.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,n)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Qi.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(pt.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;z(n);var{config:i,session:a}=n,{title:s}=e;z(s);var o=this.getItemId(s),l={fetch:()=>a.getObject(e),panelId:o,widget:Zi(Zi({},Lv(e)),{},{sessionId:i.id})};Qi.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,n,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var a=[...n.values()],{glEventHub:s}=this.props;a.forEach(o=>{s.emit(te.CLOSE,o)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(n=>Xs(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Xs(i,e));return n!=null?sf(n):u.jsx(OT,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:a,unzip:s}=this.props;if(i==null)return u.jsx(He,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:o,error:l,objectMap:d}=this.state,{config:h,session:v,connection:f,details:p={},dh:m}=i,{workerName:b,processInfoId:g}=p,{id:C,type:y}=h;return u.jsx(Wt,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:v!=null&&u.jsx(IO,{dh:m,ref:this.consoleRef,settings:o,session:v,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:y,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:dp.LANGUAGE_MAP.get(y)}),b!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),b]}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g,u.jsx("div",{children:"•"})]}),u.jsx(eD,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:C,timeZone:a,objectMap:d,unzip:s,supportsType:this.supportsType,iconForType:this.iconForType})})}}$n(os,"COMPONENT","ConsolePanel");$n(os,"TITLE","Console");$n(os,"contextType",qa);var sI=(r,e)=>({commandHistoryStorage:Kf(r),sessionWrapper:Hr(r,e.localDashboardId),timeZone:bl(r),plugins:a_(r)}),oI=Pt(sI,null,null,{forwardRef:!0})(os);const oa=oI;function It(r,e,t){return e=lI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lI(r){var e=dI(r,"string");return typeof e=="symbol"?e:String(e)}function dI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ji=B.module("DropdownFilter"),uI=150;class tn extends c.Component{constructor(e){super(e),It(this,"dropdownRef",void 0),It(this,"getCompatibleColumns",se((a,s)=>a!=null?s.filter(o=>{var{type:l}=o;return l!==void 0&&Ne.isCompatibleType(l,a.columnType)}):[])),It(this,"getColumnOptions",se((a,s)=>{var o=-1,l=[];return l.push(u.jsx("option",{value:"-1",children:"Select a column"},"placeholder")),a.forEach((d,h)=>{l.push(u.jsx("option",{value:h,children:this.getItemLabel(a,h)},"".concat(d.name,"/").concat(d.type))),s!==null&&d.name===s.name&&d.type===s.type&&(o=h)}),[l,o]})),It(this,"getSelectedOptionIndex",se((a,s)=>a.indexOf(s))),It(this,"getValueOptions",se(a=>[u.jsx("option",{value:"-1",children:tn.PLACEHOLDER},"-1"),...a.map((s,o)=>u.jsx("option",{value:o,children:s??"(null)"},"".concat(o,"/").concat(s)))])),It(this,"getItemLabel",ot((a,s)=>{var{name:o,type:l}=a[s];if(s>0&&a[s-1].name===o||s<a.length-1&&a[s+1].name===o){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(o," (").concat(d,")")}return o})),It(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o??void 0})},uI)),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=X.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,id:ye(),selectedColumn:t,disableCancel:!n,isValueShown:n,value:i}}componentDidUpdate(e,t){var{source:n,values:i,isLoaded:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a&&(n!==e.source&&this.sourceUpdated(),i!==e.values&&o!==""&&!i.includes(o)&&this.resetValue(),l!==t.isValueShown&&l&&this.focusInput(),(s!==t.column||o!==t.value||l!==t.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var t=e;if(Ji.debug2("handleColumnChange",t),t!=null&&parseInt(t,10)<0){this.setState({selectedColumn:null});return}var{columns:n,source:i}=this.props,a=this.getCompatibleColumns(i,n);this.setState({selectedColumn:a[parseInt(t,10)]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),Ji.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){var t=e,n=parseInt(t,10),i="",{values:a}=this.props;n>=0&&n<a.length?i=a[n]:Ji.debug2("Selected default item"),Ji.debug2("handleValueChange",i),this.setState({value:i})}handleSettingsCancel(){this.setState(e=>{var{column:t}=e;return{selectedColumn:t,isValueShown:!0}})}handleSettingsSave(){this.setState(e=>{var{column:t,selectedColumn:n,value:i}=e;return{column:n,value:t===n?i:"",isValueShown:!0,disableCancel:!1}})}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState(e){var{name:t,type:n,value:i,isValueShown:a}=e,s=t!=null&&n!=null?{name:t,type:n}:null;this.setState(o=>{var{value:l,isValueShown:d}=o;return{column:s,value:i??l,isValueShown:a??d}})}render(){var e,{columns:t,disableLinking:n,isLinkerActive:i,isLoaded:a,source:s,onColumnSelected:o,onSourceMouseEnter:l,onSourceMouseLeave:d,values:h,settingsError:v}=this.props,{column:f,disableCancel:p,id:m,isValueShown:b,selectedColumn:g,value:C}=this.state,y=s===null,S=this.getCompatibleColumns(s,t),E=s!=null,w=(e=s==null?void 0:s.columnName)!==null&&e!==void 0?e:tn.SOURCE_BUTTON_PLACEHOLDER,I=f!=null?"".concat(f.name," Filter"):null,[O,T]=this.getColumnOptions(S,g),N=this.getValueOptions(h),R=this.getSelectedOptionIndex(h,C),W=!E||g==null,L=b&&!i,D="source-column-btn-".concat(m),M="filter-column-select-".concat(m);return u.jsxs($a,{className:"dropdown-filter fill-parent-absolute",isFlipped:L,children:[u.jsx("div",{className:"dropdown-filter-settings-card",children:u.jsxs("div",{className:"dropdown-filter-card-content",children:[u.jsxs("div",{className:"dropdown-filter-settings-grid",children:[u.jsx("label",{htmlFor:D,children:"Source Column"}),u.jsx(Bo,{id:D,isLinked:E,onClick:o,onMouseEnter:l,onMouseLeave:d,className:tn.SOURCE_BUTTON_CLASS_NAME,disabled:n,children:w}),u.jsx("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),u.jsx("label",{htmlFor:M,children:"Filter Column"}),u.jsx(Bn,{id:M,value:String(T),className:"custom-select",onChange:this.handleColumnChange,disabled:y,children:O}),u.jsx("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),v&&u.jsx("div",{className:"error-message text-center",children:v}),E&&u.jsxs("div",{className:"dropdown-filter-settings-buttons",children:[u.jsx(K,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:p||b||i,tooltip:i?"Cancel disabled while linker open":void 0,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:W||b||i,tooltip:i?"Save disabled while linker open":void 0,children:"Save"})]})]})}),u.jsx("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"dropdown-filter-column",children:u.jsx("div",{className:"dropdown-filter-column-title",children:I})}),u.jsxs("div",{className:"dropdown-filter-card-content",children:[u.jsx("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:u.jsx(Bn,{className:"custom-select",value:String(R),ref:this.dropdownRef,onChange:this.handleValueChange,onKeyDown:this.handleDropdownKeyPress,title:"Select Value",children:N})}),v&&u.jsx("div",{className:"error-message mt-3 text-center",children:v})]}),u.jsx("div",{className:"dropdown-filter-menu",children:u.jsx(K,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:u.jsx(ne,{icon:Fa,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}It(tn,"defaultProps",{column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}});It(tn,"PLACEHOLDER","Select a value...");It(tn,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector");It(tn,"SOURCE_BUTTON_PLACEHOLDER","Select a column");const Yu=tn;function Qe(r,e,t){return e=hI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hI(r){var e=cI(r,"string");return typeof e=="symbol"?e:String(e)}function cI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ce=B.module("DropdownFilterPanel"),vI=250,fI=(r,e)=>{var{localDashboardId:t}=e,n=A.getIdFromPanel({props:e}),i=ns(r,t),a=Zn(r,t),s=Cl(r),o=rs(r,t),l=s===Nt.LINKER&&(o===void 0||o===n),d=s===Nt.LINKER&&o!==void 0&&o!==n;return{columns:xl(r,t),columnSelectionValidator:is(r,t),dh:Gf(r),isLinkerActive:l,disableLinking:d,settings:xi(r),panelTableMap:i,dashboardLinks:a}},pI=Pt(fI,null,null,{forwardRef:!0});class Lt extends c.Component{constructor(e){super(e),Qe(this,"dateTimeFormatter",void 0),Qe(this,"dropdownFilterRef",void 0),Qe(this,"panelContainer",void 0),Qe(this,"pending",void 0),Qe(this,"cleanup",void 0),Qe(this,"columnFormats",void 0),Qe(this,"getCachedValues",ot((v,f,p)=>{var{type:m,name:b}=f;return m!==void 0&&Ne.isDateType(m)?v.map(g=>this.dateTimeFormatter.format(g)):v.map(g=>g!=null&&m!=null?p.getFormattedString(g,m,b):null)})),Qe(this,"getCachedPanelLinks",ot((v,f)=>{var p=A.getIdFromPanel(f);return Ce.debug("getCachedPanelLinks",v,p),v.filter(m=>{var b;return((b=m.end)===null||b===void 0?void 0:b.panelId)===p})})),Qe(this,"getCachedSource",ot(v=>{Ce.debug("getCachedSource",v);var f;if(v.length>0){var[p]=v;f=p.start,v.length>1&&Ce.error("Filter has more that one link",v)}return f})),Qe(this,"getCachedSourceTable",ot((v,f)=>{var p;if(Ce.debug("getCachedSourceTable",v,f),f==null)return null;var{panelId:m}=f;return(p=v.get(m))!==null&&p!==void 0?p:null})),Qe(this,"getCachedSourceColumn",ot((v,f)=>{var p;return Ce.debug("getCachedSourceColumn",v,f),v==null||f==null?null:(p=v.columns.find(m=>{var{name:b,type:g}=m;return b===f.columnName&&g===f.columnType}))!==null&&p!==void 0?p:null})),this.handleChange=Le(this.handleChange.bind(this),vI),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=X.createRef(),this.panelContainer=X.createRef(),this.pending=new Tn;var{dh:t,panelState:n,settings:i}=e;this.columnFormats=wn.getColumnFormats(i),this.dateTimeFormatter=new xo(t,{showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});var{value:a="",isValueShown:s=!1,name:o,type:l,timestamp:d}=n??{},h=o!=null&&l!=null?{name:o,type:l}:void 0;this.state={column:h,formatter:new _r(t,this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:a,timestamp:d,values:[],isValueShown:s,wasFlipped:!1,skipUpdate:!1,panelState:n,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();var{dashboardLinks:e,panelTableMap:t}=this.props,{column:n,value:i,timestamp:a}=this.state,s=this.getSourceTable(t,e);if(s!==null&&this.startListeningToSource(s),n!=null){var{name:o,type:l}=n;this.sendUpdate(o,l,i,a)}}componentDidUpdate(e,t){var{dashboardLinks:n,panelTableMap:i,settings:a}=this.props,{valuesTable:s}=this.state,o=this.getSource(n),l=this.getSourceTable(i,n),d=this.getSource(e.dashboardLinks),h=this.getSourceTable(e.panelTableMap,e.dashboardLinks);a!==e.settings&&a!==void 0&&this.updateFormatterSettings(a),s!==t.valuesTable&&t.valuesTable!=null&&(Ce.debug("Table in state modified, closing the old table."),t.valuesTable.close()),(l!==h||o!==d)&&this.updateValuesTable(),l!==h&&(h!==null&&this.stopListeningToSource(h),l!==null&&this.startListeningToSource(l))}componentWillUnmount(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);this.pending.cancel(),i!==null&&this.stopListeningToSource(i),this.cleanup&&this.cleanup(),n!=null&&n.close()}getCoordinateForColumn(){var e;if(this.panelContainer.current==null)return null;var t=this.panelContainer.current.querySelector(".".concat(Yu.SOURCE_BUTTON_CLASS_NAME)),n=(e=t==null?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null;if(n==null||n.width<=0||n.height<=0)return null;var i=n.left+n.width/2,a=n.bottom;return[i,a]}getSettingsErrorMessage(){var{sourceSize:e}=this.state;if(e>Lt.MAX_TABLE_SIZE)return"Table too large, must have fewer than ".concat(Lt.MAX_TABLE_SIZE," options.")}getPanelErrorMessage(){var{error:e}=this.state;return e!=null?"".concat(e):void 0}getSource(e){var t=this.getCachedPanelLinks(e,this);return this.getCachedSource(t)}getSourceTable(e,t){var n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(e,t){var n=this.getSource(t);return this.getCachedSourceColumn(e,n)}startListeningToSource(e){var{dh:t}=this.props;Ce.debug("startListeningToSource"),e.addEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){var{dh:t}=this.props;Ce.debug("stopListeningToSource"),e.removeEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,{name:a=void 0,type:s=void 0}=t??{},o=!0,l=Date.now();this.setState(d=>{var h,v,{panelState:f,timestamp:p,wasFlipped:m,skipUpdate:b}=d,g=f!=null&&n!==f.isValueShown&&a===f.name&&s===f.type&&i===f.value;return o=(h=!b&&n&&(!g||!m))!==null&&h!==void 0?h:!1,o||(l=p),{panelState:{isValueShown:n,name:a,type:s,value:i,timestamp:(v=l)!==null&&v!==void 0?v:void 0},timestamp:l,wasFlipped:g,skipUpdate:!1}},()=>{o&&this.sendUpdate(a??null,s,i,l)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange(e){var{detail:t}=e;this.setState({sourceSize:t})}handleColumnSelected(){Ce.debug("handleColumnSelected");var{glEventHub:e}=this.props;e.emit(Te.COLUMN_SELECTED,this,Lt.SOURCE_COLUMN)}handleClearAllFilters(){var e,t;(e=this.dropdownFilterRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.clearFilter()}setPanelState(e){var t,n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{dashboardLinks:a}=this.props;if(this.getSource(a)==null){Ce.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!i}),(t=this.dropdownFilterRef)===null||t===void 0||(n=t.current)===null||n===void 0||n.setFilterState(e)}sendUpdate(e,t,n,i){var a,{dashboardLinks:s,glEventHub:o}=this.props,l=(a=this.getSource(s))===null||a===void 0?void 0:a.panelId,d=l===null?[]:[l];Ce.debug("sendUpdate",{name:e,type:t,value:n,timestamp:i,excludePanelIds:d}),o.emit(Te.FILTERS_CHANGED,this,{name:e,type:t,value:n??"=null",timestamp:i,excludePanelIds:d})}updateValuesTable(){var{dashboardLinks:e,panelTableMap:t}=this.props,n=this.getSource(e),i=this.getSourceTable(t,e);if(Ce.debug("updateValuesTable",n,i),this.setState({values:[],valuesTable:void 0,error:null}),n==null){Ce.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),i!=null&&(this.setState({isLoaded:!1,sourceSize:i.size}),this.pending.add(i.copy(),a=>a.close()).then(a=>{this.updateViewportListener(a),this.setState({valuesTable:a})}).catch(a=>{Se.isCanceled(a)||(Ce.error(a),this.setState({isLoading:!1,error:a}))}))}applySourceSorts(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Ce.debug("applySourceSorts",i==null?void 0:i.sort),n==null||i==null){Ce.debug("Table not initialized");return}var a=[...i.sort];n.applySort(a),this.setViewport(n)}applySourceFilters(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Ce.debug("applySourceFilters",i==null?void 0:i.filter),n==null||i==null){Ce.debug("Table not initialized");return}var a=[...i.filter];n.applyFilter(a),this.setViewport(n)}updateViewportListener(e){var{dh:t}=this.props;if(Ce.debug("updateViewportListener",e==null?void 0:e.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=void 0;return}this.cleanup=e.addEventListener(t.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){var{dashboardLinks:t}=this.props,n=this.getValuesColumn(e,t);if(!n){Ce.error("values column is null");return}e.setViewport(0,Lt.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(e){var{dh:t}=this.props,n=wn.getColumnFormats(e);Mt(this.columnFormats,n)||(this.columnFormats=n,this.setState({formatter:new _r(t,n)}))}handleValuesTableUpdate(e){var{detail:t}=e,{rows:n}=t,{dashboardLinks:i}=this.props,{valuesTable:a}=this.state;if(!a){Ce.error("valuesTable is null");return}var s=this.getValuesColumn(a,i);if(!s){Ce.error("Values column not found");return}var o=n.map(l=>l.get(s));this.setState({values:o,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){var{columnSelectionValidator:e}=this.props;e&&e(this,Lt.SOURCE_COLUMN)}handleSourceMouseLeave(){var{columnSelectionValidator:e}=this.props;e&&e(this,void 0)}render(){var{columns:e,dashboardLinks:t,disableLinking:n,glContainer:i,glEventHub:a,isLinkerActive:s}=this.props,{column:o,formatter:l,isDisconnected:d,isValueShown:h,value:v,values:f,valuesColumn:p,isLoading:m,isLoaded:b}=this.state,g=this.getSource(t),C=this.getSettingsErrorMessage(),y=this.getPanelErrorMessage(),S=b&&p!=null?this.getCachedValues(f,p,l):[];return u.jsx(Fi,{errorMessage:y,isLoading:m,isLoaded:b,isDisconnected:d,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:u.jsx("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:u.jsx(Yu,{ref:this.dropdownFilterRef,column:o,columns:e,isValueShown:h,isLinkerActive:s,disableLinking:n,isLoaded:b,settingsError:C,source:g,value:v,values:S,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}}Qe(Lt,"displayName","DropdownFilterPanel");Qe(Lt,"COMPONENT","DropdownFilterPanel");Qe(Lt,"MAX_TABLE_SIZE",256);Qe(Lt,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));var mI=pI(Lt);const Pn=mI;function mt(r){return r.type==="directory"}function gI(r,e,t){return e=bI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bI(r){var e=CI(r,"string");return typeof e=="symbol"?e:String(e)}function CI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class SI extends Error{constructor(){super("No file exists at the path specified"),gI(this,"isFileNotFound",!0)}}const ls=SI;function Xu(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Zu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Xu(a,n,i,s,o,"next",l)}function o(l){Xu(a,n,i,s,o,"throw",l)}s(void 0)})}}var Zt;(function(r){r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN=""})(Zt||(Zt={}));class $t{static fileExists(e,t){return Zu(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof ls))throw n;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!$t.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var a=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(a,".").concat(n):a}static getUniqueCopyFileName(e,t){return Zu(function*(){for(var n=$t.getCopyFileName(t);yield $t.fileExists(e,n);)n=$t.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return Zt.GROOVY;case"py":return Zt.PYTHON;case"pyc":return Zt.PYTHON_COMPILED;case"scala":return Zt.SCALA;case"txt":return Zt.PLAIN_TEXT;default:return Zt.UNKNOWN}}static getParent(e){if(!$t.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!$t.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,a=$t.fileExtensionToString(t);return"".concat(i).concat(a)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new si("Name cannot be empty");if(t.includes(e))throw new si('"'.concat(e,'" is a reserved name'));if(n.test(e)){var a,s;throw new si('Invalid characters in name: "'.concat((a=(s=e.match(n))===null||s===void 0?void 0:s.reduce((o,l)=>o.includes(l)?o:[...o,l],[]).map(o=>i.has(o)?i.get(o):o).join('", "'))!==null&&a!==void 0?a:"",'"'))}}static reducePaths(e){var t=e.filter(n=>$t.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const ee=$t;var Ll=26;function po(r){return mt(r)?ee.makePath(r.filename):ee.getPath(r.filename)}function Qu(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=po(e);if(r.some(n=>{var{filename:i}=n;return ee.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>mt(n)&&t.startsWith(ee.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function yI(r){if(mt(r))return r.isExpanded?eb:tb;var e=ee.getMimeType(r.basename);switch(e){case Zt.PYTHON:return rb;default:return nb}}function mo(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:a,isSelected:s,item:o,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:v,onDragEnd:f,onDrop:p}=r,m=(e=n==null?void 0:n.some(O=>O.id===o.id))!==null&&e!==void 0?e:!1,b=po(o),g=i&&d?po(d):null,C=i&&a&&mt(o)&&g===b,y=i&&a&&g===b,S=i&&!a&&g===b,E=yI(o),w=ee.getDepth(o.filename),I=Array(w).fill(null).map((O,T)=>u.jsx("span",{className:"file-list-depth-line"},T));return u.jsxs("div",{className:Y("d-flex w-100 align-items-center","file-list-item",{"is-dragged":m,"is-exact-drop-target":C,"is-in-drop-target":y,"is-invalid-drop-target":S,"is-selected":s}),onDragStart:O=>h(l,O),onDragOver:O=>v(l,O),onDragEnd:O=>f(l,O),onDrop:O=>p(l,O),draggable:!0,role:"presentation","aria-label":o.basename,children:[I," ",u.jsx(ne,{icon:E,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[o.basename,u.jsx(wt,{children:o.basename})]})})]})}function Ju(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ea(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ju(Object(t),!0).forEach(function(n){EI(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ju(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function EI(r,e,t){return e=wI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wI(r){var e=PI(r,"string");return typeof e=="symbol"?e:String(e)}function PI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ye=B.module("FileList"),_I=500,eh="item-list-scroll-pane";function TI(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:a,onSelectionChange:s=()=>{},renderItem:o=mo,rowHeight:l=Ll,overscanCount:d=wr.DEFAULT_OVERSCAN}=r,[h,v]=c.useState(()=>({items:[],offset:0,itemCount:0})),[f,p]=c.useState({top:0,bottom:0}),[m,b]=c.useState(),[g,C]=c.useState(),[y,S]=c.useState(),[E,w]=c.useState([]),I=c.useRef(),O=c.useRef(null),T=c.useRef(null),N=c.useCallback($=>{if($.length===0||h==null)return[];for(var J=[],ie=0;ie<$.length;ie+=1)for(var ve=$[ie],Ee=ve[0];Ee<=ve[1];Ee+=1)Ee>=h.offset&&Ee<h.offset+h.items.length&&J.push(h.items[Ee-h.offset]);return J},[h]),R=c.useCallback($=>{var J=N([[$,$]]);if(J.length>0)return J[0]},[N]),W=c.useCallback(()=>{var $=ua.count(E);if($===0)return null;if($===1){var J=E[0][0],ie=R(J);if(ie!=null)return ie.filename}return"".concat($," items")},[R,E]),L=c.useCallback($=>{if(!(!g||!m)){Ye.debug("dropItems",g,"to",$);try{var{files:J,targetPath:ie}=Qu(g,m);if(i==null||i(J,ie),$!=null){var ve;w([[$,$]]),(ve=O.current)===null||ve===void 0||ve.focusItem($)}}catch(Ee){Ye.error("Unable to complete move",Ee)}}},[g,m,i]),D=c.useCallback(($,J)=>{var ie=h.items[$-h.offset];ie!==void 0&&(Ye.debug("handleItemClick",ie),a(ie,J),mt(ie)&&(t==null||t.setExpanded(ie.filename,!ie.isExpanded)))},[h,a,t]),M=c.useCallback(($,J)=>{var ie;Ye.debug2("handleItemDragStart",$,E);var ve=E;ua.isSelected(E,$)||(ve=[[$,$]],w(ve)),C(N(ve)),(ie=O.current)===null||ie===void 0||ie.resetMouseState();var Ee=document.createElement("div");Ee.innerHTML='<div class="dnd-placeholder-content">'.concat(W(),"</div>"),Ee.className="file-list-dnd-placeholder",document.body.appendChild(Ee),J.dataTransfer.setDragImage(Ee,0,0),J.dataTransfer.effectAllowed="move",S(Ee)},[W,N,E]),F=c.useCallback(($,J)=>{J.preventDefault(),Ye.debug2("handleItemDragOver",J),b(R($))},[R]),k=c.useCallback(($,J)=>{Ye.debug("handleItemDragEnd",$),y==null||y.remove(),C(void 0),b(void 0),S(void 0)},[y]),H=c.useCallback(($,J)=>{L($)},[L]),q=c.useCallback(()=>{Ye.debug2("handleItemDragExit"),b(void 0)},[]),re=c.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(eh)&&($.preventDefault(),Ye.debug2("handleListDragOver",$),b({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),V=c.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(eh)&&(Ye.debug("handleListDrop"),L())},[L]),x=c.useCallback(function($){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ye.debug2("handleSelectionChange",$),J===!0||$!==E){w($);var ie=N($);s(ie)}},[N,s,E]),P=c.useCallback($=>{if(Ye.debug2("handleFocusChange",$),$!=null){var[J]=N([[$,$]]);n(J)}else n();I.current=$},[N,n]),j=c.useCallback(($,J)=>{Ye.debug("handleViewportChange",$,J),($!==f.top||J!==f.bottom)&&p({top:$,bottom:J})},[f]),U=c.useMemo(()=>{if(!g||!m)return!1;try{return Qu(g,m),Ye.debug("handleValidateDropTarget true"),!0}catch{return Ye.debug("handleValidateDropTarget false"),!1}},[g,m]),{focusedPath:Q}=r;c.useEffect(()=>{Q!==void 0&&(Q==="/"?t.collapseAll():(t.setExpanded(Q,!1),t.setExpanded(Q,!0)))},[t,Q]),c.useEffect(function(){Ye.debug("updating table viewport",f),t==null||t.setViewport({top:Math.max(0,f.top-d),bottom:f.bottom+d})},[d,t,f]),c.useEffect(function(){var J=t.onUpdate(ie=>{v({items:ie.items.map(ve=>ea(ea({},ve),{},{itemName:ve.basename})),offset:ie.offset,itemCount:t.size})});return()=>{J()}},[t]),c.useEffect(function(){I.current!=null&&P(I.current),E.length>0&&x(E,!0)},[h,P,x,E]),c.useEffect(function(){if(m!=null&&mt(m)&&m.filename!=="/"){var J=setTimeout(()=>{m.isExpanded||t==null||t.setExpanded(m.filename,!0)},_I);return()=>clearTimeout(J)}},[m,t]);var me=c.useCallback($=>o(ea(ea({},$),{},{isDragInProgress:g!=null,dropTargetItem:m,draggedItems:g,isDropTargetValid:U,onDragStart:M,onDragEnd:k,onDragOver:F,onDragExit:q,onDrop:H})),[k,q,F,M,H,g,m,U,o]);return u.jsx("div",{ref:T,className:Y("file-list",{"is-dragging":g!=null}),onDragOver:re,onDrop:V,children:u.jsx(wr,{ref:O,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:P,onSelect:D,onSelectionChange:x,onViewportChange:j,selectedRanges:E,renderItem:me,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var OI={name:"File Explorer",DELETE:qe.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[fe.DELETE],macShortcut:[pe.CMD,fe.BACKSPACE]}),RENAME:qe.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]})};const th={FILE_EXPLORER:OI};var nh=B.module("FileListItemEditor"),DI=()=>Promise.resolve();function II(r){var{item:e,onCancel:t,onSubmit:n,validate:i=DI}=r,a=c.useRef(null),[s,o]=c.useState(e.basename),[l,d]=c.useState(),[h,v]=c.useState(Promise.resolve()),f=c.useCallback(()=>{var y;(y=a.current)===null||y===void 0||y.focus()},[a]),p=c.useCallback(y=>y.stopPropagation(),[]),m=c.useCallback(()=>{h.then(()=>{n(s)}).catch(y=>nh.info("Unable to validate name",y))},[n,s,h]);c.useEffect(function(){var S=Se.makeCancelable(i(s));return S.then(()=>d(void 0)).catch(E=>{Se.isCanceled(E)||d(E)}),v(S),()=>S.cancel()},[i,s]),c.useEffect(function(){f()},[f]);var b=c.useCallback(()=>{nh.debug2("handleBlur"),m()},[m]),g=c.useCallback(y=>{var{value:S}=y.target;o(S)},[]),C=c.useCallback(y=>{y.stopPropagation();var{key:S}=y;switch(S){case"Enter":{m();break}case"Escape":{t();break}}},[t,m]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:Y("form-control file-list-item-editor-input",{"is-invalid":l}),value:s,ref:a,onBlur:b,onKeyDown:C,onChange:g,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function rh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ms(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rh(Object(t),!0).forEach(function(n){xI(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xI(r,e,t){return e=NI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function NI(r){var e=MI(r,"string");return typeof e=="symbol"?e:String(e)}function MI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Vp(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:a,onCopy:s,onDelete:o,onMove:l,onRename:d,onSelect:h,onSelectionChange:v,table:f,rowHeight:p=Ll,validateRename:m=()=>Promise.resolve()}=r,[b,g]=c.useState(),[C,y]=c.useState([]),[S,E]=c.useState(),w=c.useCallback(H=>{y(H),v==null||v(H)},[v]),I=c.useCallback(H=>{E(H)},[]),O=c.useCallback(()=>{S&&(s==null||s(S))},[S,s]),T=c.useCallback(()=>{C.length>0&&(o==null||o(C))},[o,C]),N=c.useCallback(()=>{i==null||i()},[i]),R=c.useCallback(()=>{S&&(a==null||a(ee.getPath(S.filename)))},[S,a]),W=c.useCallback(()=>{S&&g(S)},[S]),L=c.useCallback(()=>{g(void 0)},[]),D=c.useCallback(H=>{b&&(d==null||d(b,H),g(void 0))},[d,b]),M=c.useMemo(()=>{if(b)return[];var H=[];return i&&H.push({title:"New File",description:"Create new file",action:N,group:ae.groups.medium}),a&&H.push({title:"New Folder",description:"Create new folder",action:R,group:ae.groups.medium}),s&&H.push({title:"Copy File",description:"Copy the selected file",action:O,group:ae.groups.low,disabled:S==null||mt(S)}),o&&C.length>0&&H.push({title:"Delete",description:"Delete",shortcut:th.FILE_EXPLORER.DELETE,action:T,group:ae.groups.low}),d&&H.push({title:"Rename",description:"Rename",shortcut:th.FILE_EXPLORER.RENAME,action:W,group:ae.groups.low,disabled:S==null}),H},[O,T,N,R,W,S,s,i,a,o,d,C,b]),F=c.useCallback(H=>(z(b),m(b,H)),[b,m]),k=c.useCallback(H=>{var{item:q}=H;return b&&b.filename===q.filename?u.jsx(mo,Ms(Ms({},H),{},{children:u.jsx(II,{item:q,validate:F,onSubmit:D,onCancel:L})})):u.jsx(mo,Ms({},H))},[L,D,b,F]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(TI,{onMove:l,onSelect:h,onSelectionChange:w,onFocusChange:I,renderItem:k,rowHeight:p,table:f,isMultiSelect:e,focusedPath:t}),n&&u.jsx(ae,{actions:M})]})}Vp.displayName="FileListContainer";function ih(r,e,t){return e=LI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function LI(r){var e=FI(r,"string");return typeof e=="symbol"?e:String(e)}function FI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class AI extends si{constructor(e){super("Name already exists"),ih(this,"isExistingFile",!0),ih(this,"info",void 0),this.info=e}}const la=AI;function ah(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function sh(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){ah(a,n,i,s,o,"next",l)}function o(l){ah(a,n,i,s,o,"throw",l)}s(void 0)})}}var jt=B.module("FileExplorer");function Fl(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:a=()=>{},onRename:s=()=>{},onCreateFile:o=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:v=Ll}=r,[f,p]=c.useState([]),[m,b]=c.useState();c.useEffect(function(){var D;function M(){return F.apply(this,arguments)}function F(){return F=sh(function*(){jt.debug("initTable"),D=Se.makeCancelable(e.getTable(),k=>k.close());try{b(yield D)}catch(k){Se.isCanceled(k)||jt.error("Unable to initialize table",k)}}),F.apply(this,arguments)}return M(),()=>{D.cancel()}},[e]);var g=c.useCallback(L=>{Se.isCanceled(L)||jt.error(L)},[]),C=c.useCallback(()=>{jt.debug("handleCreateFile"),o()},[o]),y=c.useCallback(()=>{jt.debug("handleCreateFolder"),l()},[l]),S=c.useCallback(L=>{jt.debug("handleCopyFile",L.filename),i(L)},[i]),E=c.useCallback(L=>{jt.debug("handleDelete, pending confirmation",L),p(L)},[]),w=c.useCallback(()=>{jt.debug("handleDeleteConfirm",f),f.forEach(L=>e.deleteFile(mt(L)?ee.makePath(L.filename):L.filename)),a(f),p([])},[f,a,e]),I=c.useCallback(()=>{jt.debug("handleDeleteCancel"),p([])},[]),O=c.useCallback((L,D)=>{var M=ee.reducePaths(L.map(F=>mt(F)?ee.makePath(F.filename):F.filename));M.forEach(F=>{var k=ee.isPath(F)?"".concat(D).concat(ee.getBaseName(F.substring(0,F.length-1)),"/"):"".concat(D).concat(ee.getBaseName(F));e.moveFile(F,k).then(()=>{s(F,k)}).catch(g)})},[g,s,e]),T=c.useCallback((L,D)=>{var M=L.filename,F=mt(L);F&&!M.endsWith("/")&&(M="".concat(M,"/"));var k="".concat(ee.getParent(M)).concat(D);F&&!k.endsWith("/")&&(k="".concat(k,"/")),jt.debug2("handleRename",M,k),e.moveFile(M,k).catch(g),s(M,k)},[g,s,e]),N=c.useCallback(function(){var L=sh(function*(D,M){if(M!==D.basename){ee.validateName(M);var F="".concat(ee.getPath(D.filename)).concat(M);try{var k=yield e.info(F);throw new la(k)}catch(H){if(!(H instanceof ls))throw H}}});return function(D,M){return L.apply(this,arguments)}}(),[e]),R=f.length>0,W=c.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return u.jsxs("div",{className:"file-explorer",children:[m&&u.jsx(Vp,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:S,onCreateFolder:y,onCreateFile:C,onMove:O,onDelete:E,onRename:T,onSelect:d,onSelectionChange:h,rowHeight:v,table:m,validateRename:N}),u.jsx(_n,{isOpen:R,headerText:W,bodyText:"You cannot undo this action.",onCancel:I,onConfirm:w,confirmButtonText:"Delete"})]})}Fl.displayName="FileExplorer";function oh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function RI(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){oh(a,n,i,s,o,"next",l)}function o(l){oh(a,n,i,s,o,"throw",l)}s(void 0)})}}function mn(r,e,t){return e=jI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jI(r){var e=kI(r,"string");return typeof e=="symbol"?e:String(e)}function kI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Mn=B.module("NewItemModal");class Un extends c.PureComponent{static getValidationMessage(e){return e instanceof la&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Se.isCanceled(e)||Mn.error(e)}constructor(e){super(e),mn(this,"inputRef",X.createRef()),mn(this,"cancelableValidatePromise",void 0),mn(this,"cancelableExistingItemPromise",void 0),mn(this,"pending",new Tn),mn(this,"pathMap",new Map),mn(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,n=ee.hasPath(t)?ee.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:ee.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ee.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:a,path:s}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(s!==t.path||a!==t.value)&&this.updateValidationStatus(s,a),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=ee.hasPath(e)?ee.getPath(e):"/";this.setState({path:t,value:ee.getBaseName(e),validationError:void 0,prevExtension:ee.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Se.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return RI(function*(){ee.validateName(t);var{defaultValue:a,storage:s}=i.props;if(n){var o="".concat(e).concat(t);if(o!==a)try{var l=yield s.info(o);throw new la(l)}catch(d){if(!(d instanceof ls))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Un.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(Mn.debug("handleSelect",e),e.type==="directory")this.setState({path:ee.makePath(e.filename)});else{var t=e.basename,n=ee.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof si))throw e;Mn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:n}=this.state;Mn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){Mn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=ee.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Mn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:n}=e,i=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:i,path:a}=t,{notifyOnExtensionChange:s,type:o}=this.props;Mn.debug("submitModal",n,i);var l=ee.getExtension(i);return s&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(a,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(a).concat(i))}).catch(d=>{if(d instanceof la&&o!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Se.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(Un.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((n,i)=>{for(var a="",s=0;s<i;s+=1)a+="".concat(t[s],"/");return a+="".concat(n,"/"),u.jsxs(X.Fragment,{children:[u.jsx(K,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(a),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ne,{icon:ib,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},a)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:a,type:s}=this.props,{isSubmitting:o,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:v,value:f,prevExtension:p,newExtension:m}=this.state,b=s==="directory",g=ee.fileExtensionToString(p),C=ee.fileExtensionToString(m),y=b?"Create":"Save",S=b?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Ci,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Na,{toggle:n,children:a}),u.jsx(Si,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:S}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Y("form-control",{"is-invalid":v}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),v&&u.jsx("div",{className:"invalid-feedback",children:Un.getValidationMessage(v)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(Fl,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(ja,{children:[u.jsx(K,{kind:"secondary",onClick:n,children:"Cancel"}),u.jsx(K,{kind:"primary",disabled:o,onClick:this.handleModalSubmit,children:y})]})]}),u.jsx(_n,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(_n,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(g,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(g,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}mn(Un,"propTypes",{isOpen:_.bool,title:_.string.isRequired,defaultValue:_.string,type:_.oneOf(["file","directory"]).isRequired,onSubmit:_.func,onCancel:_.func,placeholder:_.string,storage:_.shape({}).isRequired,notifyOnExtensionChange:_.bool});mn(Un,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});const Bp=Un;function $I(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(K,{kind:"ghost",icon:Sc,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(K,{kind:"ghost",icon:ab,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(Ev,{value:i,onChange:n,placeholder:"Search by name"})})]})}function lh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function UI(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){lh(a,n,i,s,o,"next",l)}function o(l){lh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Wp(r,e,t){return e=HI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function HI(r){var e=VI(r,"string");return typeof e=="symbol"?e:String(e)}function VI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ln=B.module("FileExplorerPanel"),BI=(r,e)=>{var t=qf(r),n=Hr(r,e.localDashboardId),{session:i,config:a}=n??{},s=a==null?void 0:a.type;return{fileStorage:t,language:s,session:i}},WI=Pt(BI,null,null,{forwardRef:!0});function GI(r){var e=r;return e!=null&&typeof e.button=="number"}class xr extends X.Component{static handleError(e){Ln.error(e)}static isFocusEvent(e){return GI(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:n}=this.state,i={language:n,value:""};Ln.debug("handleCreateFile",t,n,i),e.emit(he.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Ln.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){Ln.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(xr.handleError)}handleCopyFile(e){var t=this;return UI(function*(){var{fileStorage:n}=t.props;if(mt(e)){Ln.error("Invalid item in handleCopyItem",e);return}var i=yield ee.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(he.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=ee.makePath(e[0].filename):t=ee.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(Ln.debug("fileSelect",e),e.type!=="directory"){var n=xr.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:a}=this.props,{session:s,language:o}=this.state,l={value:null,language:o};a.emit(he.SELECT_NOTEBOOK,s,o,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;Ln.debug("handleRename",e,t),n.emit(he.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,language:n})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:n}=this.props,{isShown:i,showCreateFolder:a,focusedFilePath:s}=this.state;return u.jsxs(Wt,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx($I,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Fl,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(Bp,{isOpen:a,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}Wp(xr,"COMPONENT","FileExplorerPanel");Wp(xr,"TITLE","File Explorer");var zI=WI(xr);const Gp=zI;function dh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ta(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dh(Object(t),!0).forEach(function(n){ii(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ii(r,e,t){return e=KI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function KI(r){var e=qI(r,"string");return typeof e=="symbol"?e:String(e)}function qI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var we=B.module("FilterSetManager"),YI="Enter name...",uh="No Available Filter Sets";class Da extends c.Component{static animateScreenFlash(){var e,t=document.createElement("div");t.classList.add("screen-flash-overlay"),t.addEventListener("animationend",()=>{t.remove()}),(e=document.querySelector("body"))===null||e===void 0||e.appendChild(t)}constructor(e){super(e),ii(this,"renameInputRef",X.createRef()),ii(this,"dropdownRef",X.createRef()),ii(this,"editDropdownRef",X.createRef()),ii(this,"isRenamingExistingSet",se((t,n)=>n!==void 0&&t.some(i=>{var{id:a}=i;return a===n.id}))),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}componentDidMount(){var{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,t){var{isValueShown:n,filterSets:i}=this.props,{modifiedFilterSets:a}=this.state;if(e.isValueShown&&!n&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(t)&&this.focusRenameInput(),i!==e.filterSets)if(!n&&i.length>0&&e.filterSets.length===0&&a.length===0){var{onChange:s}=this.props;s({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){var{filterSets:e,selectedId:t}=this.props;we.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){var{isValueShown:e,filterSets:t,selectedId:n,onChange:i}=this.props;if(we.debug("updateSelectedId",t,n),!!e&&!t.some(s=>{var{id:o}=s;return o===n})){var a=t.length===0;i({isValueShown:!a,selectedId:a?void 0:t[0].id})}}handleEditDropdownChange(e){this.setState({editId:e})}handleFilterChange(e){var t=e,{isValueShown:n,onChange:i}=this.props;this.applyFilterSet(t),i({isValueShown:n,selectedId:t})}handleFilterApply(){var{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){var{onChange:e,selectedId:t,filterSets:n}=this.props;this.setState({modifiedFilterSets:[]}),n.length>0&&e({isValueShown:!0,selectedId:t})}handleSettingsSave(){var{onChange:e,onUpdateSets:t}=this.props,{modifiedFilterSets:n,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),we.debug("Update sets",n,i),t(n),n.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){var{getFilterState:e}=this.props;Da.animateScreenFlash();var t=ye(),n=e(),i={id:t,title:"",panels:n};we.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var t,{renameSet:n,modifiedFilterSets:i}=this.state,a=(t=e==null?void 0:e.trim())!==null&&t!==void 0?t:"";if(a.length===0)return we.debug("Name cannot be empty",a),"Name cannot be empty";if(n!==void 0&&i.some(s=>{var{title:o,id:l}=s;return o===a&&l!==n.id}))return we.debug("Set with this name already exists",a),"Set with this name already exists"}handleRenameConfirm(){var e,{nameInputValue:t,renameSet:n,modifiedFilterSets:i,restoreFullState:a}=this.state;if(n===void 0){we.error("Renamed set undefined.");return}var s=this.getNameError(t);if(we.debug("handleRenameConfirm",t,s),s!==void 0){this.setState({nameInputError:s});return}var o=(e=t==null?void 0:t.trim())!==null&&e!==void 0?e:"",l=ta(ta({},n),{},{title:o,restoreFullState:a}),d=i.findIndex(v=>{var{id:f}=v;return f===n.id}),h=[...i];d>=0?(h[d]=l,we.debug("Renamed existing set",h)):(h.push(l),we.debug("Added new set to modified sets",h)),this.setState({editId:l.id,modifiedFilterSets:h,renameSet:void 0})}handleSetDelete(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.findIndex(l=>{var{id:d}=l;return d===t});if(i<0)return we.error("Unable to find selected filterSet index",n,t),null;var a=n.filter(l=>{var{id:d}=l;return d!==t}),s=Math.max(0,Math.min(a.length-1,i-1)),o=a.length>0?a[s].id:void 0;return we.debug("Deleted selected set",t,n,a),we.debug("New selection",s,o),{modifiedFilterSets:a,editId:o}})}handleSetUpdate(){var{getFilterState:e}=this.props;Da.animateScreenFlash();var t=e();this.setState(n=>{var{modifiedFilterSets:i,editId:a}=n;if(a===void 0)return we.error("Filter for update not selected."),null;var s=[...i],o=s.findIndex(l=>{var{id:d}=l;return d===a});return o<0?(we.error("Selected set for update not found."),null):(s[o]=ta(ta({},s[o]),{},{panels:t}),we.debug("Update set",s,t),{modifiedFilterSets:s})})}handleSetEdit(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.find(o=>{var{id:l}=o;return l===t});if(i===void 0)return we.error("Could not find selected set",t,n),null;var{title:a,restoreFullState:s=!1}=i;return{nameInputValue:a,nameInputError:void 0,renameSet:i,restoreFullState:s}})}handleSettingsClick(e){e.stopPropagation();var{onChange:t,selectedId:n}=this.props;t({isValueShown:!1,selectedId:n})}handleBackgroundClick(e){we.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){var{value:t}=e.target,n=this.getNameError(t);this.setState({nameInputValue:t,nameInputError:n})}handleNameInputKeyPress(e){var{key:t}=e;t==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,{renameSet:t}=e;return t!==void 0}applyFilterSet(e){var{onApply:t,filterSets:n}=this.props;if(e===void 0){we.debug("No filter selected");return}var i=n.find(a=>{var{id:s}=a;return s===e});if(i===void 0){we.debug("Selected id not found in filterSets",e,n);return}we.debug("Apply filterSet",i),t(i)}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)===null||e===void 0||e.focus()}render(){var{nameInputValue:e,nameInputError:t,editId:n,renameSet:i,modifiedFilterSets:a,restoreFullState:s}=this.state,{isValueShown:o,filterSets:l,selectedId:d}=this.props,h=this.isNameInputScreen(),v=this.isRenamingExistingSet(a,i),f=a.length===0,p=!h&&f&&l.length===0,m=!h&&!p,b=u.jsxs("div",{className:"fa-layers mr-3",children:[u.jsx(ne,{icon:Rs,mask:Ql,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:ob,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),g=u.jsxs("div",{className:"fa-layers",children:[u.jsx(ne,{icon:Rs,mask:Ql,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:lb,transform:"shrink-1 down-5 right-7"})]});return u.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:u.jsxs($a,{className:"w-100 h-100",isFlipped:o,children:[u.jsx("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:u.jsxs("div",{className:"filter-set-manager-card-content",children:[p&&u.jsxs("div",{children:[u.jsx(K,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b,children:"Capture filter set"}),u.jsx("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),h&&u.jsxs("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{children:v?"Edit set":"Name captured set"}),u.jsxs("div",{className:"name-input-container",children:[u.jsx("input",{type:"text",className:"input-set-name form-control",placeholder:YI,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),u.jsx(K,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:yc}),u.jsx(K,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:sb})]}),t!==void 0&&u.jsx("div",{className:"error-message",children:t})]}),u.jsx("div",{className:"form-group",children:u.jsxs(Oc,{onChange:this.handleRestoreFullStateChange,value:"".concat(s),children:[u.jsx(ks,{value:"false",children:"Restore only filters"}),u.jsx(ks,{value:"true",children:"Restore full table state"})]})})]}),m&&u.jsxs("div",{className:"filter-set-manager-settings-grid-1",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{children:"Edit filter sets"}),u.jsxs("div",{className:"filter-select-container",children:[u.jsxs(Bn,{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:n??"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:f,children:[f&&u.jsx("option",{value:"-1",disabled:!0,children:uh}),a.map(C=>{var{id:y,title:S}=C;return u.jsx("option",{value:y,children:S},y)})]}),u.jsx(K,{kind:"ghost",onClick:this.handleSetUpdate,disabled:f,icon:g,tooltip:"Update"}),u.jsx(K,{kind:"ghost",onClick:this.handleSetEdit,disabled:f,icon:Ec,tooltip:"Edit"}),u.jsx(K,{kind:"ghost",onClick:this.handleSetDelete,disabled:f,icon:Wn,tooltip:"Delete"})]})]}),u.jsx("div",{children:u.jsx(K,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b,children:"Capture new filter set"})}),u.jsxs("div",{className:"py-3 text-right",children:[u.jsx(K,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"})," ",u.jsx(K,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),u.jsxs("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[u.jsx("div",{className:"filter-set-manager-column",children:u.jsx("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),u.jsx("div",{className:"filter-set-manager-card-content",children:u.jsx("div",{className:"filter-set-manager-value-input",children:u.jsxs("div",{className:"filter-select-container",children:[u.jsxs(Bn,{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d??"-1",className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[l.length===0&&u.jsx("option",{value:"-1",disabled:!0,children:uh}),l.map(C=>{var{id:y,title:S}=C;return u.jsx("option",{value:y,children:S},y)})]}),u.jsx(K,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:wc,tooltip:"Apply Filter Set"})]})})}),u.jsx("div",{className:"filter-set-manager-menu",children:u.jsx(K,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:u.jsx(ne,{icon:Fa,transform:"grow-4"})})})]},"back")]})})}}const zp=Da;function Al(r){var e,t,n,i,a,{model:s,widgetName:o,glContainer:l,description:d}=r,h=((e=s==null?void 0:s.rowCount)!==null&&e!==void 0?e:0)-((t=s==null?void 0:s.pendingRowCount)!==null&&t!==void 0?t:0)-((n=s==null?void 0:s.floatingBottomRowCount)!==null&&n!==void 0?n:0)-((i=s==null?void 0:s.floatingTopRowCount)!==null&&i!==void 0?i:0),v=s==null?void 0:s.displayString(h,"long"),f=(a=s==null?void 0:s.columnCount)!==null&&a!==void 0?a:0,p=s==null?void 0:s.displayString(f,"long");return u.jsxs(Li,{widgetType:"Table",widgetName:o,glContainer:l,description:d,children:[u.jsx("hr",{className:"tab-tooltip-divider"}),u.jsx("span",{children:"Number of Columns"}),u.jsx("span",{className:"tab-tooltip-statistic-value",children:p}),u.jsx("span",{children:"Number of Rows"}),u.jsx("span",{className:"tab-tooltip-statistic-value",children:v})]})}Al.propTypes={glContainer:Ya.Container.isRequired,widgetName:_.string.isRequired,description:_.string};Al.defaultProps={description:null};function Kp(r){if(r==null)return!1;var e=r;return typeof e.table=="string"}function qp(r){if(r==null)return!1;var e=r;return typeof e.name=="string"}function hh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function hn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hh(Object(t),!0).forEach(function(n){Ie(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ie(r,e,t){return e=XI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XI(r){var e=ZI(r,"string");return typeof e=="symbol"?e:String(e)}function ZI(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var kt=B.module("IrisGridPanel"),QI=500,JI={IrisGrid:Tr,IrisGridTableModel:Gc,ContextMenuRoot:Tc};function ch(r){if(r==null)throw new Error("No metadata provided");if(qp(r))return r.name;if(Kp(r))return r.table;throw new Error("Unable to determine table name from metadata: ".concat(JSON.stringify(r)))}class Nr extends c.PureComponent{constructor(e){super(e),Ie(this,"irisGrid",void 0),Ie(this,"pluginRef",void 0),Ie(this,"modelPromise",void 0),Ie(this,"irisGridState",void 0),Ie(this,"gridState",void 0),Ie(this,"pluginState",void 0),Ie(this,"irisGridUtils",void 0),Ie(this,"getGridInputFilters",se((n,i)=>Ze.getInputFiltersForColumns(n,i.filter(a=>{var{value:s,excludePanelIds:o}=a,l=A.getIdFromPanel(this);return s!=null&&(o==null||l!=null&&!o.includes(l))})))),Ie(this,"getAlwaysFetchColumns",se((n,i)=>{for(var a=A.getIdFromPanel(this),s=new Set(i),o=0;o<n.length;o+=1){var{start:l}=n[o];l!=null&&l.panelId===a&&s.add(l.columnName)}return[...s]})),Ie(this,"getPluginContent",se((n,i,a,s,o)=>{if(!i||!aa(i)||n==null||i.table==null)return null;var l={panel:this,onFilter:this.handlePluginFilter,onFetchColumns:this.handlePluginFetchColumns,user:a,workspace:s,components:JI};return u.jsx("div",{className:"iris-grid-plugin",children:u.jsx(n,hn({ref:this.pluginRef,filter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,model:i,table:i.table,onStateChange:this.handlePluginStateChange,pluginState:o},l))})})),Ie(this,"getDehydratedIrisGridPanelState",se((n,i,a,s)=>Ze.dehydrateIrisGridPanelState(n,{isSelectingPartition:i,partitions:a,advancedSettings:s}))),Ie(this,"getDehydratedIrisGridState",se((n,i,a,s,o,l,d,h,v,f,p,m,b,g,C,y,S,E,w,I,O,T)=>(z(this.irisGridUtils),this.irisGridUtils.dehydrateIrisGridState(n,{advancedFilters:a,aggregationSettings:S,customColumnFormatMap:s,isFilterBarShown:o,metrics:{userColumnWidths:C,userRowHeights:y},quickFilters:l,customColumns:d,reverseType:h,rollupConfig:v,showSearchBar:f,searchValue:p,selectDistinctColumns:m,selectedSearchColumns:b,sorts:i,invertSearchColumns:g,pendingDataMap:E,frozenColumns:w,conditionalFormats:I,columnHeaderGroups:O,partitionConfig:T})))),Ie(this,"getDehydratedGridState",se((n,i,a,s,o)=>Ze.dehydrateGridState(n,{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:a}))),Ie(this,"getCachedPanelState",se((n,i,a,s)=>({irisGridPanelState:n,irisGridState:i,gridState:a,pluginState:s}))),Ie(this,"savePanelState",Le(()=>{var{irisGridState:n,gridState:i,pluginState:a}=this;z(n);var{onPanelStateUpdate:s}=this.props,{model:o,panelState:l,isSelectingPartition:d,partitions:h,advancedSettings:v}=this.state,{advancedFilters:f,aggregationSettings:p,customColumnFormatMap:m,isFilterBarShown:b,quickFilters:g,customColumns:C,reverseType:y,rollupConfig:S,showSearchBar:E,searchValue:w,selectDistinctColumns:I,selectedSearchColumns:O,sorts:T,invertSearchColumns:N,metrics:R,pendingDataMap:W,frozenColumns:L,conditionalFormats:D,columnHeaderGroups:M,partitionConfig:F}=n;z(o),z(R);var{userColumnWidths:k,userRowHeights:H}=R;z(i);var{isStuckToBottom:q,isStuckToRight:re,movedColumns:V,movedRows:x}=i,P=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(o,d,h,v),this.getDehydratedIrisGridState(o,T,f,m,b,g,C,y,S,E,w,I,O,N,k,H,p,W,L,D,M,F),this.getDehydratedGridState(o,V,x,q,re),a);P!==l&&(kt.debug("Saving panel state",this,P),this.setState({panelState:P}),s==null||s(P))},QI)),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=X.createRef(),this.pluginRef=X.createRef();var{panelState:t}=e;this.pluginState=null,this.irisGridUtils=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Wc.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:Ne.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partitions:[],rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:t,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,t){var{model:n}=this.state,{makeModel:i}=this.props;n!==t.model&&(t.model!=null&&(this.stopModelListening(t.model),t.model.close()),n!=null&&this.startModelListening(n)),i!==e.makeModel&&this.initModel()}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);var{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){var{metadata:e}=this.props;return ch(e)}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});var{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=Se.makeCancelable(e(),t=>t.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){var t=e,{panelState:n,irisGridStateOverrides:i}=this.state,a=[];if(this.irisGridUtils=new Ze(t.dh),n!=null){var{irisGridState:s}=n,{aggregationSettings:o,customColumns:l,selectDistinctColumns:d=[],rollupConfig:h}=hn(hn({},s),i);l.length>0&&a.push(v=>{v.customColumns=l}),h!=null&&h.columns.length>0&&a.push(v=>{v.rollupConfig=Ze.getModelRollupConfig(v.originalColumns,h,o)}),d.length>0&&a.push(v=>{v.selectDistinctColumns=d})}this.setState({model:t,modelQueue:a}),this.initModelQueue(t,a)}initModelQueue(e,t){var n=e;if(t.length===0){this.modelInitialized(n);return}var i=t.shift();kt.debug("initModelQueue",i),i&&i(n),this.setState({modelQueue:t})}handleAdvancedSettingsChange(e,t){kt.debug("handleAdvancedSettingsChange",e,t),this.setState(n=>{var{advancedSettings:i}=n;return i.get(e)===t?null:{advancedSettings:new Map(i).set(e,t)}})}handlePluginFilter(e){var t,n,{model:i}=this.state;z(i);var{columns:a,formatter:s}=i,o=(t=(n=this.irisGridUtils)===null||n===void 0?void 0:n.getFiltersFromInputFilters(a,e,s.timeZone))!==null&&t!==void 0?t:[];this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var t,n,i;return(t=(n=this.pluginRef.current)===null||n===void 0||(i=n.getMenu)===null||i===void 0?void 0:i.call(n,e))!==null&&t!==void 0?t:[]}isColumnSelectionValid(e){var{columnSelectionValidator:t}=this.props;return t&&e?t(this,e):!1}handleGridStateChange(e,t){this.irisGridState=e,this.gridState=t,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();var{glEventHub:n,onStateChange:i}=this.props;n.emit(Et.STATE_CHANGED,this),i==null||i(e,t)}handlePluginStateChange(e){var{irisGridState:t,gridState:n}=this;this.pluginState=e,t!==null&&n!==null&&this.savePanelState()}handleColumnsChanged(e){var{isModelReady:t,model:n,modelQueue:i}=this.state;t?this.sendColumnsChange(e.detail):(z(n),this.initModelQueue(n,i))}handleTableChanged(e){kt.debug("handleTableChanged",e);var{glEventHub:t}=this.props,{detail:n}=e;t.emit(Te.TABLE_CHANGED,this,n)}handleCreateChart(e,t){this.savePanelState.flush(),this.setState(()=>null,()=>{var{glEventHub:n,inputFilters:i}=this.props,a=this.getTableName(),{panelState:s}=this.state,o=A.getIdFromPanel(this),l;s&&(l=Ze.extractTableSettings(s,i)),n.emit(Et.CREATE_CHART,{metadata:{settings:e,sourcePanelId:o,table:a,tableSettings:l},table:aa(t)?t.table:void 0})})}handleColumnSelected(e){var{glEventHub:t}=this.props;t.emit(Et.COLUMN_SELECTED,this,e)}handleDataSelected(e,t){var{glEventHub:n}=this.props;n.emit(Et.DATA_SELECTED,this,t)}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){kt.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){Se.isCanceled(e)||this.handleError(e)}modelInitialized(e){var{glEventHub:t,loadPlugin:n}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),aa(e)){var{table:i}=e,{pluginName:a}=i;if(a!==""&&n!=null&&a!=null){var s=n(a);this.setState({Plugin:s})}t.emit(Te.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){var e=this.irisGrid.current,{isDisconnected:t}=this.state;e!=null&&!t&&e.clearAllFilters()}sendColumnsChange(e){kt.debug2("sendColumnsChange",e);var{glEventHub:t}=this.props;t.emit(Te.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(Yt.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(Yt.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(Yt.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(Yt.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(Yt.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(Yt.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(Yt.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(Yt.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var t,n,i,{model:a}=this.state;if(!a)return null;var s=this.irisGrid.current,{gridWrapper:o}=s||{},l=(t=o==null?void 0:o.getBoundingClientRect())!==null&&t!==void 0?t:null;if(l==null||l.width<=0||l.height<=0)return null;z(s);var{metrics:d}=s.state;z(d);var{columnHeaderHeight:h,allColumnXs:v,allColumnWidths:f,right:p,columnHeaderMaxDepth:m}=d,b=a.getColumnIndexByName(e);z(b);var g=s.getVisibleColumn(b),C=(n=v.get(g))!==null&&n!==void 0?n:0,y=(i=f.get(g))!==null&&i!==void 0?i:0,S=Math.max(l.left,Math.min(g>p?l.right:l.left+C+y*.5,l.right)),E=l.top+h*m;return[S,E]}setFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setFilterMap(e)}setAdvancedFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setAdvancedFilterMap(e)}setFilters(e){var{quickFilters:t,advancedFilters:n}=e;kt.debug("setFilters",t,n);var{model:i,isDisconnected:a}=this.state,s=this.irisGrid.current;if(s==null||a){kt.debug("Ignore setFilters, model disconnected");return}z(i);var{columns:o,formatter:l}=i,d=Ze.changeFilterColumnNamesToIndexes(i.columns,t).filter(v=>{var[f]=v;return i.isFilterable(f)}),h=Ze.changeFilterColumnNamesToIndexes(i.columns,n).filter(v=>{var[f]=v;return i.isFilterable(f)});z(this.irisGridUtils),s.clearAllFilters(),s.setFilters({quickFilters:this.irisGridUtils.hydrateQuickFilters(o,d,l.timeZone),advancedFilters:this.irisGridUtils.hydrateAdvancedFilters(o,h,l.timeZone)})}setStateOverrides(e){kt.debug("setStateOverrides",e);var{irisGridState:t,gridState:n}=e;this.setState({irisGridStateOverrides:t,gridStateOverrides:n},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){var{panelState:t,irisGridStateOverrides:n,gridStateOverrides:i}=this.state;if(t!=null)try{var{gridState:a,irisGridState:s,irisGridPanelState:o}=t,l=hn({},n),{quickFilters:d,advancedFilters:h}=l;d&&(l.quickFilters=Ze.changeFilterColumnNamesToIndexes(e.columns,d)),h&&(l.advancedFilters=Ze.changeFilterColumnNamesToIndexes(e.columns,h));var{isSelectingPartition:v,partitions:f,advancedSettings:p}=Ze.hydrateIrisGridPanelState(e,o);z(this.irisGridUtils);var{advancedFilters:m,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,quickFilters:y,reverseType:S,rollupConfig:E,aggregationSettings:w,sorts:I,userColumnWidths:O,userRowHeights:T,showSearchBar:N,searchValue:R,selectDistinctColumns:W,selectedSearchColumns:L,invertSearchColumns:D,pendingDataMap:M,frozenColumns:F,conditionalFormats:k,columnHeaderGroups:H,partitionConfig:q}=this.irisGridUtils.hydrateIrisGridState(e,hn(hn({},s),l)),{isStuckToBottom:re,isStuckToRight:V,movedColumns:x,movedRows:P}=Ze.hydrateGridState(e,hn(hn({},a),i),s.customColumns);this.setState({advancedFilters:m,advancedSettings:p,conditionalFormats:k,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,isSelectingPartition:v,movedColumns:x,movedRows:P,partitions:f,quickFilters:y,reverseType:S,rollupConfig:E,aggregationSettings:w,sorts:I,userColumnWidths:O,userRowHeights:T,showSearchBar:N,searchValue:R,selectDistinctColumns:W,selectedSearchColumns:L,invertSearchColumns:D,pendingDataMap:M,frozenColumns:F,isStuckToBottom:re,isStuckToRight:V,columnHeaderGroups:H,partitionConfig:q})}catch(j){kt.error("loadPanelState failed to load panelState",t,j)}}updateGrid(){var e,t,n=(e=(t=this.irisGrid.current)===null||t===void 0?void 0:t.grid)!==null&&e!==void 0?e:null;n&&n.handleResize()}render(){var e,t,{children:n,glContainer:i,glEventHub:a,columnSelectionValidator:s,getDownloadWorker:o,inputFilters:l,links:d,metadata:h,panelState:v,user:f,workspace:p,settings:m,theme:b}=this.props,{advancedFilters:g,aggregationSettings:C,advancedSettings:y,conditionalFormats:S,customColumns:E,customColumnFormatMap:w,error:I,isDisconnected:O,isFilterBarShown:T,isSelectingPartition:N,isStuckToBottom:R,isStuckToRight:W,isLoaded:L,isLoading:D,isModelReady:M,model:F,movedColumns:k,movedRows:H,partitions:q,partitionConfig:re,quickFilters:V,reverseType:x,rollupConfig:P,sorts:j,userColumnWidths:U,userRowHeights:Q,showSearchBar:me,searchValue:$,selectDistinctColumns:J,selectedSearchColumns:ie,invertSearchColumns:ve,Plugin:Ee,pluginFilters:Vr,pluginFetchColumns:Qn,pendingDataMap:Br,frozenColumns:xn,columnHeaderGroups:Fm}=this.state,Am=I!=null?"Unable to open table. ".concat(I):void 0,Wl=ch(h),Gl=(e=F==null?void 0:F.description)!==null&&e!==void 0?e:void 0,Rm=(t=v==null?void 0:v.pluginState)!==null&&t!==void 0?t:null,jm=n??this.getPluginContent(Ee,F,f,p,Rm),{permissions:km}=f,{canCopy:$m,canDownloadCsv:Um}=km;return u.jsx(Fi,{errorMessage:Am,isDisconnected:O,isLoading:D,isLoaded:L,className:"iris-grid-panel",glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Wl,widgetType:"Table",description:Gl,componentPanel:this,renderTabTooltip:()=>u.jsx(Al,{model:F,widgetName:Wl,glContainer:i,description:Gl}),children:M&&F&&u.jsx(Tr,{advancedFilters:g,aggregationSettings:C,advancedSettings:y,alwaysFetchColumns:this.getAlwaysFetchColumns(d,Qn),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",customColumns:E,customColumnFormatMap:w,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:S,inputFilters:this.getGridInputFilters(F.columns,l),applyInputFiltersOnInit:v==null,isFilterBarShown:T,isSelectingColumn:s!=null,isSelectingPartition:N,isStuckToBottom:R,isStuckToRight:W,movedColumns:k,movedRows:H,partitions:q,partitionConfig:re,quickFilters:V,reverseType:x,rollupConfig:P,settings:m,sorts:j,userColumnWidths:U,userRowHeights:Q,model:F,showSearchBar:me,searchValue:$,selectedSearchColumns:ie,selectDistinctColumns:J,invertSearchColumns:ve,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:Vr,pendingDataMap:Br,canCopy:$m,canDownloadCsv:Um,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:xn,theme:b,columnHeaderGroups:Fm,children:jm})})}}Ie(Nr,"defaultProps",{onStateChange:()=>{},onPanelStateUpdate:()=>{}});Ie(Nr,"displayName","IrisGridPanel");Ie(Nr,"COMPONENT","IrisGridPanel");var ex=(r,e)=>{var{localDashboardId:t=_l}=e;return{inputFilters:ts(r,t),links:Zn(r,t),columnSelectionValidator:is(r,t),user:n_(r),workspace:Yf(r),settings:xi(r)}},tx=Pt(ex,null,null,{forwardRef:!0})(Nr);const Mr=tx;function di(r,e,t){return e=nx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nx(r){var e=rx(r,"string");return typeof e=="symbol"?e:String(e)}function rx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var vh=B.module("InputFilter"),ix=150;class Lr extends c.Component{constructor(e){super(e),di(this,"inputRef",void 0),di(this,"getItemLabel",ot((a,s)=>{var{name:o,type:l}=a[s];if(s>0&&a[s-1].name===o||s<a.length-1&&a[s+1].name===o){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(o," (").concat(d,")")}return o})),di(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o})},ix)),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=X.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,selectedColumn:t,value:i,isValueShown:n}}componentDidUpdate(e,t){var{column:n}=this.props,{column:i,value:a,isValueShown:s}=this.state;n!==e.column&&this.setState({column:n,selectedColumn:n}),s!==void 0&&s&&s!==t.isValueShown&&this.focusInput(),(i!==t.column||a!==t.value||s!==t.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var{columns:t}=this.props,n=t[parseInt(e,10)];vh.debug2("handleColumnChange",n),this.setState({selectedColumn:n,value:void 0})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(t=>{var{value:n}=t;return n==null?{value:""}:null},()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){var{value:t}=e.target;vh.debug2("handleValueChange",t),this.setState({value:t})}handleSettingsCancel(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){var{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){var{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1}),e.stopPropagation()}handleBackgroundClick(e){e.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState(e){var{name:t,type:n,value:i,isValueShown:a}=e,s=t!=null&&n!=null?{name:t,type:n}:void 0,o=a===void 0?{column:s,value:i}:{column:s,value:i,isValueShown:a};this.setState(o)}render(){var{columns:e}=this.props,{column:t,isValueShown:n,selectedColumn:i,value:a}=this.state,s=a==null||a.length===0?Lr.PLACEHOLDER.length:a.length,o=null;if(t!=null){var l=e.findIndex(d=>d.name===t.name&&d.type===t.type);o=l>=0?this.getItemLabel(e,l):t.name}return u.jsxs($a,{className:"input-filter fill-parent-absolute",isFlipped:n??!1,children:[u.jsx("div",{className:"input-filter-settings-card",children:u.jsxs("div",{className:"input-filter-settings-content",children:[u.jsxs("div",{className:"input-filter-settings-grid",children:[u.jsx("label",{children:"Filter Column"}),u.jsxs(Bn,{value:String(e.findIndex(d=>d.name===(i==null?void 0:i.name)&&d.type===(i==null?void 0:i.type))),className:"custom-select",onChange:this.handleColumnChange,children:[e.map((d,h)=>u.jsx("option",{value:h,children:this.getItemLabel(e,h)},"".concat(d.name,"/").concat(d.type))),e.length===0&&u.jsx("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),u.jsx("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),u.jsxs("div",{className:"input-filter-settings-buttons",children:[u.jsx(K,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:t==null,children:"Cancel"}),u.jsx(K,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:i==null,children:"Save"})]})]})}),u.jsxs("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[u.jsx("div",{className:"input-filter-column",children:u.jsxs("div",{className:"input-filter-column-title",children:[o," Filter"]})}),u.jsx("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:u.jsx("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:u.jsx("input",{type:"text",ref:this.inputRef,placeholder:Lr.PLACEHOLDER,value:a??"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:"".concat(s+3,"ch")},spellCheck:"false"})})}),u.jsx("div",{className:"input-filter-menu",children:u.jsx(K,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:u.jsx(ne,{icon:Fa,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}di(Lr,"PLACEHOLDER","Enter value...");di(Lr,"defaultProps",{column:null,isValueShown:!1,value:null});const ax=Lr;function ds(r,e,t){return e=sx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sx(r){var e=ox(r,"string");return typeof e=="symbol"?e:String(e)}function ox(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var lx=250;class us extends c.Component{constructor(e){super(e),ds(this,"inputFilterRef",void 0),this.handleChange=Le(this.handleChange.bind(this),lx),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=X.createRef();var{panelState:t}=e,{value:n,isValueShown:i=!1,name:a,type:s,timestamp:o}=t??{};this.state={columns:[],column:a!=null&&s!=null?{name:a,type:s}:void 0,value:n,timestamp:o,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:t}}componentDidMount(){this.updateColumns();var{column:e,value:t,timestamp:n}=this.state;if(e!=null){var{name:i,type:a}=e;this.sendUpdate(i,a,t,n)}}componentDidUpdate(e){var{columns:t}=this.props;t!==e.columns&&this.updateColumns()}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,a,s;t!=null&&({name:a,type:s}=t);var o=!0,l=Date.now();this.setState(d=>{var h,{panelState:v,timestamp:f,wasFlipped:p,skipUpdate:m}=d,b=v!=null&&n!==v.isValueShown&&a===v.name&&s===v.type&&i===v.value;return o=(h=!m&&n&&(!b||!p))!==null&&h!==void 0?h:!1,o||(l=f),{panelState:{isValueShown:n,name:a,type:s,value:i,timestamp:l},timestamp:l,wasFlipped:b,skipUpdate:!1}},()=>{o&&this.sendUpdate(a,s,i,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)===null||e===void 0||e.clearFilter()}sendUpdate(e,t,n,i){var{glEventHub:a}=this.props;a.emit(Te.FILTERS_CHANGED,this,{name:e,type:t,value:n,timestamp:i})}setPanelState(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState({skipUpdate:!n}),(t=this.inputFilterRef.current)===null||t===void 0||t.setFilterState(e)}updateColumns(){var{columns:e}=this.props;e!=null&&this.setState(t=>{var{column:n}=t;return n==null&&e.length>0?{columns:[...e],column:e[0]}:n!=null&&!e.find(i=>{var{name:a,type:s}=i;return n.name===a&&n.type===s})?{columns:[...e,n]}:{columns:[...e]}})}render(){var{glContainer:e,glEventHub:t}=this.props,{column:n,columns:i,isValueShown:a,value:s}=this.state;return u.jsx(Wt,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:u.jsx(ax,{ref:this.inputFilterRef,column:n,columns:i,onChange:this.handleChange,isValueShown:a,value:s})})}}ds(us,"defaultProps",{panelState:null});ds(us,"COMPONENT","InputFilterPanel");ds(us,"displayName","InputFilterPanel");var dx=(r,e)=>{var{localDashboardId:t}=e;return{columns:xl(r,t)}},ux=Pt(dx,null,null,{forwardRef:!0})(us);const Sr=ux;function fh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function na(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fh(Object(t),!0).forEach(function(n){Rl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Rl(r,e,t){return e=hx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hx(r){var e=cx(r,"string");return typeof e=="symbol"?e:String(e)}function cx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var We=B.module("FilterSetManagerPanel");function vx(r){return r.setPanelState!=null}class Fr extends c.Component{static changeFilterIndexesToColumnNames(e,t){return t.map(n=>{var[i,a]=n;if(i>=e.columns.length)return null;var{name:s}=e.columns[i];return{name:s,filter:a}}).filter(n=>n!=null)}constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);var{panelState:t,filterSets:n}=e,{selectedId:i=n.length>0?n[0].id:void 0,isValueShown:a=!1}=t??{};this.state={selectedId:i,isValueShown:a,panelState:t}}getFilterState(){var{dashboardOpenedPanelMap:e}=this.props,t=[];return[...e.keys()].forEach(n=>{var i=e.get(n);if(i===void 0){We.error("Could not get panel",i);return}var a=A.getComponentNameFromPanel(i),s=A.getIdFromPanel(i);We.debug("Panel:",i,a);var{glContainer:o=null}=i.props;if(o==null){We.error("Could not get panel container",i);return}var l=A.getComponentConfigFromContainer(o);if(l==null){We.error("Could not get component config from container",o);return}var d=A.getPanelComponentState(l);if(d==null){We.debug("Panel state is null ".concat(s));return}switch(a){case A.getComponentName(Nr):{var h;s!=null&&(h=this.getIrisGridPanelFilters(s,d)),h!=null&&t.push({panelId:s,type:a,state:h});break}case A.getComponentName(Sr):case A.getComponentName(Pn):{var{isValueShown:v,name:f,type:p,value:m}=d;t.push({panelId:s,type:a,state:{isValueShown:v,name:f,type:p,value:m}});break}}}),t}getIrisGridPanelFilters(e,t){var{panelTableMap:n}=this.props,i=n.get(e);if(i==null)return We.error("Unable to get table for panel ".concat(e,".")),null;var{irisGridState:a={advancedFilters:void 0,quickFilters:void 0},gridState:s={}}=t,{advancedFilters:o,quickFilters:l}=a,d;o&&(d=Fr.changeFilterIndexesToColumnNames(i,o));var h;return l&&(h=Fr.changeFilterIndexesToColumnNames(i,l)),{irisGridState:na(na({},a),{},{advancedFilters:d,quickFilters:h}),gridState:na({},s)}}handleGetFilterState(){return this.getFilterState()}handleChange(e){var{isValueShown:t,selectedId:n}=e;We.debug("handleChange",t,n),this.setState({isValueShown:t,selectedId:n}),this.updatePanelState()}handleFilterApply(e){var{dashboardOpenedPanelMap:t}=this.props,{panels:n,restoreFullState:i=!1}=e;We.debug("Apply filters from filter set",e),n.forEach(a=>{var{panelId:s,type:o,state:l}=a;if(s==null){We.debug("panel is null",s);return}if(!t.has(s)){We.debug("Ignore closed panel",s);return}We.debug("Apply panel filters",s,o,l);var d=t.get(s);switch(o){case A.getComponentName(Nr):this.restoreIrisGridFilters(d,l,i);break;case A.getComponentName(Sr):case A.getComponentName(Pn):this.restoreInputFilterState(d,l);break}})}handleSetsUpdate(e){var{setDashboardFilterSets:t,localDashboardId:n}=this.props;We.debug("Saving updated sets",e),t(n,[...e])}updatePanelState(){this.setState(e=>{var{selectedId:t,isValueShown:n}=e;return{panelState:{selectedId:t,isValueShown:n}}})}restoreIrisGridFilters(e,t,n){var{irisGridState:i={},advancedFilters:a=[],quickFilters:s=[]}=t,{advancedFilters:o=a,quickFilters:l=s}=i,{panelTableMap:d}=this.props,h=A.getIdFromPanel(e);if(h==null){We.error("Panel Id is null.");return}var v=d.get(h);if(v==null){We.error("Unable to get table for panel ".concat(h,"."));return}We.debug("restoreIrisGridFilters",h,t,n),n?e.setStateOverrides(t):e.setFilters({quickFilters:l,advancedFilters:o})}restoreInputFilterState(e,t){var n=na({},t);delete n.isValueShown,We.debug("restoreInputFilterState",e,n),e&&vx(e)&&e.setPanelState(n)}render(){var{glContainer:e,glEventHub:t,filterSets:n}=this.props,{isValueShown:i,selectedId:a}=this.state;return u.jsx(Wt,{className:"filter-set-manager-panel",componentPanel:this,glContainer:e,glEventHub:t,isClonable:!0,isRenamable:!0,children:u.jsx("div",{className:"input-filter-container h-100 w-100 container",children:u.jsx(zp,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:i,filterSets:n,selectedId:a,getFilterState:this.handleGetFilterState})})})}}Rl(Fr,"defaultProps",{panelState:null});Rl(Fr,"COMPONENT","FilterSetManagerPanel");var fx=(r,e)=>{var{localDashboardId:t}=e;return{filterSets:Mp(r,t),dashboardOpenedPanelMap:yl(r,t),dashboardInputFilters:ts(r,t),panelTableMap:ns(r,t)}},px=Pt(fx,{setDashboardFilterSets:jp},null,{forwardRef:!0})(Fr);const da=px;function mi(r,e,t){return e=mx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mx(r){var e=gx(r,"string");return typeof e=="symbol"?e:String(e)}function gx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ph=B.module("LogPanel");class hs extends c.PureComponent{constructor(e){super(e),mi(this,"isBottomVisible",void 0),mi(this,"logView",void 0),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;var{session:t}=this.props;this.state={session:t}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){ph.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ph.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return u.jsxs(Wt,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&u.jsx(ZO,{session:n,ref:i=>{this.logView=i}})]})}}mi(hs,"defaultProps",{session:null});mi(hs,"COMPONENT","LogPanel");mi(hs,"TITLE","Log");var bx=(r,e)=>{var t;return{session:(t=Hr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},Cx=Pt(bx,null,null,{forwardRef:!0})(hs);const Yp=Cx;function Sx(r,e,t){return e=yx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yx(r){var e=Ex(r,"string");return typeof e=="symbol"?e:String(e)}function Ex(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Xp extends c.PureComponent{render(){var{isEditing:e,children:t,onDoubleClick:n}=this.props;return u.jsxs("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:n,children:[u.jsx("div",{className:Y("text-muted","edit-hint",{viewing:e===void 0||!e}),children:u.jsxs("span",{children:["double-click to edit ",u.jsx(ne,{icon:Ec})]})}),t]})}}Sx(Xp,"defaultProps",{isEditing:!1});function wx(r,e,t){return e=Px(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Px(r){var e=_x(r,"string");return typeof e=="symbol"?e:String(e)}function _x(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Tx=B.module("MarkdownStartPage");class Zp extends c.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(Tx.debug("delete markdown: ",e),e!==void 0){var{onDelete:t}=this.props;t(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){var{closedMarkdowns:e,onOpen:t,onCreate:n}=this.props,{isDeleteModalShown:i,toBeDeleted:a}=this.state;return u.jsx("div",{className:"markdown-panel-start-page h-100 w-100",children:u.jsxs("div",{className:"markdown-panel-start-page-container",children:[u.jsxs("div",{className:"markdown-panel-start-list",children:[u.jsx("h3",{className:"list-title",children:"Start"}),u.jsx("div",{className:"list-item",children:u.jsx(K,{kind:"ghost",className:"title",onClick:n,children:"New Markdown Note"})})]}),u.jsxs("div",{className:"markdown-panel-start-list",children:[u.jsx("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(s=>u.jsxs("div",{className:"list-item",children:[u.jsx(K,{kind:"ghost",className:"title",onClick:()=>t(s),children:s.title}),u.jsx("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(s)},children:u.jsx(ne,{icon:Wn})})]},s.id)),u.jsxs(Ci,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal",children:[u.jsx(Na,{children:"Are you sure you want to permanently delete this note?"}),u.jsx(Si,{children:"You can't undo this action."}),u.jsxs(ja,{children:[u.jsx(K,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),u.jsx(K,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(a)},children:"Delete"})]})]})]})]})})}}wx(Zp,"defaultProps",{closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}});const Ox=Zp;function ui(r,e,t){return e=Dx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dx(r){var e=Ix(r,"string");return typeof e=="symbol"?e:String(e)}function Ix(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xx=c.lazy(()=>Yc(()=>import("./MarkdownEditor-113d0833.js"),["./MarkdownEditor-113d0833.js","./vendor-c87e2acb.js","./helpers-de833af9.js","./vendor-e1f37c45.css","./useUser-206f2c8e.js","./index-4e0b0d8e.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-fdfd3d2c.css","./useUser-5b7483c1.css","./plotly-37fd1df1.js"],import.meta.url)),ra=B.module("MarkdownPanel");class jl extends c.Component{constructor(e){super(e),ui(this,"markdownEditor",void 0),ui(this,"editor",void 0),ui(this,"getClosedMarkdowns",se(i=>i.filter(a=>a.component==="MarkdownPanel").reverse())),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);var{panelState:t}=e,n=null;t!=null&&t.content!=null&&({content:n}=t),this.state={isStartPageShown:n==null,isEditing:!1,content:n,panelState:t},this.markdownEditor=null}setEditorPosition(e){z(this.markdownEditor);var{container:t}=this.markdownEditor;if(this.editor&&t!=null){var n,i,a=t.getBoundingClientRect().top,s=t.scrollTop,o=t.scrollHeight,l=(n=(i=this.editor.getModel())===null||i===void 0?void 0:i.getLineCount())!==null&&n!==void 0?n:0,d=Math.round((s+e-a)/o*l);d>l&&(d=l),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){var{isEditing:t}=this.state,n=e.clientY;t||this.setState({isEditing:!0},()=>{this.setEditorPosition(n)})}handleEditorInitialized(e){ra.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){ra.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){ra.debug("open markdown...",e);var{glContainer:t,glEventHub:n}=this.props,i=A.getComponentConfigFromContainer(t);n.emit(te.REOPEN,e,i)}handleDeleteMarkdown(e){var{glEventHub:t}=this.props;t.emit(te.DELETE,e)}handleEditorBlur(e){var t;ra.debug("markdown content changed, saving...");var{isEditing:n}=this.state;if(!(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))){var i=(t=this.editor)===null||t===void 0?void 0:t.getValue();this.setState({content:i,isEditing:!1,panelState:{content:i}})}}handleEditorResize(){var{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){var{glContainer:e,glEventHub:t,closedPanels:n}=this.props,{isEditing:i,isStartPageShown:a,content:s}=this.state,o=this.getClosedMarkdowns(n);return u.jsx(Wt,{glContainer:e,glEventHub:t,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:a?u.jsx(Ox,{closedMarkdowns:o,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):u.jsx(Xp,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:u.jsx(c.Suspense,{fallback:u.jsx(He,{}),children:u.jsx(xx,{ref:l=>{this.markdownEditor=l},isEditing:i,content:s??void 0,onEditorInitialized:this.handleEditorInitialized})})})})}}ui(jl,"defaultProps",{panelState:null});ui(jl,"COMPONENT","MarkdownPanel");var Nx=(r,e)=>{var{localDashboardId:t}=e;return{closedPanels:ap(r,t)}},Mx=Pt(Nx,null,null,{forwardRef:!0})(jl);const ir=Mx;function mh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function gh(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){mh(a,n,i,s,o,"next",l)}function o(l){mh(a,n,i,s,o,"throw",l)}s(void 0)})}}function bh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function at(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bh(Object(t),!0).forEach(function(n){Ke(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ke(r,e,t){return e=Lx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lx(r){var e=Fx(r,"string");return typeof e=="symbol"?e:String(e)}function Fx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ax=c.lazy(()=>Yc(()=>import("./MarkdownNotebook-59ddb0a4.js"),["./MarkdownNotebook-59ddb0a4.js","./vendor-c87e2acb.js","./helpers-de833af9.js","./vendor-e1f37c45.css","./index-4e0b0d8e.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-fdfd3d2c.css","./useUser-206f2c8e.js","./useUser-5b7483c1.css","./plotly-37fd1df1.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),oe=B.module("NotebookPanel"),Ch=400;class je extends c.Component{static handleError(e){Se.isCanceled(e)||oe.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(je.UNSAVED_INDICATOR_CLASS_NAME,".").concat(je.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=ee.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Ke(this,"pending",void 0),Ke(this,"debouncedSavePanelState",void 0),Ke(this,"debouncedLoad",void 0),Ke(this,"notebook",void 0),Ke(this,"tabTitleElement",void 0),Ke(this,"tabInitOnce",void 0),Ke(this,"editor",void 0),Ke(this,"getSettings",se((f,p)=>at(at({},f),{},{minimap:{enabled:p}}))),Ke(this,"getOverflowActions",se((f,p)=>[{title:"Find",icon:ub,action:this.handleFind,group:ae.groups.high,shortcut:et.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:hb,action:this.handleCopy,group:ae.groups.medium,order:20},{title:"Rename File",icon:cb,action:this.handleShowRename,group:ae.groups.medium,order:30},{title:"Delete File",icon:Wn,action:this.handleDelete,group:ae.groups.medium,order:40},{title:"Show Minimap",icon:f?cr:void 0,action:this.handleMinimapChange,group:ae.groups.low,shortcut:et.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?cr:void 0,action:this.handleWordWrapChange,group:ae.groups.low,shortcut:et.NOTEBOOK.WORDWRAP,order:30}])),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Tn,this.debouncedSavePanelState=Le(this.savePanelState.bind(this),Ch),this.debouncedLoad=Le(this.load.bind(this),Ch),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:a}=e,s={value:"",language:"",wordWrap:"off"},o=null,{isPreview:l}=e;a!=null&&({fileMetadata:o=o,isPreview:l=l,settings:s=s}=a);var d=o!=null&&ee.hasPath(o.itemName),h=d===!0&&s.value!=null||!d&&s.value!=null&&s.value.length>0,v=h?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:v,fileMetadata:o,settings:s,session:n,sessionLanguage:i,panelState:{fileMetadata:o,settings:s},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},oe.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(he.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(he.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:a}=i,{defaultNotebookSettings:s}=this.props;n!==t.isPreview&&this.setPreviewStatus(),a!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),s.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:i}=this.state;e.off(he.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(he.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(he.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);z(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var a=this.notebook.getValue();return a??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){oe.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){oe.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(he.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:a}=i;n.emit(he.REGISTER_FILE,a,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(he.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;z(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(a=>{var s;oe.debug("Loaded file",a);var{filename:o}=a,{itemName:l}=this.state;if(o!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,ee.getBaseName(o))}var v=at(at({},t),{},{language:(s=je.languageFromFileName(o))!==null&&s!==void 0?s:""});t.value==null&&(v.value=a.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:v}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&ee.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){oe.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;oe.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:n,fileMetadata:i,isPreview:a,settings:s}=e,o=this.getNotebookValue(),l=t!==n?o:void 0,d=at(at({},s),{},{value:o}),h=at(at({},s),{},{value:l}),v={settings:h,fileMetadata:i,isPreview:a};return oe.debug("Saving panel state",v),{settings:d,panelState:v}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(he.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return gh(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:a,settings:s}=e.state;z(a);var{language:o}=s,{itemName:l}=a,d=yield ee.getUniqueCopyFileName(t,l);oe.debug("handleCopy",a,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},v={value:null,language:o};n.emit(he.SELECT_NOTEBOOK,i,o,v,h,!0)})()}handleDelete(){oe.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return gh(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:a}=e.state;oe.debug("handleDeleteConfirm",a==null?void 0:a.itemName),e.setState({showDeleteModal:!1}),a&&(ee.hasPath(a.itemName)&&(yield ee.fileExists(t,a.itemName))?(i.emit(he.CLOSE_FILE,a,{force:!0}),t.deleteFile(a.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){oe.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:a,isRedoing:s}=e;return a?{changeCount:n-1,savedChangeCount:i}:!s&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:n}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};n(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings:at(at({},t),{},{wordWrap:n})}})}handleBlur(){oe.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){oe.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:i}=this.props,{href:a}=e.currentTarget;if(!(!a||!a.startsWith(t))){e.stopPropagation(),e.preventDefault();var s="/".concat(a.substring(t.length)).replace(/%20/g," ");if(s==="/"){oe.debug("Ignoring invalid notebook link",s);return}oe.debug("Notebook link clicked, opening",s);var{glEventHub:o}=this.props,l={value:null,language:i},d={id:s,itemName:s};o.emit(he.SELECT_NOTEBOOK,n,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Se.isCanceled(t)||(Se.isTimedOut(t)&&(t=new Error("File not found.")),oe.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){oe.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},a=(t=je.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(s=>{var{fileMetadata:o}=s,l=at(at({},s.settings),{},{language:a});return oe.debug("handleSaveSuccess",i,o,l),o&&ee.hasPath(o.itemName)&&o.itemName!==i.itemName&&(oe.debug("handleSaveSuccess deleting old file",o.itemName),n.deleteFile(o.itemName).catch(je.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Se.isCanceled(e)||(this.setState({savedChangeCount:0}),oe.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),oe.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:a}=i,s=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),ee.getBaseName(a)!==ee.getBaseName(e)){var{metadata:o}=this.props,{id:l}=o;this.renameTab(l,ee.getBaseName(e))}this.saveContent(e,s)}}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:a}=this.state,{glContainer:s}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(a)!==JSON.stringify(n)){s.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){oe.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){oe.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;oe.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){oe.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];oe.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){oe.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){oe.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=n==null?void 0:n.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var a=new URL(i,t);return new URL(e,a).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:a,sessionLanguage:s,settings:o}=this.state,l=at(at({},o),{},{language:t,value:n}),d={id:null,itemName:e};oe.debug("handleCreateNotebook",a,s,l,d),i.emit(he.CREATE_NOTEBOOK,a,s,l,d)}runCommand(e){if(e===void 0||e===""){oe.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(pt.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:n}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=n.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=n.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,n,{fileStorage:i,glContainer:a,glContainer:{tab:s},glEventHub:o,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:v,isDashboardActive:f,isLoaded:p,isLoading:m,isPreview:b,fileMetadata:g,session:C,sessionLanguage:y,settings:S,showCloseModal:E,showDeleteModal:w,showSaveAsModal:I}=this.state,O=f&&!a.isHidden&&!b,T=(e=g==null?void 0:g.itemName)!==null&&e!==void 0?e:je.DEFAULT_NAME,N=T.endsWith(".md"),R=(g==null?void 0:g.id)!=null,W=this.getSettings(S,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=C!=null,D=y===W.language,M=!p||!L||!D,F=!p,k=[{action:this.handleSave,shortcut:Pr.SAVE},{action:this.handleMinimapChange,shortcut:et.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:et.NOTEBOOK.WORDWRAP}],H=vo.getDisabledRunTooltip(L,D,"Notebook extension","Run"),q=vo.getDisabledRunTooltip(L,D,"Notebook extension","Run Selected"),re=[{title:R?"Rename":"Save As…",order:10,group:ae.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ae.groups.high,order:20}],V=s==null?void 0:s.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[V!=null&&xa.createPortal(u.jsx("span",{className:Y(je.UNSAVED_INDICATOR_CLASS_NAME,{[je.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),V),u.jsxs(Wt,{className:"notebook-container",componentPanel:this,glContainer:a,glEventHub:o,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:re,renderTabTooltip:()=>T,children:[!N&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(K,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:M,icon:u.jsx(ne,{icon:Cc,transform:"grow-4"}),tooltip:"Run ".concat(et.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),H!=null&&u.jsx(wt,{children:H})]}),u.jsxs("span",{children:[u.jsx(K,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:M,icon:u.jsx(ne,{icon:db,transform:"grow-4"}),tooltip:"Run Selected ".concat(et.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),q!=null&&u.jsx(wt,{children:q})]}),u.jsx(K,{kind:"ghost",className:"mr-auto",disabled:F,onClick:this.handleSave,icon:yc,tooltip:"Save ".concat(Pr.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(K,{kind:"ghost",className:"btn-overflow",disabled:F,icon:bc,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(En,{actions:this.getDropdownOverflowActions,popperOptions:je.POPPER_OPTIONS})})]}),u.jsx(FO,{isLoaded:p,isLoading:m,error:v,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:y,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:W,focusOnMount:O,ref:x=>{this.notebook=x}})]}),N&&u.jsx(c.Suspense,{fallback:u.jsx(He,{}),children:u.jsx(Ax,{content:(n=W.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(Bp,{isOpen:I,type:"file",defaultValue:T,title:R?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(_n,{isOpen:w,headerText:'Are you sure you want to delete "'.concat(T,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(_n,{isOpen:E,headerText:"Do you want to save the changes you made to ".concat(T,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ae,{actions:k})]})]})}}Ke(je,"COMPONENT","NotebookPanel");Ke(je,"POPPER_OPTIONS",{placement:"bottom-end"});Ke(je,"DEFAULT_NAME","Untitled");Ke(je,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Ke(je,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Ke(je,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var Rx=(r,e)=>{var t=qf(r),n=i_(r),i=Hr(r,e.localDashboardId),{session:a,config:s}=i??{},{type:o}=s??{};return{fileStorage:t,defaultNotebookSettings:n,session:a,sessionLanguage:o}},jx=Pt(Rx,{updateSettings:C_},null,{forwardRef:!0})(je);const fn=jx;function Qp(r){var{onClick:e}=r,t=c.useRef(null),n=c.useCallback(i=>{var a;(a=t.current)===null||a===void 0||a.blur(),e(i)},[e]);return u.jsxs(K,{ref:t,kind:"primary",className:"btn-pandas",onClick:n,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",u.jsxs("span",{children:[u.jsx(ne,{icon:wc,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})}function Sh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sh(Object(t),!0).forEach(function(n){cs(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function cs(r,e,t){return e=kx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kx(r){var e=$x(r,"string");return typeof e=="symbol"?e:String(e)}function $x(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kl extends c.Component{constructor(e){super(e),cs(this,"irisGridRef",void 0),this.irisGridRef=X.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);var{panelState:t}=e;this.state={shouldFocusGrid:!1,panelState:t}}handleReload(){var e;(e=this.irisGridRef.current)===null||e===void 0||e.initModel(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var e,t,n,{shouldFocusGrid:i}=this.state;i&&(e=this.irisGridRef.current)!==null&&e!==void 0&&(t=e.irisGrid)!==null&&t!==void 0&&(n=t.current)!==null&&n!==void 0&&n.grid&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){return u.jsx(Mr,yh(yh({ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate},this.props),{},{children:u.jsx(Qp,{onClick:this.handleReload})}))}}cs(kl,"defaultProps",{panelState:null});cs(kl,"COMPONENT","PandasPanel");const Jp=kl;function Eh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function wh(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Eh(a,n,i,s,o,"next",l)}function o(l){Eh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Ph(r,e,t){return e=Ux(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ux(r){var e=Hx(r,"string");return typeof e=="symbol"?e:String(e)}function Hx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vx{constructor(e){Ph(this,"items",void 0),Ph(this,"onUpdateCallback",void 0),this.items=e}setSearch(e){}setExpanded(e,t){if(e.charAt(e.length-1)==="/")for(var n=0;n<this.items.length;n+=1){var i=this.items[n];mt(i)&&("".concat(i.filename,"/")===e||i.filename===e)&&(i.isExpanded=t)}return Promise.resolve()}collapseAll(){for(var e=0;e<this.items.length;e+=1){var t=this.items[e];mt(t)&&(t.isExpanded=!1)}return Promise.resolve()}getViewportData(){return Promise.resolve({items:this.items,offset:0})}getSnapshot(e){return wh(function*(){throw new Error("Method not implemented.")})()}setViewport(e){var t=this;return wh(function*(){var n,i=yield t.getViewportData();(n=t.onUpdateCallback)===null||n===void 0||n.call(t,i)})()}setFilters(e){}setSorts(e){}setReversed(e){}close(){}onUpdate(e){return this.onUpdateCallback=e,jest.fn()}get size(){return this.items.length}}const Bx=Vx;function _h(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function qr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){_h(a,n,i,s,o,"next",l)}function o(l){_h(a,n,i,s,o,"throw",l)}s(void 0)})}}function Wx(r,e,t){return e=Gx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gx(r){var e=zx(r,"string");return typeof e=="symbol"?e:String(e)}function zx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Kx{constructor(e){Wx(this,"items",void 0),this.items=e}getTable(){var e=this;return qr(function*(){return new Bx(e.items)})()}saveFile(e){throw new Error("Method not implemented.")}loadFile(e){throw new Error("Method not implemented.")}copyFile(e,t){return qr(function*(){throw new Error("Method not implemented.")})()}deleteFile(e){var t=this;return qr(function*(){t.items=t.items.filter(n=>n.filename!==e)})()}moveFile(e,t){var n=this;return qr(function*(){for(var i=0;i<n.items.length;i+=1)if(n.items[i].filename===e){n.items[i].filename=t,n.items[i].basename=ee.getBaseName(t),n.items[i].id=t;break}})()}info(e){var t=this;return qr(function*(){var n=t.items.filter(a=>a.filename===e);if(n.length===0)throw new ls;if(n.length>1)throw new Error("More than one matching file found");var i=n[0];return{filename:i.filename,basename:i.basename,id:i.filename,type:i.type}})()}createDirectory(e){throw new Error("Method not implemented.")}}const qx=Kx;function Th(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ia(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Th(Object(t),!0).forEach(function(n){Yx(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Th(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Yx(r,e,t){return e=Xx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xx(r){var e=Zx(r,"string");return typeof e=="symbol"?e:String(e)}function Zx(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Oh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Qx(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Oh(a,n,i,s,o,"next",l)}function o(l){Oh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Jx(r,e,t,n,i){return go.apply(this,arguments)}function go(){return go=Qx(function*(r,e,t,n,i){var a,s,o,l;if(Cr(t)?(a=t.settings,s=t.table,o=void 0,l=t.tableSettings):(a={},s="",o=Ml(t)?t.figure:t.name,l={}),i!=null&&(i.tableSettings!=null&&(l=i.tableSettings),i.table!=null&&(s=i.table),i.figure!=null&&(o=i.figure),i.settings!=null&&(a=Ia(Ia({},a),i.settings))),o==null&&s==null){var d=yield n();return mr.makeModel(r,a,d)}if(o!=null){var h;if(t.type===r.VariableType.FIGURE){var v={name:o,type:r.VariableType.FIGURE};h=yield e(v)}else h=yield n();return mr.makeModel(r,a,h)}var f={name:s,type:r.VariableType.TABLE},p=yield e(f);return new Ze(r).applyTableSettings(p,l,bl(Z_.getState())),mr.makeModelFromSettings(r,a,p)}),go.apply(this,arguments)}var $l=c.forwardRef((r,e)=>{var t=Ve(),n=Fv(),i=Up(r)?r.panelState:void 0,{fetch:a,metadata:s,localDashboardId:o}=r,l=c.useMemo(()=>({metadata:s,localDashboardId:o,makeModel:()=>{if(s==null)throw new Error("Metadata is required for chart panel");return Jx(t,n,s,a,i)}}),[s,o,t,n,a,i]);return u.jsx(Ai,Ia(Ia({ref:e},r),l))});$l.displayName="ChartPanelPlugin";const eN=$l;function Dh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function tN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Dh(a,n,i,s,o,"next",l)}function o(l){Dh(a,n,i,s,o,"throw",l)}s(void 0)})}}function em(r){var e=Ve(),[t,n]=c.useState(),{fetch:i}=r;return c.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=tN(function*(){var l=yield i(),d=yield mr.makeModel(e,void 0,l);a||n(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(ul,{model:t}):null}var nN={name:"ChartPanel",title:"Chart",type:nt.WIDGET_PLUGIN,component:em,panelComponent:$l,supportedTypes:"Figure",icon:_o};const rN=nN;function tm(r){Kn(r);var{id:e,layout:t}=r,n=Ve(),i=c.useCallback(a=>{var{metadata:s,panelId:o=ye.generate(),table:l}=a,{settings:d}=s,h=()=>mr.makeModelFromSettings(n,d,l),v=xe.titleFromSettings(d),f={type:"react-component",component:Ai.COMPONENT,props:{localDashboardId:e,id:o,metadata:s,makeModel:h},title:v,id:o},{root:p}=t;A.openComponent({root:p,config:f})},[n,e,t]);return ce(t.eventHub,Et.CREATE_CHART,i),null}var iN={name:"ChartBuilderPlugin",type:nt.DASHBOARD_PLUGIN,component:tm};const aN=iN;function Ih(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ih(Object(t),!0).forEach(function(n){sN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ih(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sN(r,e,t){return e=oN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oN(r){var e=lN(r,"string");return typeof e=="symbol"?e:String(e)}function lN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Oe=B.module("ConsolePlugin");function Nh(r){return r.notebook!==void 0}function dN(r){Kn(r)}function uN(r){dN(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:a,notebooksUrl:s}=r,o=c.useRef(0),[l,d]=c.useState(new Map),[h,v]=c.useState(new Map),f=gi(),p=c.useCallback(()=>i.getLastUsedPanelOfType(oa),[i]),m=c.useCallback((x,P)=>{d(j=>new Map(j.set(x,P)))},[d]),b=c.useCallback(x=>{d(P=>(P.delete(x),new Map(P)))},[d]),g=c.useCallback((x,P)=>{v(j=>new Map(j.set(x,P)))},[v]),C=c.useCallback(x=>{v(P=>(P.delete(x),new Map(P)))},[v]),y=c.useCallback(function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,U=x&&x.trim();if(!U)Oe.info("Ignoring empty code");else{var Q=p();if(!Q||!(Q instanceof oa.WrappedComponent)){Oe.error("Console panel not found");return}Oe.debug("Send command: ",x,P,j),Q.addCommand(x,P,j)}},[p]),S=c.useCallback(x=>{f(Rp(e,x))},[f,e]),E=c.useCallback(x=>{var{language:P}=x,j=P==="python"?"py":P,U=null;return j==null?(Oe.debug("No extension for language",P),U="Untitled-".concat(o.current)):U="Untitled-".concat(o.current,".").concat(j),o.current+=1,U},[]),w=c.useCallback(function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:j}=x;if(j!=null&&l.has(j))return l.get(j);if(j!=null&&h.has(j))return h.get(j);if(P)return ye.generate()},[l,h]),I=c.useCallback((x,P)=>{A.renameComponent(n.root,{id:x},P)},[n.root]),O=c.useCallback((x,P)=>{Oe.debug("Rename file panel",x,P);var j;if(l.has(x)&&(j=l.get(x),b(x),j!=null&&m(P,j)),h.has(x)&&(j=h.get(x),C(x),j!=null&&g(P,j)),j===void 0){Oe.debug2("File ".concat(x," isn't open, no need to rename the tab"));return}I(j,ee.getBaseName(P))},[l,h,I,m,g,b,C]),T=c.useCallback(x=>{var P=w(x,!1);if(P==null){Oe.error("Could not find panel id for file metadata",x);return}A.activateTab(n.root,{id:P})},[w,n.root]),N=c.useCallback((x,P,j)=>{if(Oe.debug("registerFilePanel",x,P,j),P==null||P.id==null){Oe.debug("Ignore empty file id",P);return}var{id:U}=P;if(j){g(U,x);return}if(l.has(U)){var Q=l.get(U);if(x===Q){Oe.debug("Update tab title for file ".concat(U));var{itemName:me}=P;O(U,me)}else Oe.error("File ".concat(U," already associated with a different tab ").concat(Q));return}m(U,x),h.has(U)&&C(U)},[l,h,O,m,g,C]),R=c.useCallback((x,P)=>{if(Oe.debug("unregisterFileTab",x,P),x==null||x.id==null){Oe.debug("Ignore empty file id",x);return}var{id:j}=x;if(P){C(j);return}b(j)},[b,C]),W=c.useCallback((x,P)=>{Oe.debug("closeFilePanel",x);var{id:j}=x,U=null,Q=!1;if(l.has(j))U=l.get(j);else if(h.has(j))U=h.get(j),Q=!0;else{Oe.debug("File ".concat(j," isn't open, ignore close event"));return}R(x,Q),A.closeComponent(n.root,{id:U},P)},[n.root,l,h,R]),L=c.useCallback(x=>{var{itemName:P}=x;return ee.getBaseName(P)},[]),D=c.useCallback(x=>{var{id:P}=x;return Oe.debug("fileIsOpen",x,P,l),P!=null&&l.has(P)},[l]),M=c.useCallback(x=>{var{id:P}=x;return Oe.debug("fileIsOpenAsPreview",x,P,h),P!=null&&h.has(P)},[h]),F=c.useCallback(x=>{if(x!=null){var P=i.getOpenedPanelById(x);P&&Nh(P)&&P.focus()}},[i]),k=c.useCallback(x=>{var{id:P,settings:j,fileMetadata:U,session:Q,sessionLanguage:me,isPreview:$=!1}=x,J={settings:j,fileMetadata:U},ie=L(U);return{type:"react-component",component:fn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:P},session:Q,sessionLanguage:me,panelState:J,isPreview:$,notebooksUrl:s},title:ie,id:P}},[L,e,s]),H=c.useCallback(function(x,P,j){var U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:E(j)},Q=w(U);if(D(U)&&Q!=null){Oe.debug("File is already open, focus panel"),T(U),F(Q);return}var me=A.getStackForComponentTypes(n.root,[fn.COMPONENT]),$=k({id:Q,settings:j,fileMetadata:U,session:x,sessionLanguage:P});Oe.debug("createNotebook",$,l),A.openComponentInStack(me,$)},[D,F,E,w,n.root,k,l,T]),q=c.useCallback(function(x,P,j,U){var Q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;Oe.debug("selectNotebook",U,Q);var me=D(U),$=M(U),[J]=[...h.values()],ie=!Q,ve=ie&&J?J:w(U);if(ve==null||ve==="")throw new Error("Unable to retrieve or create panelId for metadata",U);if(me||$)T(U);else{var Ee=A.getStackForComponentTypes(n.root,[fn.COMPONENT]),Vr=k({id:ve,settings:j,fileMetadata:U,session:x,sessionLanguage:P,isPreview:ie});A.openComponentInStack(Ee,Vr)}if($&&Q){var Qn=U.id,Br=A.getStackForConfig(n.root,{component:fn.COMPONENT,id:ve}),xn=A.getContentItemInStack(Br,{component:fn.COMPONENT,id:ve});xn&&ht(xn)&&(xn.container.emit(he.PROMOTE_FROM_PREVIEW),C(Qn),m(Qn,ve))}Q&&F(ve)},[T,D,M,F,w,n.root,k,h,C,m]),re=c.useCallback(function(x,P){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,Q=i.getLastUsedPanelOfType(fn);Q&&Nh(Q)?j!=null&&j.value!=null&&Q.notebook!=null&&Q.notebook.append(j.value):U&&H(x,P,j)},[H,i]),V=c.useCallback((x,P)=>Bf.hydrate(xh(xh({},x),{},{notebooksUrl:s}),P),[s]);return An(a,oa,t),An(a,Hp),An(a,Gp),An(a,Yp),An(a,fn,V),ce(n.eventHub,pt.SEND_COMMAND,y),ce(n.eventHub,pt.SETTINGS_CHANGED,S),ce(n.eventHub,he.CLOSE_FILE,W),ce(n.eventHub,he.CREATE_NOTEBOOK,H),ce(n.eventHub,he.SELECT_NOTEBOOK,q),ce(n.eventHub,he.RENAME,I),ce(n.eventHub,he.RENAME_FILE,O),ce(n.eventHub,he.SEND_TO_NOTEBOOK,re),ce(n.eventHub,he.REGISTER_FILE,N),ce(n.eventHub,he.UNREGISTER_FILE,R),null}var Yr=B.module("FilterPlugin");function Mh(r,e){return r.concat(e)}function nm(r){Kn(r);var{id:e,layout:t,registerComponent:n}=r,i=gi(),[a]=c.useState(()=>new Map),[s]=c.useState(()=>new Map),[o]=c.useState(()=>new Map),l=c.useCallback(()=>{var g=Array.from(a.values()).reduce(Mh,[]).sort((S,E)=>{var w=Ot.toLower(S.name),I=Ot.toLower(E.name);if(w!==I)return w>I?1:-1;var O=Ot.toLower(S.type),T=Ot.toLower(E.type);return O!==T?O>T?1:-1:0}).reduce((S,E)=>((S.length===0||Ot.toLower(S[S.length-1].name)!==Ot.toLower(E.name)||Ot.toLower(S[S.length-1].type)!==Ot.toLower(E.type))&&S.push(E),S),[]),C=Array.from(s.values()).reduce(Mh,[]).sort((S,E)=>S.timestamp-E.timestamp),y=new Map(o);Yr.debug("sendUpdate",{columns:g,filters:C,tableMap:y}),i(At(e,{columns:g,filters:C,tableMap:y}))},[i,e,a,s,o]),d=c.useCallback((g,C)=>{Yr.debug2("handleColumnsChanged",g,C),a.set(g,[].concat(C)),l()},[a,l]),h=c.useCallback((g,C)=>{Yr.debug2("handleFiltersChanged",g,C),s.set(g,[].concat(C)),l()},[s,l]),v=c.useCallback((g,C)=>{Yr.debug2("handleTableChanged",g,C),o.set(A.getIdFromPanel(g),C),l()},[o,l]),f=c.useCallback(g=>{Yr.debug2("handlePanelUnmount",g),a.delete(g),s.delete(g),o.delete(A.getIdFromPanel(g)),l()},[a,s,o,l]),p=c.useCallback(g=>{var{title:C="DropdownFilter",metadata:y={},panelState:S=null,id:E=ye.generate(),focusElement:w=A.DEFAULT_FOCUS_SELECTOR,createNewStack:I=!1,dragEvent:O=null}=g,T={type:"react-component",component:Pn.COMPONENT,props:{id:E,metadata:y,panelState:S,localDashboardId:e},title:C,id:E},{root:N}=t;A.openComponent({root:N,config:T,focusElement:w,createNewStack:I,dragEvent:O})},[t,e]),m=c.useCallback(g=>{var{title:C="InputFilter",metadata:y={},panelState:S=null,id:E=ye.generate(),focusElement:w=A.DEFAULT_FOCUS_SELECTOR,createNewStack:I=!1,dragEvent:O=void 0}=g,T={type:"react-component",component:Sr.COMPONENT,props:{id:E,metadata:y,panelState:S,localDashboardId:e},title:C,id:E},{root:N}=t;A.openComponent({root:N,config:T,focusElement:w,createNewStack:I,dragEvent:O})},[t,e]),b=c.useCallback(g=>{var{title:C="FilterSets",metadata:y={},panelState:S=null,id:E=ye.generate(),focusElement:w=A.DEFAULT_FOCUS_SELECTOR,createNewStack:I=!1,dragEvent:O=null}=g,T={type:"react-component",component:da.COMPONENT,props:{id:E,metadata:y,panelState:S,localDashboardId:e},title:C,id:E},{root:N}=t;A.openComponent({root:N,config:T,focusElement:w,createNewStack:I,dragEvent:O})},[t,e]);return c.useEffect(function(){var C=[n(Pn.COMPONENT,Pn),n(Sr.COMPONENT,Sr),n(da.COMPONENT,da)];return()=>{C.forEach(y=>y())}},[n]),ce(t.eventHub,Te.COLUMNS_CHANGED,d),ce(t.eventHub,Te.FILTERS_CHANGED,h),ce(t.eventHub,Te.TABLE_CHANGED,v),ce(t.eventHub,Te.OPEN_DROPDOWN,p),ce(t.eventHub,Te.OPEN_INPUT,m),ce(t.eventHub,Te.OPEN_FILTER_SET_MANAGER,b),ce(t.eventHub,te.UNMOUNT,f),null}var hN={name:"FilterPlugin",type:nt.DASHBOARD_PLUGIN,component:nm};const cN=hN;var vN=B.module("@deephaven/app-utils/useTablePlugin");function rm(){var r=Ba(),e=c.useCallback(t=>{var n=r.get(t);if(n!=null){if(nf(n))return n.component;if(al(n))return n.TablePlugin}var i="Unable to find table plugin ".concat(t,".");throw vN.error(i),new Error(i)},[r]);return e}function Lh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function fN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Lh(a,n,i,s,o,"next",l)}function o(l){Lh(a,n,i,s,o,"throw",l)}s(void 0)})}}function im(r,e,t){var n=Ve(),i=rm(),a=c.useMemo(()=>({loadPlugin:i,localDashboardId:e,makeModel:function(){var s=fN(function*(){var l=yield r();return Ra.makeModel(n,l)});function o(){return s.apply(this,arguments)}return o}(),metadata:t}),[n,r,e,i,t]);return a}function Fh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ah(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fh(Object(t),!0).forEach(function(n){pN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pN(r,e,t){return e=mN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mN(r){var e=gN(r,"string");return typeof e=="symbol"?e:String(e)}function gN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ul=c.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=im(n,t,i);return u.jsx(Mr,Ah(Ah({ref:e},r),a))});Ul.displayName="GridPanelPlugin";const bN=Ul;function Rh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function CN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Rh(a,n,i,s,o,"next",l)}function o(l){Rh(a,n,i,s,o,"throw",l)}s(void 0)})}}function am(r){var e=Ve(),[t,n]=c.useState(),{fetch:i}=r;return c.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=CN(function*(){var l=yield i(),d=yield Ra.makeModel(e,l);a||n(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(Tr,{model:t}):null}var SN={name:"IrisGridPanel",title:"Table",type:nt.WIDGET_PLUGIN,component:am,panelComponent:Ul,supportedTypes:["Table","TreeTable","HierarchicalTable","PartitionedTable"],icon:To};const yN=SN;function jh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function cn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jh(Object(t),!0).forEach(function(n){sm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sm(r,e,t){return e=EN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function EN(r){var e=wN(r,"string");return typeof e=="symbol"?e:String(e)}function wN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function om(r){var e=r;return typeof e.getCoordinateForColumn=="function"}function kh(r){var e=r;return om(r)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function $h(r){var e;return r.description===void 0||!((e=r.description)!==null&&e!==void 0&&e.startsWith("Preview of type: "))}var Xr=B.module("LinkerUtils");class vs{static getLinkType(e,t,n){var i;if((e==null?void 0:e.panelId)==null||(t==null?void 0:t.panelId)==null||e.panelId===t.panelId||n!=null&&n!==e.panelId&&n!==t.panelId)return Xr.debug2("Incompatible panel ids",e,t,n),"invalid";if(e.panelComponent==null||t.panelComponent==null)return Xr.error("PanelComponent should not be null",e,t),"invalid";var a=(i=vs.ALLOWED_LINKS.get(e.panelComponent))===null||i===void 0?void 0:i.includes(t.panelComponent);if(a===void 0||!a)return Xr.debug2("Incompatible panel components",e,t),"invalid";var{columnType:s}=e,{columnType:o}=t,l=o===null||Ne.isCompatibleType(s,o);if(!l)return Xr.debug2("Incompatible type",s,o),"invalid";switch(t.panelComponent){case A.getComponentName(Ai):return"chartLink";case A.getComponentName(Mr):return"tableLink";case A.getComponentName(Pn):return"filterSource"}return Xr.debug2("Incompatible target panel component",t.panelComponent),"invalid"}static findColumn(e,t){var{columnName:n,columnType:i}=t;return e.find(a=>{var{name:s,type:o}=a;return s===n&&o===i})}static cloneLinksForPanel(e,t,n){var i=[];return e.forEach(a=>{var s;a.start.panelId===t&&a.type!=="filterSource"?i.push(cn(cn({},a),{},{id:ye.generate(),start:cn(cn({},a.start),{},{panelId:n})})):((s=a.end)===null||s===void 0?void 0:s.panelId)===t&&i.push(cn(cn({},a),{},{id:ye.generate(),end:cn(cn({},a.end),{},{panelId:n})}))}),i}}sm(vs,"ALLOWED_LINKS",new Map([[A.getComponentName(Mr),[A.getComponentName(Mr),A.getComponentName(Ai),A.getComponentName(Pn)]]]));const Fn=vs;function lm(r,e,t){return e=PN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PN(r){var e=_N(r,"string");return typeof e=="symbol"?e:String(e)}function _N(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var TN=B.module("LinkerLink"),Uh=.015,Hh=1.5,dm=12,um=12,Vh=2,ia=Math.sqrt((um*.5)**2+dm**2),Bh=Math.asin(um*.5/dm),Wh=15,vn=Math.PI*.5;class yr extends c.Component{static makeCirclePath(e,t,n){return"M ".concat(e," ").concat(t," m -").concat(n,",0 a ").concat(n,",").concat(n," 0 1,0 ").concat(n*2,",0 a ").concat(n,",").concat(n," 0 1,0 -").concat(n*2,",0 z")}static getLabelForLinkFilter(e,t){try{if(Ne.isNumberType(e)||Ne.isCharType(e))return RC(t);if(Ne.isTextType(e))return jC(t);if(Ne.isDateType(e))return kC(t);if(Ne.isBooleanType(e)){if(t===Qr.eq)return"is equal to";if(t===Qr.notEq)return"is not equal to"}throw new Error("Unrecognized column type: ".concat(e))}catch(n){return TN.warn(n),""}}constructor(e){super(e),lm(this,"getOperators",se((t,n)=>{var{onOperatorChanged:i}=this.props,a=Ne.getFilterTypes(n);return Ne.isBooleanType(n)&&(a=[Qr.eq,Qr.notEq]),a.flatMap((s,o)=>{if(s==="eqIgnoreCase"||s==="notEqIgnoreCase")return[];var l="";return s==="startsWith"?l="a*":s==="endsWith"?l="*z":l=Ne.getFilterOperatorString(s),[{title:yr.getLabelForLinkFilter(n,s),icon:u.jsx("b",{children:l}),action:()=>i(t,s),order:o}]})})),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}handleClick(e){e.stopPropagation(),e.preventDefault();var{id:t,onClick:n,onDelete:i}=this.props;e.altKey?i(t):n(t)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){var{id:e,onDelete:t}=this.props;t(e)}getDropdownActions(){var{id:e,startColumnType:t}=this.props;return t!=null?this.getOperators(e,t):[]}render(){var{className:e,operator:t,isSelected:n,x1:i,y1:a,x2:s,y2:o,id:l,startColumnType:d,type:h}=this.props,{isHovering:v}=this.state,f=Math.sqrt((i-s)**2+(a-o)**2),p=Math.atan2(o-a,s-i),m=Math.sin(p),b=Math.cos(p)+2,g=window.innerWidth,C=window.innerHeight,y=0,S=0,E=Math.max(y,Math.min(i+(s-i)/2+m*(f*Uh)**Hh,g)),w=Math.max(S,Math.min(a+(o-a)/2+b*(f*Uh)**Hh,C)),I="M ".concat(i," ").concat(a," Q ").concat(E," ").concat(w," ").concat(s," ").concat(o),O="M ".concat(y," ").concat(S," L ").concat(y," ").concat(C," L ").concat(g," ").concat(C," L ").concat(g," ").concat(S,` z
25
25
  `).concat(yr.makeCirclePath(i,a,Wh),`
26
- `).concat(yr.makeCirclePath(s,o,Wh)),T="link-select-clip-".concat(l),N=Math.atan2(o-w,s-E),R=N-Bh+Math.PI,W=N+Bh+Math.PI,L=s+Math.cos(N)*Vh,D=o+Math.sin(N)*Vh,M=L+Math.cos(R)*ia,F=D+Math.sin(R)*ia,k=L+Math.cos(W)*ia,H=D+Math.sin(W)*ia,q="".concat(L,",").concat(D," ").concat(M,",").concat(F," ").concat(k,",").concat(H),re=.25*i+.5*E+.25*s,V=.25*a+.5*w+.25*o,x=E-i+(s-E),P=w-a+(o-w),j=P/x,U=20,Q=U/Math.sqrt(1+j**2),me=Q*j,$=Q*-1,J=me*-1;Number.isFinite(j)?j>0?(Q*=-1,me*=-1,$*=-1,J*=-1,$-=50-10*(Math.abs(p)%vn),J+=10*(Math.abs(p)%vn),Q-=50-10*(Math.abs(p)%vn),me+=10*(Math.abs(p)%vn)):j<0?($+=10*(Math.abs(p)%vn),J+=10*(Math.abs(p)%vn),Q+=10*(Math.abs(p)%vn),me+=10*(Math.abs(p)%vn)):($=15,J=10,Q=-25,me=10):($=10,J=5,Q=10,me=-35);var ie="";t!==void 0&&(t==="startsWith"?ie="a*":t==="endsWith"?ie="*z":ie=Ne.getFilterOperatorString(t));var ve=h!=="chartLink"&&h!=="filterSource";return u.jsxs(u.Fragment,{children:[u.jsxs("svg",{className:Y(e,{hovering:c}),children:[u.jsx("clipPath",{id:T,children:u.jsx("path",{d:O,clipRule:"evenodd"})}),u.jsx("path",{className:"link-select",d:I,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:"url(#".concat(T,")"),"data-testid":"link-select"}),u.jsx("path",{className:"link-background",d:I}),u.jsx("path",{className:"link-foreground",d:I}),u.jsx("circle",{className:"link-dot",cx:i,cy:a,r:"5"}),u.jsx("polygon",{className:"link-triangle",points:q})]}),d!=null&&n&&u.jsxs(u.Fragment,{children:[ve&&u.jsx(K,{kind:"primary",className:"btn-fab btn-operator",style:{top:V+(j>=0?me:J),left:re+(j>=0?Q:$)},onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx("b",{children:ie}),u.jsx(ne,{icon:sr,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:u.jsx(En,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),u.jsx(K,{kind:"primary",className:"btn-fab btn-delete",style:{top:V+(j<0?me:J),left:re+(j<0?Q:$)},onClick:this.handleDelete,icon:Wn,tooltip:"Delete"})]})]})}}lm(yr,"defaultProps",{className:"",isSelected:!1,onClick(){},onDelete(){}});const TN=yr;function Gh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function zh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gh(Object(t),!0).forEach(function(n){Hl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Gh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hl(r,e,t){return e=ON(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ON(r){var e=DN(r,"string");return typeof e=="symbol"?e:String(e)}function DN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ls=B.module("LinkerOverlayContent");class hm extends v.Component{constructor(e){super(e),Hl(this,"dialogRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=X.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){Ls.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){var{panelManager:t}=this.props,{panelId:n,columnName:i}=e,a=t.getOpenedPanelById(n);if(a!=null){if(!om(a))throw new Error("Panel does not have getCoordinateForColumn method: ".concat(n));try{var s=a.getCoordinateForColumn(i);if(s!=null)return s}catch{Ls.error("Could not get coordinate for column",i,a)}}var o=t.getContainerByPanelId(n);if(o==null)throw new Error("Unable to find panel container for id: ".concat(n));return A.getTabPoint(o)}handleOperatorChanged(e,t){var{links:n,onLinksUpdated:i}=this.props,a=n.map(s=>s.id===e?zh(zh({},s),{},{operator:t}):s);i(a)}handleBlur(){this.setState({mode:"select"})}handleResize(){var{dialog:e}=this.state;if(e&&this.dialogRef.current){var t=this.dialogRef.current.getBoundingClientRect(),n=ar(e.x,0,window.innerWidth-t.width),i=ar(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:i}})}}handleMouseMove(e){var{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){var i=this.dialogRef.current.getBoundingClientRect(),a=ar(window.innerWidth-(e.clientX+i.width+t.x),0,window.innerWidth-i.width),s=ar(window.innerHeight-(e.clientY+i.height+t.y),0,window.innerHeight-i.height);this.setState({dialog:{x:a,y:s}})}}handleMouseDown(e){e.preventDefault();var t={x:0,y:0};if(this.dialogRef.current){var n=this.dialogRef.current.getBoundingClientRect();t.x=n.right-(n.width+e.clientX),t.y=n.bottom-(n.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){var{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(i=>n(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){var{onCancel:e}=this.props;e()}render(){var{disabled:e,links:t,selectedIds:n,messageText:i,onLinkSelected:a,onLinkDeleted:s,onAllLinksDeleted:o,onDone:l}=this.props,{mouse:d,dialog:h,isDragging:c,mode:f}=this.state,p=t.map(m=>{try{var b,g,{id:C,type:y,isReversed:S,start:E,end:w,operator:I}=m,O=E.columnType,[T,N]=this.getPointFromLinkPoint(E),R=(b=d==null?void 0:d.x)!==null&&b!==void 0?b:T,W=(g=d==null?void 0:d.y)!==null&&g!==void 0?g:N;if(w!=null&&([R,W]=this.getPointFromLinkPoint(w)),S!=null&&S){var[L,D]=[T,N];[T,N]=[R,W],[R,W]=[L,D]}var M=Y("linker-link",{disabled:e},{"link-filter-source":y==="filterSource"},{"link-invalid":y==="invalid"},{interactive:m.end==null},{"link-is-selected":n.has(C)},{"danger-delete":f==="delete"});return{x1:T,y1:N,x2:R,y2:W,id:C,className:M,operator:I,startColumnType:O,type:y}}catch(F){return Ls.warn("Unable to get point for link",m,F),null}}).filter(m=>m!=null);return u.jsxs("div",{className:Y("linker-overlay",{"danger-delete":f==="delete"}),children:[p.map(m=>{var{x1:b,y1:g,x2:C,y2:y,id:S,className:E,operator:w,startColumnType:I,type:O}=m;return u.jsx(TN,{className:E,id:S,x1:b,y1:g,x2:C,y2:y,onClick:a,onDelete:s,isSelected:n.has(S),operator:w,startColumnType:I,type:O,onOperatorChanged:this.handleOperatorChanged},S)}),u.jsxs("div",{className:Y("linker-toast-dialog",{dragging:c}),ref:this.dialogRef,style:{bottom:h==null?void 0:h.y,right:h==null?void 0:h.x},"data-testid":"linker-toast-dialog",children:[u.jsx(K,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:vb,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!c&&u.jsx(wt,{children:"Drag to reposition"})}),u.jsx("div",{className:"toast-body",children:i}),u.jsxs("div",{className:"toast-footer",children:[u.jsx(K,{kind:"secondary",onClick:o,children:"Clear All"}),u.jsx(K,{kind:"primary",onClick:l,children:"Done"})]})]}),u.jsx(ae,{actions:[{action:this.handleEscapePressed,shortcut:Pr.LINKER_CLOSE,isGlobal:!0}]})]})}}Hl(hm,"defaultProps",{disabled:"false"});const IN=hm;function Kh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function qh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kh(Object(t),!0).forEach(function(n){cm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Kh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function cm(r,e,t){return e=xN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xN(r){var e=NN(r,"string");return typeof e=="symbol"?e:String(e)}function NN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ae=B.module("Linker"),MN=(r,e)=>({activeTool:Cl(r),dh:Gf(r),isolatedLinkerPanelId:rs(r,e.localDashboardId),links:Zn(r,e.localDashboardId),timeZone:bl(r)}),LN=Pt(MN,{setActiveTool:Jf,setDashboardLinks:as,addDashboardLinks:Lp,deleteDashboardLinks:Fp,setDashboardIsolatedLinkerPanelId:Nl,setDashboardColumnSelectionValidator:Ap});class FN extends v.Component{constructor(e){super(e),cm(this,"getCachedLinks",se((t,n,i)=>{var a=[...t];return n!=null&&n.start!=null&&a.push(n),i!==void 0?a.filter(s=>{var o,l;return(s==null||(o=s.start)===null||o===void 0?void 0:o.panelId)===i||(s==null||(l=s.end)===null||l===void 0?void 0:l.panelId)===i||(s==null?void 0:s.end)==null}):a})),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){var{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){var{activeTool:t,layout:n}=this.props;n!==e.layout&&(this.stopListening(e.layout),this.startListening(n)),t!==e.activeTool&&(this.updateSelectionValidators(),t===Nt.DEFAULT&&this.reset())}componentDidCatch(e,t){Ae.error("componentDidCatch",e,t)}componentWillUnmount(){var{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.on(Et.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Et.DATA_SELECTED,this.handleUpdateValues),t.on(Et.STATE_CHANGED,this.handleStateChange),t.on(Ta.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(te.CLONED,this.handlePanelCloned),t.on(Te.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Te.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(te.CLOSE,this.handlePanelClosed),t.on(te.CLOSED,this.handlePanelClosed),t.on(te.DRAGGING,this.handlePanelDragging),t.on(te.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.off(Et.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Et.DATA_SELECTED,this.handleUpdateValues),t.off(Et.STATE_CHANGED,this.handleStateChange),t.off(Ta.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(te.CLONED,this.handlePanelCloned),t.off(Te.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Te.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(te.CLOSE,this.handlePanelClosed),t.off(te.CLOSED,this.handlePanelClosed),t.off(te.DRAGGING,this.handlePanelDragging),t.off(te.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){var{linkInProgress:e}=this.state;if(e==null){var{setActiveTool:t}=this.props;t(Nt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){var{setActiveTool:e}=this.props;e(Nt.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){Ae.debug("handleFilterColumnSelect",this.isOverlayShown());var{links:n,localDashboardId:i,setActiveTool:a,setDashboardIsolatedLinkerPanelId:s}=this.props,o=A.getIdFromPanel(e),l=n.filter(d=>{var h,c;return((h=d.start)===null||h===void 0?void 0:h.panelId)===o||((c=d.end)===null||c===void 0?void 0:c.panelId)===o});if(!this.isOverlayShown()&&o!=null){a(Nt.LINKER),s(i,o),l.length===0&&this.columnSelected(e,t,!0,o);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){Ae.debug("handleColumnsChanged",e,t);var{links:n}=this.props,i=A.getIdFromPanel(e);if(i==null){Ae.error("Invalid panelId",e);return}var a=n.filter(s=>{var{start:o,end:l}=s;return o.panelId===i&&Fn.findColumn(t,o)==null||l!=null&&l.panelId===i&&Fn.findColumn(t,l)==null});this.deleteLinks(a)}handleGridColumnSelect(e,t){if(!$h(t)){Ae.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3?arguments[3]:void 0;if(!(i===void 0&&!this.isOverlayShown())){var{isolatedLinkerPanelId:a}=this.props,{linkInProgress:s}=this.state,o=A.getIdFromPanel(e);if(o!=null){var l=A.getComponentNameFromPanel(e),{name:d,type:h}=t;if(s==null||s.start==null){var c={id:ye.generate(),start:{panelId:o,panelComponent:l,columnName:d,columnType:h},type:"invalid",isReversed:n};Ae.debug("starting link",c),this.setState({linkInProgress:c})}else{var{links:f}=this.props,{start:p,id:m,isReversed:b}=s,g={panelId:o,panelComponent:l,columnName:d,columnType:h},C=Fn.getLinkType(b!==void 0&&b?g:p,b!==void 0&&b?p:g,i??a);switch(C){case"invalid":Ae.debug("Ignore invalid link connection",s,g);return;case"filterSource":{var y=b!==void 0&&b?p.panelId:g.panelId,S=f.filter(T=>{var{end:N}=T;return(N==null?void 0:N.panelId)===y});this.deleteLinks(S);break}case"chartLink":{var E=b===!0?p:g,w=b===!0?g:p;Ae.debug("creating chartlink",{existingLinkEnd:E,start:p,end:g});var I=f.filter(T=>{var{end:N,start:R}=T;return(R==null?void 0:R.panelId)===w.panelId&&(N==null?void 0:N.panelId)===E.panelId&&(N==null?void 0:N.columnName)===E.columnName&&(N==null?void 0:N.columnType)===E.columnType});this.deleteLinks(I);break}}var O={start:b!==void 0&&b?g:p,end:b!==void 0&&b?p:g,id:m,type:C,operator:Qr.eq};Ae.info("creating link",O),this.setState({linkInProgress:void 0,selectedIds:new Set([m])},()=>{this.addLinks([O])})}}}}unsetFilterValueForLink(e){var{panelManager:t}=this.props;if(e.end){var{end:n}=e,{panelId:i,columnName:a,columnType:s}=n,o=t.getOpenedPanelById(i);o?kh(o)?o.unsetFilterValue(a,s):Ae.debug("endPanel.unsetFilterValue not implemented",o):Ae.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,t){Ae.debug("Set filter data for panel:",e,t);var{panelManager:n}=this.props,i=n.getOpenedPanelById(e);i?kh(i)?i.setFilterMap(t):Ae.debug("panel.setFilterMap not implemented",e,i):Ae.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){var{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{localDashboardId:n}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){var{setDashboardLinks:i}=this.props;i(n,[])}else if(e.length>0){var{deleteDashboardLinks:a}=this.props;a(n,e.map(s=>{var{id:o}=s;return o}))}}handleAllLinksDeleted(){var{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{var n=e.filter(i=>{var a,s;return(i==null||(a=i.start)===null||a===void 0?void 0:a.panelId)===t||(i==null||(s=i.end)===null||s===void 0?void 0:s.panelId)===t});this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){var{links:t}=this.props,n=t.find(i=>i.id===e);n?this.deleteLinks([n]):Ae.error("Unable to find link to delete",e)}handleUpdateValues(e,t){for(var n=A.getIdFromPanel(e),{dh:i,links:a,timeZone:s}=this.props,o=new Map,l=0;l<a.length;l+=1){var{start:d,end:h,operator:c}=a[l];if(d.panelId===n&&h!=null){var{panelId:f,columnName:p,columnType:m}=h,b=o.has(f)?o.get(f):new Map,g=b.has(p)===!0?b.get(p).filterList:[],{visibleIndex:C,isExpandable:y,isGrouped:S}=t[d.columnName],{value:E}=t[d.columnName],w="".concat(E);if(E===null&&y&&S&&(E=void 0),m!=null&&Ne.isDateType(m)){var I=new xo(i,{timeZone:s,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:No.FULL_DATE_FORMAT});w=I.format(E)}var O={operator:c,text:w,value:E,startColumnIndex:C};g.push(O),b.set(p,{columnType:m,filterList:g}),o.set(f,b)}}o.forEach((T,N)=>{this.setPanelFilterMap(N,T)})}handlePanelCloned(e,t){var{links:n}=this.props,i=A.getIdFromPanel(e),a=t.id;if(i!=null){var s=Fn.cloneLinksForPanel(n,i,a);this.addLinks(s)}}handlePanelDragging(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var i=t[n],{start:a,end:s}=i;if(a.panelId===e||(s==null?void 0:s.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){Ae.debug("Panel ".concat(e," closed, deleting links.")),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){var{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){var{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var i=t[n],{start:a,end:s,id:o}=i;(a.panelId===e||(s==null?void 0:s.panelId)===e)&&this.handleLinkDeleted(o)}}isOverlayShown(){var{activeTool:e}=this.props;return e===Nt.LINKER}updateSelectionValidators(){var{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case Nt.LINKER:t(n,this.isColumnSelectionValid);break;default:t(n,void 0);break}}updateLinkInProgressType(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"invalid";this.setState(t=>{var{linkInProgress:n}=t;return n!==void 0?{linkInProgress:qh(qh({},n),{},{type:e})}:null})}isColumnSelectionValid(e,t){var{linkInProgress:n}=this.state,{isolatedLinkerPanelId:i}=this.props;if(t==null)return(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType(),!1;if(!$h(t))return Ae.debug2("Column is not filterable",t.description),(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType("invalid"),!1;if((n==null?void 0:n.start)==null)return!0;var{isReversed:a,start:s}=n,o=A.getIdFromPanel(e);if(o==null)return!1;var l={panelId:o,panelComponent:A.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},d=a!==void 0&&a?Fn.getLinkType(l,s,i):Fn.getLinkType(s,l,i);return this.updateLinkInProgressType(d),d!=="invalid"}render(){var{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:i,selectedIds:a,isDraggingPanel:s}=this.state,o=this.isOverlayShown(),l=i!=null&&i.start!=null,d=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return s?null:u.jsx(Hn,{in:o,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:u.jsx(IN,{disabled:l,panelManager:n,links:this.getCachedLinks(e,i,t),selectedIds:a,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}var AN=LN(FN);const RN=AN;function vm(r){Kn(r);var{id:e,layout:t,panelManager:n}=r;return u.jsx(RN,{layout:t,localDashboardId:e,panelManager:n})}var jN={name:"LinkerPlugin",type:nt.DASHBOARD_PLUGIN,component:vm};const kN=jN;function fm(r,e,t){return e=$N(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $N(r){var e=UN(r,"string");return typeof e=="symbol"?e:String(e)}function UN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ar{static getNewMarkdownTitle(e){for(var t="".concat(Ar.DEFAULT_TITLE),n=0;e.indexOf(t)>=0;)n+=1,t="".concat(Ar.DEFAULT_TITLE,"-").concat(n);return t}}fm(Ar,"DEFAULT_TITLE","Note");fm(Ar,"DEFAULT_CONTENT",`# Markdown Note
26
+ `).concat(yr.makeCirclePath(s,o,Wh)),T="link-select-clip-".concat(l),N=Math.atan2(o-w,s-E),R=N-Bh+Math.PI,W=N+Bh+Math.PI,L=s+Math.cos(N)*Vh,D=o+Math.sin(N)*Vh,M=L+Math.cos(R)*ia,F=D+Math.sin(R)*ia,k=L+Math.cos(W)*ia,H=D+Math.sin(W)*ia,q="".concat(L,",").concat(D," ").concat(M,",").concat(F," ").concat(k,",").concat(H),re=.25*i+.5*E+.25*s,V=.25*a+.5*w+.25*o,x=E-i+(s-E),P=w-a+(o-w),j=P/x,U=20,Q=U/Math.sqrt(1+j**2),me=Q*j,$=Q*-1,J=me*-1;Number.isFinite(j)?j>0?(Q*=-1,me*=-1,$*=-1,J*=-1,$-=50-10*(Math.abs(p)%vn),J+=10*(Math.abs(p)%vn),Q-=50-10*(Math.abs(p)%vn),me+=10*(Math.abs(p)%vn)):j<0?($+=10*(Math.abs(p)%vn),J+=10*(Math.abs(p)%vn),Q+=10*(Math.abs(p)%vn),me+=10*(Math.abs(p)%vn)):($=15,J=10,Q=-25,me=10):($=10,J=5,Q=10,me=-35);var ie="";t!==void 0&&(t==="startsWith"?ie="a*":t==="endsWith"?ie="*z":ie=Ne.getFilterOperatorString(t));var ve=h!=="chartLink"&&h!=="filterSource";return u.jsxs(u.Fragment,{children:[u.jsxs("svg",{className:Y(e,{hovering:v}),children:[u.jsx("clipPath",{id:T,children:u.jsx("path",{d:O,clipRule:"evenodd"})}),u.jsx("path",{className:"link-select",d:I,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:"url(#".concat(T,")"),"data-testid":"link-select"}),u.jsx("path",{className:"link-background",d:I}),u.jsx("path",{className:"link-foreground",d:I}),u.jsx("circle",{className:"link-dot",cx:i,cy:a,r:"5"}),u.jsx("polygon",{className:"link-triangle",points:q})]}),d!=null&&n&&u.jsxs(u.Fragment,{children:[ve&&u.jsx(K,{kind:"primary",className:"btn-fab btn-operator",style:{top:V+(j>=0?me:J),left:re+(j>=0?Q:$)},onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx("b",{children:ie}),u.jsx(ne,{icon:sr,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:u.jsx(En,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),u.jsx(K,{kind:"primary",className:"btn-fab btn-delete",style:{top:V+(j<0?me:J),left:re+(j<0?Q:$)},onClick:this.handleDelete,icon:Wn,tooltip:"Delete"})]})]})}}lm(yr,"defaultProps",{className:"",isSelected:!1,onClick(){},onDelete(){}});const ON=yr;function Gh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function zh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gh(Object(t),!0).forEach(function(n){Hl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Gh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hl(r,e,t){return e=DN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function DN(r){var e=IN(r,"string");return typeof e=="symbol"?e:String(e)}function IN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ls=B.module("LinkerOverlayContent");class hm extends c.Component{constructor(e){super(e),Hl(this,"dialogRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=X.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){Ls.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){var{panelManager:t}=this.props,{panelId:n,columnName:i}=e,a=t.getOpenedPanelById(n);if(a!=null){if(!om(a))throw new Error("Panel does not have getCoordinateForColumn method: ".concat(n));try{var s=a.getCoordinateForColumn(i);if(s!=null)return s}catch{Ls.error("Could not get coordinate for column",i,a)}}var o=t.getContainerByPanelId(n);if(o==null)throw new Error("Unable to find panel container for id: ".concat(n));return A.getTabPoint(o)}handleOperatorChanged(e,t){var{links:n,onLinksUpdated:i}=this.props,a=n.map(s=>s.id===e?zh(zh({},s),{},{operator:t}):s);i(a)}handleBlur(){this.setState({mode:"select"})}handleResize(){var{dialog:e}=this.state;if(e&&this.dialogRef.current){var t=this.dialogRef.current.getBoundingClientRect(),n=ar(e.x,0,window.innerWidth-t.width),i=ar(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:i}})}}handleMouseMove(e){var{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){var i=this.dialogRef.current.getBoundingClientRect(),a=ar(window.innerWidth-(e.clientX+i.width+t.x),0,window.innerWidth-i.width),s=ar(window.innerHeight-(e.clientY+i.height+t.y),0,window.innerHeight-i.height);this.setState({dialog:{x:a,y:s}})}}handleMouseDown(e){e.preventDefault();var t={x:0,y:0};if(this.dialogRef.current){var n=this.dialogRef.current.getBoundingClientRect();t.x=n.right-(n.width+e.clientX),t.y=n.bottom-(n.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){var{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(i=>n(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){var{onCancel:e}=this.props;e()}render(){var{disabled:e,links:t,selectedIds:n,messageText:i,onLinkSelected:a,onLinkDeleted:s,onAllLinksDeleted:o,onDone:l}=this.props,{mouse:d,dialog:h,isDragging:v,mode:f}=this.state,p=t.map(m=>{try{var b,g,{id:C,type:y,isReversed:S,start:E,end:w,operator:I}=m,O=E.columnType,[T,N]=this.getPointFromLinkPoint(E),R=(b=d==null?void 0:d.x)!==null&&b!==void 0?b:T,W=(g=d==null?void 0:d.y)!==null&&g!==void 0?g:N;if(w!=null&&([R,W]=this.getPointFromLinkPoint(w)),S!=null&&S){var[L,D]=[T,N];[T,N]=[R,W],[R,W]=[L,D]}var M=Y("linker-link",{disabled:e},{"link-filter-source":y==="filterSource"},{"link-invalid":y==="invalid"},{interactive:m.end==null},{"link-is-selected":n.has(C)},{"danger-delete":f==="delete"});return{x1:T,y1:N,x2:R,y2:W,id:C,className:M,operator:I,startColumnType:O,type:y}}catch(F){return Ls.warn("Unable to get point for link",m,F),null}}).filter(m=>m!=null);return u.jsxs("div",{className:Y("linker-overlay",{"danger-delete":f==="delete"}),children:[p.map(m=>{var{x1:b,y1:g,x2:C,y2:y,id:S,className:E,operator:w,startColumnType:I,type:O}=m;return u.jsx(ON,{className:E,id:S,x1:b,y1:g,x2:C,y2:y,onClick:a,onDelete:s,isSelected:n.has(S),operator:w,startColumnType:I,type:O,onOperatorChanged:this.handleOperatorChanged},S)}),u.jsxs("div",{className:Y("linker-toast-dialog",{dragging:v}),ref:this.dialogRef,style:{bottom:h==null?void 0:h.y,right:h==null?void 0:h.x},"data-testid":"linker-toast-dialog",children:[u.jsx(K,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:vb,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!v&&u.jsx(wt,{children:"Drag to reposition"})}),u.jsx("div",{className:"toast-body",children:i}),u.jsxs("div",{className:"toast-footer",children:[u.jsx(K,{kind:"secondary",onClick:o,children:"Clear All"}),u.jsx(K,{kind:"primary",onClick:l,children:"Done"})]})]}),u.jsx(ae,{actions:[{action:this.handleEscapePressed,shortcut:Pr.LINKER_CLOSE,isGlobal:!0}]})]})}}Hl(hm,"defaultProps",{disabled:"false"});const xN=hm;function Kh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function qh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kh(Object(t),!0).forEach(function(n){cm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Kh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function cm(r,e,t){return e=NN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function NN(r){var e=MN(r,"string");return typeof e=="symbol"?e:String(e)}function MN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ae=B.module("Linker"),LN=(r,e)=>({activeTool:Cl(r),dh:Gf(r),isolatedLinkerPanelId:rs(r,e.localDashboardId),links:Zn(r,e.localDashboardId),timeZone:bl(r)}),FN=Pt(LN,{setActiveTool:Jf,setDashboardLinks:as,addDashboardLinks:Lp,deleteDashboardLinks:Fp,setDashboardIsolatedLinkerPanelId:Nl,setDashboardColumnSelectionValidator:Ap});class AN extends c.Component{constructor(e){super(e),cm(this,"getCachedLinks",se((t,n,i)=>{var a=[...t];return n!=null&&n.start!=null&&a.push(n),i!==void 0?a.filter(s=>{var o,l;return(s==null||(o=s.start)===null||o===void 0?void 0:o.panelId)===i||(s==null||(l=s.end)===null||l===void 0?void 0:l.panelId)===i||(s==null?void 0:s.end)==null}):a})),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){var{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){var{activeTool:t,layout:n}=this.props;n!==e.layout&&(this.stopListening(e.layout),this.startListening(n)),t!==e.activeTool&&(this.updateSelectionValidators(),t===Nt.DEFAULT&&this.reset())}componentDidCatch(e,t){Ae.error("componentDidCatch",e,t)}componentWillUnmount(){var{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.on(Et.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Et.DATA_SELECTED,this.handleUpdateValues),t.on(Et.STATE_CHANGED,this.handleStateChange),t.on(Ta.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(te.CLONED,this.handlePanelCloned),t.on(Te.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Te.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(te.CLOSE,this.handlePanelClosed),t.on(te.CLOSED,this.handlePanelClosed),t.on(te.DRAGGING,this.handlePanelDragging),t.on(te.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.off(Et.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Et.DATA_SELECTED,this.handleUpdateValues),t.off(Et.STATE_CHANGED,this.handleStateChange),t.off(Ta.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(te.CLONED,this.handlePanelCloned),t.off(Te.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Te.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(te.CLOSE,this.handlePanelClosed),t.off(te.CLOSED,this.handlePanelClosed),t.off(te.DRAGGING,this.handlePanelDragging),t.off(te.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){var{linkInProgress:e}=this.state;if(e==null){var{setActiveTool:t}=this.props;t(Nt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){var{setActiveTool:e}=this.props;e(Nt.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){Ae.debug("handleFilterColumnSelect",this.isOverlayShown());var{links:n,localDashboardId:i,setActiveTool:a,setDashboardIsolatedLinkerPanelId:s}=this.props,o=A.getIdFromPanel(e),l=n.filter(d=>{var h,v;return((h=d.start)===null||h===void 0?void 0:h.panelId)===o||((v=d.end)===null||v===void 0?void 0:v.panelId)===o});if(!this.isOverlayShown()&&o!=null){a(Nt.LINKER),s(i,o),l.length===0&&this.columnSelected(e,t,!0,o);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){Ae.debug("handleColumnsChanged",e,t);var{links:n}=this.props,i=A.getIdFromPanel(e);if(i==null){Ae.error("Invalid panelId",e);return}var a=n.filter(s=>{var{start:o,end:l}=s;return o.panelId===i&&Fn.findColumn(t,o)==null||l!=null&&l.panelId===i&&Fn.findColumn(t,l)==null});this.deleteLinks(a)}handleGridColumnSelect(e,t){if(!$h(t)){Ae.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3?arguments[3]:void 0;if(!(i===void 0&&!this.isOverlayShown())){var{isolatedLinkerPanelId:a}=this.props,{linkInProgress:s}=this.state,o=A.getIdFromPanel(e);if(o!=null){var l=A.getComponentNameFromPanel(e),{name:d,type:h}=t;if(s==null||s.start==null){var v={id:ye.generate(),start:{panelId:o,panelComponent:l,columnName:d,columnType:h},type:"invalid",isReversed:n};Ae.debug("starting link",v),this.setState({linkInProgress:v})}else{var{links:f}=this.props,{start:p,id:m,isReversed:b}=s,g={panelId:o,panelComponent:l,columnName:d,columnType:h},C=Fn.getLinkType(b!==void 0&&b?g:p,b!==void 0&&b?p:g,i??a);switch(C){case"invalid":Ae.debug("Ignore invalid link connection",s,g);return;case"filterSource":{var y=b!==void 0&&b?p.panelId:g.panelId,S=f.filter(T=>{var{end:N}=T;return(N==null?void 0:N.panelId)===y});this.deleteLinks(S);break}case"chartLink":{var E=b===!0?p:g,w=b===!0?g:p;Ae.debug("creating chartlink",{existingLinkEnd:E,start:p,end:g});var I=f.filter(T=>{var{end:N,start:R}=T;return(R==null?void 0:R.panelId)===w.panelId&&(N==null?void 0:N.panelId)===E.panelId&&(N==null?void 0:N.columnName)===E.columnName&&(N==null?void 0:N.columnType)===E.columnType});this.deleteLinks(I);break}}var O={start:b!==void 0&&b?g:p,end:b!==void 0&&b?p:g,id:m,type:C,operator:Qr.eq};Ae.info("creating link",O),this.setState({linkInProgress:void 0,selectedIds:new Set([m])},()=>{this.addLinks([O])})}}}}unsetFilterValueForLink(e){var{panelManager:t}=this.props;if(e.end){var{end:n}=e,{panelId:i,columnName:a,columnType:s}=n,o=t.getOpenedPanelById(i);o?kh(o)?o.unsetFilterValue(a,s):Ae.debug("endPanel.unsetFilterValue not implemented",o):Ae.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,t){Ae.debug("Set filter data for panel:",e,t);var{panelManager:n}=this.props,i=n.getOpenedPanelById(e);i?kh(i)?i.setFilterMap(t):Ae.debug("panel.setFilterMap not implemented",e,i):Ae.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){var{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{localDashboardId:n}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){var{setDashboardLinks:i}=this.props;i(n,[])}else if(e.length>0){var{deleteDashboardLinks:a}=this.props;a(n,e.map(s=>{var{id:o}=s;return o}))}}handleAllLinksDeleted(){var{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{var n=e.filter(i=>{var a,s;return(i==null||(a=i.start)===null||a===void 0?void 0:a.panelId)===t||(i==null||(s=i.end)===null||s===void 0?void 0:s.panelId)===t});this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){var{links:t}=this.props,n=t.find(i=>i.id===e);n?this.deleteLinks([n]):Ae.error("Unable to find link to delete",e)}handleUpdateValues(e,t){for(var n=A.getIdFromPanel(e),{dh:i,links:a,timeZone:s}=this.props,o=new Map,l=0;l<a.length;l+=1){var{start:d,end:h,operator:v}=a[l];if(d.panelId===n&&h!=null){var{panelId:f,columnName:p,columnType:m}=h,b=o.has(f)?o.get(f):new Map,g=b.has(p)===!0?b.get(p).filterList:[],{visibleIndex:C,isExpandable:y,isGrouped:S}=t[d.columnName],{value:E}=t[d.columnName],w="".concat(E);if(E===null&&y&&S&&(E=void 0),m!=null&&Ne.isDateType(m)){var I=new xo(i,{timeZone:s,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:No.FULL_DATE_FORMAT});w=I.format(E)}var O={operator:v,text:w,value:E,startColumnIndex:C};g.push(O),b.set(p,{columnType:m,filterList:g}),o.set(f,b)}}o.forEach((T,N)=>{this.setPanelFilterMap(N,T)})}handlePanelCloned(e,t){var{links:n}=this.props,i=A.getIdFromPanel(e),a=t.id;if(i!=null){var s=Fn.cloneLinksForPanel(n,i,a);this.addLinks(s)}}handlePanelDragging(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var i=t[n],{start:a,end:s}=i;if(a.panelId===e||(s==null?void 0:s.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){Ae.debug("Panel ".concat(e," closed, deleting links.")),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){var{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){var{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var i=t[n],{start:a,end:s,id:o}=i;(a.panelId===e||(s==null?void 0:s.panelId)===e)&&this.handleLinkDeleted(o)}}isOverlayShown(){var{activeTool:e}=this.props;return e===Nt.LINKER}updateSelectionValidators(){var{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case Nt.LINKER:t(n,this.isColumnSelectionValid);break;default:t(n,void 0);break}}updateLinkInProgressType(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"invalid";this.setState(t=>{var{linkInProgress:n}=t;return n!==void 0?{linkInProgress:qh(qh({},n),{},{type:e})}:null})}isColumnSelectionValid(e,t){var{linkInProgress:n}=this.state,{isolatedLinkerPanelId:i}=this.props;if(t==null)return(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType(),!1;if(!$h(t))return Ae.debug2("Column is not filterable",t.description),(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType("invalid"),!1;if((n==null?void 0:n.start)==null)return!0;var{isReversed:a,start:s}=n,o=A.getIdFromPanel(e);if(o==null)return!1;var l={panelId:o,panelComponent:A.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},d=a!==void 0&&a?Fn.getLinkType(l,s,i):Fn.getLinkType(s,l,i);return this.updateLinkInProgressType(d),d!=="invalid"}render(){var{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:i,selectedIds:a,isDraggingPanel:s}=this.state,o=this.isOverlayShown(),l=i!=null&&i.start!=null,d=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return s?null:u.jsx(Hn,{in:o,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:u.jsx(xN,{disabled:l,panelManager:n,links:this.getCachedLinks(e,i,t),selectedIds:a,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}var RN=FN(AN);const jN=RN;function vm(r){Kn(r);var{id:e,layout:t,panelManager:n}=r;return u.jsx(jN,{layout:t,localDashboardId:e,panelManager:n})}var kN={name:"LinkerPlugin",type:nt.DASHBOARD_PLUGIN,component:vm};const $N=kN;function fm(r,e,t){return e=UN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function UN(r){var e=HN(r,"string");return typeof e=="symbol"?e:String(e)}function HN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ar{static getNewMarkdownTitle(e){for(var t="".concat(Ar.DEFAULT_TITLE),n=0;e.indexOf(t)>=0;)n+=1,t="".concat(Ar.DEFAULT_TITLE,"-").concat(n);return t}}fm(Ar,"DEFAULT_TITLE","Note");fm(Ar,"DEFAULT_CONTENT",`# Markdown Note
27
27
 
28
- This note can be edited using **markdown** for styling.`);const Fs=Ar;function pm(r){Kn(r);var{id:e,layout:t,panelManager:n,registerComponent:i}=r,a=v.useCallback(o=>{var{title:l,componentState:d,props:h}=o,{panelState:c=null}=h;return d!=null&&({panelState:c=null}=d),l==null||c==null||c.content==null||c.content.length===0||c.content===Fs.DEFAULT_CONTENT?null:za(o)},[]),s=v.useCallback(function(){var{title:o="",metadata:l={},id:d=ye.generate(),focusElement:h=A.DEFAULT_FOCUS_SELECTOR,createNewStack:c=!1,dragEvent:f=null}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=n.getOpenedPanelConfigsOfType(ir.COMPONENT),m=n.getClosedPanelConfigsOfType(ir.COMPONENT),b=p.map(E=>{var w;return(w=E.title)!==null&&w!==void 0?w:""}),g=o!=null&&o!==""?o:Fs.getNewMarkdownTitle(b),C=m.length>0?null:Fs.DEFAULT_CONTENT,y={type:"react-component",component:ir.COMPONENT,props:{id:d,metadata:l,panelState:{content:C},localDashboardId:e},title:g,id:d},{root:S}=t;A.openComponent({root:S,config:y,focusElement:h,createNewStack:c,dragEvent:f})},[e,t,n]);return v.useEffect(function(){var l=[i(ir.COMPONENT,ir,Ka,a)];return()=>{l.forEach(d=>d())}},[a,i]),ce(t.eventHub,Pp.OPEN,s),null}var HN={name:"MarkdownPlugin",type:nt.DASHBOARD_PLUGIN,component:pm};const VN=HN;function Yh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Xh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yh(Object(t),!0).forEach(function(n){BN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Yh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function BN(r,e,t){return e=WN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WN(r){var e=GN(r,"string");return typeof e=="symbol"?e:String(e)}function GN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Vl=v.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=im(n,t,i);return u.jsx(Jp,Xh(Xh({ref:e},r),a))});Vl.displayName="PandasPanelPlugin";const zN=Vl;function Zh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function As(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Zh(a,n,i,s,o,"next",l)}function o(l){Zh(a,n,i,s,o,"throw",l)}s(void 0)})}}function mm(r){var e=Ve(),[t,n]=v.useState(),[i,a]=v.useState(!0),[s,o]=v.useState(!1),{fetch:l}=r,d=v.useCallback(As(function*(){var c=yield l();return Ra.makeModel(e,c)}),[e,l]),h=v.useCallback(As(function*(){a(!0);var c=yield d();n(c),a(!1)}),[d]);return v.useEffect(()=>{var c=!1;function f(){return p.apply(this,arguments)}function p(){return p=As(function*(){var m=yield d();c||(n(m),o(!0),a(!1))}),p.apply(this,arguments)}return f(),a(!0),()=>{c=!0}},[d]),u.jsxs(u.Fragment,{children:[u.jsx(He,{isLoaded:s,isLoading:i}),t&&u.jsx(Tr,{model:t,children:u.jsx(Qp,{onClick:h})})]})}var KN={name:"PandasPanel",title:"Pandas",type:nt.WIDGET_PLUGIN,component:mm,panelComponent:Vl,supportedTypes:"pandas.DataFrame",icon:gc};const qN=KN;function Qh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Zr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qh(Object(t),!0).forEach(function(n){YN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function YN(r,e,t){return e=XN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XN(r){var e=ZN(r,"string");return typeof e=="symbol"?e:String(e)}function ZN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var QN=B.module("WidgetLoaderPlugin");function JN(r){var e;function t(n,i){var a,s=r.component,{metadata:o}=n,l=gl(s);return u.jsx(Fi,Zr(Zr({widgetName:(a=o==null?void 0:o.name)!==null&&a!==void 0?a:void 0,widgetType:r.title},n),{},{children:l?u.jsx(s,Zr(Zr({},n),{},{ref:i})):u.jsx(s,Zr({},n))}))}return t.displayName="WidgetLoaderPlugin(".concat((e=r.component.displayName)!==null&&e!==void 0?e:r.name,")"),v.forwardRef(t)}function gm(r){var e=Ba(),t=v.useMemo(()=>{var o=new Map;return e.forEach(l=>{Ti(l)&&[l.supportedTypes].flat().forEach(d=>{if(d!=null&&d!==""){if(o.has(d)){var h;QN.warn("Multiple WidgetPlugins handling type ".concat(d,". Replacing ").concat((h=o.get(d))===null||h===void 0?void 0:h.name," with ").concat(l.name," to handle ").concat(d))}o.set(d,l)}})}),o},[e]);Kn(r);var{id:n,layout:i,registerComponent:a}=r,s=v.useCallback(o=>{var l,{dragEvent:d,panelId:h=ye.generate(),fetch:c,widget:f}=o,{type:p}=f,m=p!=null?t.get(p):null;if(m!=null){var b=(l=f.name)!==null&&l!==void 0?l:p,g={localDashboardId:n,metadata:f,fetch:c},C={type:"react-component",component:m.name,props:g,title:b,id:h},{root:y}=i;A.openComponent({root:y,config:C,dragEvent:d})}},[n,i,t]);return v.useEffect(()=>{var o=[...new Set(t.values())].map(l=>{var{panelComponent:d}=l;return d==null?a(l.name,JN(l)):a(l.name,d)});return()=>{o.forEach(l=>l())}},[a,t]),ce(i.eventHub,te.OPEN,s),null}var eM={name:"WidgetLoaderPlugin",type:nt.DASHBOARD_PLUGIN,component:gm};const tM=eM;function fs(r,e,t){return e=nM(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nM(r){var e=rM(r,"string");return typeof e=="symbol"?e:String(e)}function rM(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ji{}fs(ji,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");fs(ji,"INPUT_FILTER","ControlType.INPUT_FILTER");fs(ji,"MARKDOWN","ControlType.MARKDOWN");fs(ji,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const iM=ji;var aM=_.shape({state:_.shape({panelState:_.shape({})})}),sM=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired,columnType:_.string.isRequired}),Jh=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired}),bm=_.shape({start:Jh,end:Jh,id:_.string,isReversed:_.bool}),oM=_.arrayOf(bm),lM=_.shape({name:_.string.isRequired,operateAs:_.string.isRequired,groups:_.arrayOf(_.string).isRequired,permissions:_.shape({canUsePanels:_.bool.isRequired,canCopy:_.bool.isRequired,canDownloadCsv:_.bool.isRequired,canLogout:_.bool.isRequired}).isRequired}),dM=Object.freeze({LinkPoint:sM,Link:bm,Links:oM,Panel:aM,User:lM});const uM=dM;var hM=(r,e)=>r[e]===null?null:_.bool,cM=(r,e)=>r[e]===null?null:_.string,vM=Object.freeze({nullableBoolean:hM,nullableString:cM});const fM=vM,pM=Object.freeze(Object.defineProperty({__proto__:null,ChartBuilderPlugin:tm,ChartBuilderPluginConfig:iN,ChartEvent:Ta,ChartPanel:Ai,ChartPanelPlugin:Jx,ChartPluginConfig:nN,ChartWidgetPlugin:em,CommandHistoryPanel:Hp,CommonPropTypes:fM,ConsoleEvent:pt,ConsolePanel:oa,ConsolePlugin:dN,ControlType:iM,DropdownFilterPanel:Pn,FileExplorerPanel:Gp,FilterPlugin:nm,FilterPluginConfig:hN,FilterSetManager:zp,FilterSetManagerPanel:da,GridPanelPlugin:gN,GridPluginConfig:SN,GridWidgetPlugin:am,InputFilterEvent:Te,InputFilterPanel:Sr,IrisGridEvent:Et,IrisGridPanel:Mr,LinkerPlugin:vm,LinkerPluginConfig:kN,LinkerUtils:Fn,LogPanel:Yp,MarkdownEvent:Pp,MarkdownPanel:ir,MarkdownPlugin:pm,MarkdownPluginConfig:VN,MockFileStorage:Kx,NotebookEvent:he,NotebookPanel:fn,PandasEvent:PD,PandasPanel:Jp,PandasPanelPlugin:zN,PandasPluginConfig:qN,PandasWidgetPlugin:mm,Panel:Wt,TabEvent:ri,ToolType:Nt,UIPropTypes:uM,WidgetLoaderPlugin:gm,WidgetLoaderPluginConfig:tM,WidgetPanel:Fi,WidgetPanelTooltip:Li,addDashboardLinks:Lp,deleteDashboardLinks:Fp,getColumnSelectionValidatorForDashboard:is,getColumnsForDashboard:xl,getDashboardConnection:HD,getDashboardConsoleSettings:UD,getDashboardSessionWrapper:Hr,getFilterSetsForDashboard:Mp,getInputFiltersForDashboard:ts,getIsolatedLinkerPanelIdForDashboard:rs,getLinksForDashboard:Zn,getTableMapForDashboard:ns,isChartPanelDehydratedProps:Up,isChartPanelFigureMetadata:Ml,isChartPanelTableMetadata:Cr,isGLChartPanelState:$p,isIrisGridPanelMetadata:qp,isLegacyIrisGridPanelMetadata:Kp,setDashboardColumnSelectionValidator:Ap,setDashboardConnection:VD,setDashboardConsoleSettings:Rp,setDashboardFilterSets:jp,setDashboardIsolatedLinkerPanelId:Nl,setDashboardLinks:as,setDashboardSessionWrapper:BD,useLoadTablePlugin:rm},Symbol.toStringTag,{value:"Module"}));var Cm={react:X,"react-dom":xa,redux:ag,"react-redux":sg,"@adobe/react-spectrum":og,"@deephaven/auth-plugins":Ow,"@deephaven/chart":Zw,"@deephaven/components":rE,"@deephaven/dashboard":_T,"@deephaven/dashboard-core-plugins":pM,"@deephaven/icons":fb,"@deephaven/iris-grid":hD,"@deephaven/jsapi-bootstrap":oE,"@deephaven/jsapi-components":ZE,"@deephaven/jsapi-utils":SE,"@deephaven/log":B,"@deephaven/plugin":tw,"@deephaven/react-hooks":ES},mM=lg.createRequires(Cm),gM=dg({requires:mM});const bM=gM;function ec(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Bl(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){ec(a,n,i,s,o,"next",l)}function o(l){ec(a,n,i,s,o,"throw",l)}s(void 0)})}}var gn=B.module("@deephaven/app-utils.PluginUtils");function Sm(r){return bo.apply(this,arguments)}function bo(){return bo=Bl(function*(r){var e=yield bM(r);return e}),bo.apply(this,arguments)}function ym(r){return Co.apply(this,arguments)}function Co(){return Co=Bl(function*(r){var e=yield fetch(r);if(!e.ok)throw new Error(e.statusText);try{return yield e.json()}catch{throw new Error("Could not be parsed as JSON")}}),Co.apply(this,arguments)}function Em(r){return So.apply(this,arguments)}function So(){return So=Bl(function*(r){gn.debug("Loading plugins...");try{var e=yield ym("".concat(r,"/manifest.json"));if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");gn.debug("Plugin manifest loaded:",e);for(var t=[],n=0;n<e.plugins.length;n+=1){var{name:i,main:a}=e.plugins[n],s="".concat(r,"/").concat(i,"/").concat(a);t.push(Sm(s))}for(var o=yield Promise.allSettled(t),l=new Map,d=0;d<o.length;d+=1){var h=o[d],{name:c}=e.plugins[d];if(h.status==="fulfilled"){var f,p=tf(h.value)?h.value:(f=h.value.default)!==null&&f!==void 0?f:h.value;p==null?gn.error("Plugin '".concat(c,"' is missing an exported value.")):l.set(c,p)}else gn.error("Unable to load plugin '".concat(c,"'"),h.reason)}return gn.info("Plugins loaded:",l),l}catch(m){return gn.error("Unable to load plugins:",m),new Map}}),So.apply(this,arguments)}function wm(r){var e,t;return(e=(t=r.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function Pm(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,n=wm(e),i=[...r.entries(),...t.entries()].filter(l=>{var[,d]=l;return rf(d)||ma(d)}).map(l=>{var[d,h]=l;return ma(h)?{type:nt.AUTH_PLUGIN,name:d,component:h.AuthPlugin.Component,isAvailable:h.AuthPlugin.isAvailable}:h}),a=i.filter(l=>{var{isAvailable:d}=l;return d(n,e)});if(a.length===0)throw new Error("No login plugins found, please register a login plugin for auth handlers: ".concat(n));a.length>1&&gn.warn("More than one login plugin available, will use the first one: ",a.map(l=>{var{name:d}=l;return d}).join(", "));var{name:s,component:o}=a[0];return gn.info("Using LoginPlugin",s),o}var CM=vc.createRequires(()=>Cm),SM=vc.createRemoteComponent({requires:CM});const yM=SM;function tc(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function EM(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){tc(a,n,i,s,o,"next",l)}function o(l){tc(a,n,i,s,o,"throw",l)}s(void 0)})}}function _m(r){var{pluginsUrl:e,getCorePlugins:t,children:n}=r,[i,a]=v.useState(null);return v.useEffect(function(){var o=!1;function l(){return d.apply(this,arguments)}function d(){return d=EM(function*(){var h,c=(h=yield t==null?void 0:t())!==null&&h!==void 0?h:[],f=yield Em(e);if(!o){var p=c.map(m=>[m.name,m]);a(new Map([...p,...f]))}}),d.apply(this,arguments)}return l(),()=>{o=!0}},[e,t]),u.jsx(_i.Provider,{value:i,children:n})}function wM(){var r=Jo();return v.useEffect(function(){r.postMessage(Yo(qo))},[r]),null}function nc(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function PM(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){nc(a,n,i,s,o,"next",l)}function o(l){nc(a,n,i,s,o,"throw",l)}s(void 0)})}}var _M=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:hf}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:pf}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:uf}]]);function Tm(r){var{children:e}=r,t=Gn(),n=v.useContext(_i),[i,a]=v.useState(),[s,o]=v.useState();v.useEffect(function(){var c=!1;function f(){return p.apply(this,arguments)}function p(){return p=PM(function*(){try{var m=yield t.getAuthConfigValues();c||a(new Map(m))}catch(b){c||o(b)}}),p.apply(this,arguments)}return f(),()=>{c=!0}},[t]);var l=v.useMemo(()=>{if(!(n==null||i==null))try{return Pm(n,i,_M)}catch(h){o(h)}},[i,n]),d=l==null||i==null;return d||s!=null?u.jsx(He,{isLoading:d&&s==null,errorMessage:Or(s)}):u.jsx(l,{authConfigValues:i,children:u.jsxs(u.Fragment,{children:[u.jsx(wM,{}),e]})})}function rc(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function ic(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){rc(a,n,i,s,o,"next",l)}function o(l){rc(a,n,i,s,o,"throw",l)}s(void 0)})}}var TM=B.module("@deephaven/app-utils.ConnectionBootstrap");function Om(r){var{children:e}=r,t=Ve(),n=Gn(),[i,a]=v.useState(),[s,o]=v.useState();v.useEffect(function(){var h=!1;function c(){return f.apply(this,arguments)}function f(){return f=ic(function*(){try{var p=yield n.getAsIdeConnection();if(h)return;o(p)}catch(m){if(h)return;a(m)}}),f.apply(this,arguments)}return c(),()=>{h=!0}},[t,n]),v.useEffect(function(){if(s==null)return;function h(f){var{detail:p}=f;TM.info("Shutdown","".concat(JSON.stringify(p))),a("Server shutdown: ".concat(p??"Unknown reason"))}var c=s.addEventListener(t.IdeConnection.EVENT_SHUTDOWN,h);return c},[t,s]);var l=v.useCallback(function(){var d=ic(function*(h){return z(s,"No connection available to fetch object with"),s.getObject(Mv(h))});return function(h){return d.apply(this,arguments)}}(),[s]);return s==null||i!=null?u.jsx(He,{"data-testid":"connection-bootstrap-loading",isLoading:s==null,errorMessage:i!=null?"".concat(i):void 0}):u.jsx(Kc.Provider,{value:s,children:u.jsx(Ko.Provider,{value:l,children:e})})}function OM(r){return new URL(r,"".concat(window.location))}function Dm(){var r=new URLSearchParams(window.location.search);return r.get("envoyPrefix")}function Im(){var r=Dm();return r!=null?{headers:{"envoy-prefix":r}}:{headers:{}}}function xm(r){var{children:e}=r,t=v.useContext(il);return t?u.jsx(u.Fragment,{children:e}):u.jsx(He,{"data-testid":"fonts-loaded-loading"})}function ac(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function DM(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){ac(a,n,i,s,o,"next",l)}function o(l){ac(a,n,i,s,o,"throw",l)}s(void 0)})}}var Nm=v.createContext(null);function IM(r){var{children:e}=r,t=Gn(),[n,i]=v.useState(),[a,s]=v.useState();v.useEffect(function(){var d=!1;function h(){return c.apply(this,arguments)}function c(){return c=DM(function*(){try{var f=yield t.getServerConfigValues();d||i(new Map(f))}catch(p){d||s(p)}}),c.apply(this,arguments)}return h(),()=>{d=!0}},[t]);var o=n==null;return o||a!=null?u.jsx(He,{isLoading:o&&a==null,errorMessage:Or(a)}):u.jsx(Nm.Provider,{value:n,children:e})}function Mm(){return Rr(Nm,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function xM(r){var{children:e}=r,t=Mm(),n=v.useContext(Uc),i=v.useContext(Aa),a=gf(t,n,i);return u.jsx($c.Provider,{value:a,children:e})}function Lm(r){var{children:e}=r,t=v.useContext(_i),n=v.useMemo(()=>t==null?null:of(t),[t]);return u.jsx(Ic,{themes:n,children:u.jsx(Sf,{children:u.jsx(KT,{children:u.jsx(zc,{children:e})})})})}function NM(r){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:n,serverUrl:i,children:a}=r,s=v.useMemo(()=>Im(),[]),[o,l]=v.useState(0),d=v.useCallback(()=>{},[]),h=v.useCallback(()=>{l(c=>c+1)},[]);return Va(d,h),u.jsx(Jv,{fontClassNames:e,children:u.jsx(_m,{getCorePlugins:n,pluginsUrl:t,children:u.jsx(Lm,{children:u.jsx(Dv,{serverUrl:i,options:s,children:u.jsx(qv,{children:u.jsx(Tm,{children:u.jsx(IM,{children:u.jsx(xM,{children:u.jsx(Om,{children:u.jsx(xm,{children:a})})})})})})},o)})})})}const $M=Object.freeze(Object.defineProperty({__proto__:null,AppBootstrap:NM,AuthBootstrap:Tm,ConnectionBootstrap:Om,ConnectionContext:Kc,FontBootstrap:Jv,FontsLoaded:xm,FontsLoadedContext:il,PluginsBootstrap:_m,RemoteComponent:yM,ThemeBootstrap:Lm,getAuthHandlers:wm,getAuthPluginComponent:Pm,getBaseUrl:OM,getConnectOptions:Im,getEnvoyPrefix:Dm,loadJson:ym,loadModulePlugin:Sm,loadModulePlugins:Em,useConnection:$C,useServerConfig:Mm,useUser:UC},Symbol.toStringTag,{value:"Module"}));export{lp as C,$M as i};
29
- //# sourceMappingURL=index-9d8fc0a6.js.map
28
+ This note can be edited using **markdown** for styling.`);const Fs=Ar;function pm(r){Kn(r);var{id:e,layout:t,panelManager:n,registerComponent:i}=r,a=c.useCallback(o=>{var{title:l,componentState:d,props:h}=o,{panelState:v=null}=h;return d!=null&&({panelState:v=null}=d),l==null||v==null||v.content==null||v.content.length===0||v.content===Fs.DEFAULT_CONTENT?null:za(o)},[]),s=c.useCallback(function(){var{title:o="",metadata:l={},id:d=ye.generate(),focusElement:h=A.DEFAULT_FOCUS_SELECTOR,createNewStack:v=!1,dragEvent:f=null}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=n.getOpenedPanelConfigsOfType(ir.COMPONENT),m=n.getClosedPanelConfigsOfType(ir.COMPONENT),b=p.map(E=>{var w;return(w=E.title)!==null&&w!==void 0?w:""}),g=o!=null&&o!==""?o:Fs.getNewMarkdownTitle(b),C=m.length>0?null:Fs.DEFAULT_CONTENT,y={type:"react-component",component:ir.COMPONENT,props:{id:d,metadata:l,panelState:{content:C},localDashboardId:e},title:g,id:d},{root:S}=t;A.openComponent({root:S,config:y,focusElement:h,createNewStack:v,dragEvent:f})},[e,t,n]);return c.useEffect(function(){var l=[i(ir.COMPONENT,ir,Ka,a)];return()=>{l.forEach(d=>d())}},[a,i]),ce(t.eventHub,Pp.OPEN,s),null}var VN={name:"MarkdownPlugin",type:nt.DASHBOARD_PLUGIN,component:pm};const BN=VN;function Yh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Xh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yh(Object(t),!0).forEach(function(n){WN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Yh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function WN(r,e,t){return e=GN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GN(r){var e=zN(r,"string");return typeof e=="symbol"?e:String(e)}function zN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Vl=c.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=im(n,t,i);return u.jsx(Jp,Xh(Xh({ref:e},r),a))});Vl.displayName="PandasPanelPlugin";const KN=Vl;function Zh(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function As(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Zh(a,n,i,s,o,"next",l)}function o(l){Zh(a,n,i,s,o,"throw",l)}s(void 0)})}}function mm(r){var e=Ve(),[t,n]=c.useState(),[i,a]=c.useState(!0),[s,o]=c.useState(!1),{fetch:l}=r,d=c.useCallback(As(function*(){var v=yield l();return Ra.makeModel(e,v)}),[e,l]),h=c.useCallback(As(function*(){a(!0);var v=yield d();n(v),a(!1)}),[d]);return c.useEffect(()=>{var v=!1;function f(){return p.apply(this,arguments)}function p(){return p=As(function*(){var m=yield d();v||(n(m),o(!0),a(!1))}),p.apply(this,arguments)}return f(),a(!0),()=>{v=!0}},[d]),u.jsxs(u.Fragment,{children:[u.jsx(He,{isLoaded:s,isLoading:i}),t&&u.jsx(Tr,{model:t,children:u.jsx(Qp,{onClick:h})})]})}var qN={name:"PandasPanel",title:"Pandas",type:nt.WIDGET_PLUGIN,component:mm,panelComponent:Vl,supportedTypes:"pandas.DataFrame",icon:gc};const YN=qN;function Qh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Zr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qh(Object(t),!0).forEach(function(n){XN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function XN(r,e,t){return e=ZN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ZN(r){var e=QN(r,"string");return typeof e=="symbol"?e:String(e)}function QN(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var JN=B.module("WidgetLoaderPlugin");function eM(r){var e;function t(n,i){var a,s=r.component,{metadata:o}=n,l=gl(s);return u.jsx(Fi,Zr(Zr({widgetName:(a=o==null?void 0:o.name)!==null&&a!==void 0?a:void 0,widgetType:r.title},n),{},{children:l?u.jsx(s,Zr(Zr({},n),{},{ref:i})):u.jsx(s,Zr({},n))}))}return t.displayName="WidgetLoaderPlugin(".concat((e=r.component.displayName)!==null&&e!==void 0?e:r.name,")"),c.forwardRef(t)}function gm(r){var e=Ba(),t=c.useMemo(()=>{var o=new Map;return e.forEach(l=>{Ti(l)&&[l.supportedTypes].flat().forEach(d=>{if(d!=null&&d!==""){if(o.has(d)){var h;JN.warn("Multiple WidgetPlugins handling type ".concat(d,". Replacing ").concat((h=o.get(d))===null||h===void 0?void 0:h.name," with ").concat(l.name," to handle ").concat(d))}o.set(d,l)}})}),o},[e]);Kn(r);var{id:n,layout:i,registerComponent:a}=r,s=c.useCallback(o=>{var l,{dragEvent:d,panelId:h=ye.generate(),fetch:v,widget:f}=o,{type:p}=f,m=p!=null?t.get(p):null;if(m!=null){var b=(l=f.name)!==null&&l!==void 0?l:p,g={localDashboardId:n,metadata:f,fetch:v},C={type:"react-component",component:m.name,props:g,title:b,id:h},{root:y}=i;A.openComponent({root:y,config:C,dragEvent:d})}},[n,i,t]);return c.useEffect(()=>{var o=[...new Set(t.values())].map(l=>{var{panelComponent:d}=l;return d==null?a(l.name,eM(l)):a(l.name,d)});return()=>{o.forEach(l=>l())}},[a,t]),ce(i.eventHub,te.OPEN,s),null}var tM={name:"WidgetLoaderPlugin",type:nt.DASHBOARD_PLUGIN,component:gm};const nM=tM;function fs(r,e,t){return e=rM(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rM(r){var e=iM(r,"string");return typeof e=="symbol"?e:String(e)}function iM(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ji{}fs(ji,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");fs(ji,"INPUT_FILTER","ControlType.INPUT_FILTER");fs(ji,"MARKDOWN","ControlType.MARKDOWN");fs(ji,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const aM=ji;var sM=_.shape({state:_.shape({panelState:_.shape({})})}),oM=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired,columnType:_.string.isRequired}),Jh=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired}),bm=_.shape({start:Jh,end:Jh,id:_.string,isReversed:_.bool}),lM=_.arrayOf(bm),dM=_.shape({name:_.string.isRequired,operateAs:_.string.isRequired,groups:_.arrayOf(_.string).isRequired,permissions:_.shape({canUsePanels:_.bool.isRequired,canCopy:_.bool.isRequired,canDownloadCsv:_.bool.isRequired,canLogout:_.bool.isRequired}).isRequired}),uM=Object.freeze({LinkPoint:oM,Link:bm,Links:lM,Panel:sM,User:dM});const hM=uM;var cM=(r,e)=>r[e]===null?null:_.bool,vM=(r,e)=>r[e]===null?null:_.string,fM=Object.freeze({nullableBoolean:cM,nullableString:vM});const pM=fM,mM=Object.freeze(Object.defineProperty({__proto__:null,ChartBuilderPlugin:tm,ChartBuilderPluginConfig:aN,ChartEvent:Ta,ChartPanel:Ai,ChartPanelPlugin:eN,ChartPluginConfig:rN,ChartWidgetPlugin:em,CommandHistoryPanel:Hp,CommonPropTypes:pM,ConsoleEvent:pt,ConsolePanel:oa,ConsolePlugin:uN,ControlType:aM,DropdownFilterPanel:Pn,FileExplorerPanel:Gp,FilterPlugin:nm,FilterPluginConfig:cN,FilterSetManager:zp,FilterSetManagerPanel:da,GridPanelPlugin:bN,GridPluginConfig:yN,GridWidgetPlugin:am,InputFilterEvent:Te,InputFilterPanel:Sr,IrisGridEvent:Et,IrisGridPanel:Mr,LinkerPlugin:vm,LinkerPluginConfig:$N,LinkerUtils:Fn,LogPanel:Yp,MarkdownEvent:Pp,MarkdownPanel:ir,MarkdownPlugin:pm,MarkdownPluginConfig:BN,MockFileStorage:qx,NotebookEvent:he,NotebookPanel:fn,PandasEvent:_D,PandasPanel:Jp,PandasPanelPlugin:KN,PandasPluginConfig:YN,PandasWidgetPlugin:mm,Panel:Wt,TabEvent:ri,ToolType:Nt,UIPropTypes:hM,WidgetLoaderPlugin:gm,WidgetLoaderPluginConfig:nM,WidgetPanel:Fi,WidgetPanelTooltip:Li,addDashboardLinks:Lp,deleteDashboardLinks:Fp,getColumnSelectionValidatorForDashboard:is,getColumnsForDashboard:xl,getDashboardConnection:VD,getDashboardConsoleSettings:HD,getDashboardSessionWrapper:Hr,getFilterSetsForDashboard:Mp,getInputFiltersForDashboard:ts,getIsolatedLinkerPanelIdForDashboard:rs,getLinksForDashboard:Zn,getTableMapForDashboard:ns,isChartPanelDehydratedProps:Up,isChartPanelFigureMetadata:Ml,isChartPanelTableMetadata:Cr,isGLChartPanelState:$p,isIrisGridPanelMetadata:qp,isLegacyIrisGridPanelMetadata:Kp,setDashboardColumnSelectionValidator:Ap,setDashboardConnection:BD,setDashboardConsoleSettings:Rp,setDashboardFilterSets:jp,setDashboardIsolatedLinkerPanelId:Nl,setDashboardLinks:as,setDashboardSessionWrapper:WD,useLoadTablePlugin:rm},Symbol.toStringTag,{value:"Module"}));var Cm={react:X,"react-dom":xa,redux:ag,"react-redux":sg,"@adobe/react-spectrum":og,"@deephaven/auth-plugins":Dw,"@deephaven/chart":Qw,"@deephaven/components":iE,"@deephaven/dashboard":TT,"@deephaven/dashboard-core-plugins":mM,"@deephaven/icons":fb,"@deephaven/iris-grid":cD,"@deephaven/jsapi-bootstrap":lE,"@deephaven/jsapi-components":QE,"@deephaven/jsapi-utils":yE,"@deephaven/log":B,"@deephaven/plugin":nw,"@deephaven/react-hooks":wS},gM=lg.createRequires(Cm),bM=dg({requires:gM});const CM=bM;function ec(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function Bl(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){ec(a,n,i,s,o,"next",l)}function o(l){ec(a,n,i,s,o,"throw",l)}s(void 0)})}}var gn=B.module("@deephaven/app-utils.PluginUtils");function Sm(r){return bo.apply(this,arguments)}function bo(){return bo=Bl(function*(r){var e=yield CM(r);return e}),bo.apply(this,arguments)}function ym(r){return Co.apply(this,arguments)}function Co(){return Co=Bl(function*(r){var e=yield fetch(r);if(!e.ok)throw new Error(e.statusText);try{return yield e.json()}catch{throw new Error("Could not be parsed as JSON")}}),Co.apply(this,arguments)}function Em(r){return So.apply(this,arguments)}function So(){return So=Bl(function*(r){gn.debug("Loading plugins...");try{var e=yield ym("".concat(r,"/manifest.json"));if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");gn.debug("Plugin manifest loaded:",e);for(var t=[],n=0;n<e.plugins.length;n+=1){var{name:i,main:a}=e.plugins[n],s="".concat(r,"/").concat(i,"/").concat(a);t.push(Sm(s))}for(var o=yield Promise.allSettled(t),l=new Map,d=0;d<o.length;d+=1){var h=o[d],{name:v}=e.plugins[d];if(h.status==="fulfilled"){var f,p=tf(h.value)?h.value:(f=h.value.default)!==null&&f!==void 0?f:h.value;p==null?gn.error("Plugin '".concat(v,"' is missing an exported value.")):l.set(v,p)}else gn.error("Unable to load plugin '".concat(v,"'"),h.reason)}return gn.info("Plugins loaded:",l),l}catch(m){return gn.error("Unable to load plugins:",m),new Map}}),So.apply(this,arguments)}function wm(r){var e,t;return(e=(t=r.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function Pm(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,n=wm(e),i=[...r.entries(),...t.entries()].filter(l=>{var[,d]=l;return rf(d)||ma(d)}).map(l=>{var[d,h]=l;return ma(h)?{type:nt.AUTH_PLUGIN,name:d,component:h.AuthPlugin.Component,isAvailable:h.AuthPlugin.isAvailable}:h}),a=i.filter(l=>{var{isAvailable:d}=l;return d(n,e)});if(a.length===0)throw new Error("No login plugins found, please register a login plugin for auth handlers: ".concat(n));a.length>1&&gn.warn("More than one login plugin available, will use the first one: ",a.map(l=>{var{name:d}=l;return d}).join(", "));var{name:s,component:o}=a[0];return gn.info("Using LoginPlugin",s),o}var SM=vc.createRequires(()=>Cm),yM=vc.createRemoteComponent({requires:SM});const EM=yM;function tc(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function wM(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){tc(a,n,i,s,o,"next",l)}function o(l){tc(a,n,i,s,o,"throw",l)}s(void 0)})}}function _m(r){var{pluginsUrl:e,getCorePlugins:t,children:n}=r,[i,a]=c.useState(null);return c.useEffect(function(){var o=!1;function l(){return d.apply(this,arguments)}function d(){return d=wM(function*(){var h,v=(h=yield t==null?void 0:t())!==null&&h!==void 0?h:[],f=yield Em(e);if(!o){var p=v.map(m=>[m.name,m]);a(new Map([...p,...f]))}}),d.apply(this,arguments)}return l(),()=>{o=!0}},[e,t]),u.jsx(_i.Provider,{value:i,children:n})}function PM(){var r=Jo();return c.useEffect(function(){r.postMessage(Yo(qo))},[r]),null}function nc(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function _M(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){nc(a,n,i,s,o,"next",l)}function o(l){nc(a,n,i,s,o,"throw",l)}s(void 0)})}}var TM=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:hf}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:pf}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:uf}]]);function Tm(r){var{children:e}=r,t=Gn(),n=c.useContext(_i),[i,a]=c.useState(),[s,o]=c.useState();c.useEffect(function(){var v=!1;function f(){return p.apply(this,arguments)}function p(){return p=_M(function*(){try{var m=yield t.getAuthConfigValues();v||a(new Map(m))}catch(b){v||o(b)}}),p.apply(this,arguments)}return f(),()=>{v=!0}},[t]);var l=c.useMemo(()=>{if(!(n==null||i==null))try{return Pm(n,i,TM)}catch(h){o(h)}},[i,n]),d=l==null||i==null;return d||s!=null?u.jsx(He,{isLoading:d&&s==null,errorMessage:Or(s)}):u.jsx(l,{authConfigValues:i,children:u.jsxs(u.Fragment,{children:[u.jsx(PM,{}),e]})})}function rc(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function ic(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){rc(a,n,i,s,o,"next",l)}function o(l){rc(a,n,i,s,o,"throw",l)}s(void 0)})}}var OM=B.module("@deephaven/app-utils.ConnectionBootstrap");function Om(r){var{children:e}=r,t=Ve(),n=Gn(),[i,a]=c.useState(),[s,o]=c.useState();c.useEffect(function(){var h=!1;function v(){return f.apply(this,arguments)}function f(){return f=ic(function*(){try{var p=yield n.getAsIdeConnection();if(h)return;o(p)}catch(m){if(h)return;a(m)}}),f.apply(this,arguments)}return v(),()=>{h=!0}},[t,n]),c.useEffect(function(){if(s==null)return;function h(f){var{detail:p}=f;OM.info("Shutdown","".concat(JSON.stringify(p))),a("Server shutdown: ".concat(p??"Unknown reason"))}var v=s.addEventListener(t.IdeConnection.EVENT_SHUTDOWN,h);return v},[t,s]);var l=c.useCallback(function(){var d=ic(function*(h){return z(s,"No connection available to fetch object with"),s.getObject(Mv(h))});return function(h){return d.apply(this,arguments)}}(),[s]);return s==null||i!=null?u.jsx(He,{"data-testid":"connection-bootstrap-loading",isLoading:s==null,errorMessage:i!=null?"".concat(i):void 0}):u.jsx(Kc.Provider,{value:s,children:u.jsx(Ko.Provider,{value:l,children:e})})}function DM(r){return new URL(r,"".concat(window.location))}function Dm(){var r=new URLSearchParams(window.location.search);return r.get("envoyPrefix")}function Im(){var r=Dm();return r!=null?{headers:{"envoy-prefix":r}}:{headers:{}}}function xm(r){var{children:e}=r,t=c.useContext(il);return t?u.jsx(u.Fragment,{children:e}):u.jsx(He,{"data-testid":"fonts-loaded-loading"})}function ac(r,e,t,n,i,a,s){try{var o=r[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(n,i)}function IM(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){ac(a,n,i,s,o,"next",l)}function o(l){ac(a,n,i,s,o,"throw",l)}s(void 0)})}}var Nm=c.createContext(null);function xM(r){var{children:e}=r,t=Gn(),[n,i]=c.useState(),[a,s]=c.useState();c.useEffect(function(){var d=!1;function h(){return v.apply(this,arguments)}function v(){return v=IM(function*(){try{var f=yield t.getServerConfigValues();d||i(new Map(f))}catch(p){d||s(p)}}),v.apply(this,arguments)}return h(),()=>{d=!0}},[t]);var o=n==null;return o||a!=null?u.jsx(He,{isLoading:o&&a==null,errorMessage:Or(a)}):u.jsx(Nm.Provider,{value:n,children:e})}function Mm(){return Rr(Nm,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function NM(r){var{children:e}=r,t=Mm(),n=c.useContext(Uc),i=c.useContext(Aa),a=gf(t,n,i);return u.jsx($c.Provider,{value:a,children:e})}function Lm(r){var{children:e}=r,t=c.useContext(_i),n=c.useMemo(()=>t==null?null:of(t),[t]);return u.jsx(Ic,{themes:n,children:u.jsx(Sf,{children:u.jsx(qT,{children:u.jsx(zc,{children:e})})})})}function MM(r){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:n,serverUrl:i,children:a}=r,s=c.useMemo(()=>Im(),[]),[o,l]=c.useState(0),d=c.useCallback(()=>{},[]),h=c.useCallback(()=>{l(v=>v+1)},[]);return Va(d,h),u.jsx(Jv,{fontClassNames:e,children:u.jsx(_m,{getCorePlugins:n,pluginsUrl:t,children:u.jsx(Lm,{children:u.jsx(Dv,{serverUrl:i,options:s,children:u.jsx(qv,{children:u.jsx(Tm,{children:u.jsx(xM,{children:u.jsx(NM,{children:u.jsx(Om,{children:u.jsx(xm,{children:a})})})})})})},o)})})})}const UM=Object.freeze(Object.defineProperty({__proto__:null,AppBootstrap:MM,AuthBootstrap:Tm,ConnectionBootstrap:Om,ConnectionContext:Kc,FontBootstrap:Jv,FontsLoaded:xm,FontsLoadedContext:il,PluginsBootstrap:_m,RemoteComponent:EM,ThemeBootstrap:Lm,getAuthHandlers:wm,getAuthPluginComponent:Pm,getBaseUrl:DM,getConnectOptions:Im,getEnvoyPrefix:Dm,loadJson:ym,loadModulePlugin:Sm,loadModulePlugins:Em,useConnection:$C,useServerConfig:Mm,useUser:UC},Symbol.toStringTag,{value:"Module"}));export{lp as C,UM as i};
29
+ //# sourceMappingURL=index-29f56064.js.map