@deephaven/embed-grid 0.61.1-beta.0 → 0.61.2-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.
- package/build/assets/{App-d4a03667.js → App-c76250d5.js} +2 -2
- package/build/assets/App-c76250d5.js.map +1 -0
- package/build/assets/index-7bc179e3.js +29 -0
- package/build/assets/index-7bc179e3.js.map +1 -0
- package/build/assets/{index-7896b6e7.css → index-96209982.css} +1 -1
- package/build/assets/{index-b135f9f1.js → index-e703c935.js} +4 -4
- package/build/assets/{index-b135f9f1.js.map → index-e703c935.js.map} +1 -1
- package/build/assets/plotly-33051b85.js +7 -0
- package/build/assets/{plotly-bfbd68da.js.map → plotly-33051b85.js.map} +1 -1
- package/build/assets/{useUser-5049b1d1.js → useUser-8a9c44b4.js} +9 -9
- package/build/assets/useUser-8a9c44b4.js.map +1 -0
- package/build/assets/useUser-fcab45cc.css +1 -0
- package/build/index.html +2 -2
- package/package.json +14 -14
- package/build/assets/App-d4a03667.js.map +0 -1
- package/build/assets/index-8d807e7f.js +0 -29
- package/build/assets/index-8d807e7f.js.map +0 -1
- package/build/assets/plotly-bfbd68da.js +0 -7
- package/build/assets/useUser-5049b1d1.js.map +0 -1
- package/build/assets/useUser-786f3162.css +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{C as u,$ as Im,H as lc,I as Po,F as ne,J as dc,r as v,K as Le,L as Ee,M as Nm,N as uc,O as Mm,P as hc,Q as Lm,S as Fm,T as Kl,U as ot,G as X,E as Y,V as _,W as Am,D as Hn,X as ar,Y as Rm,Z as jm,_ as km,a0 as $m,a1 as cc,a2 as Um,a3 as Hm,a4 as yr,a5 as vc,a6 as Mt,a7 as se,a8 as Z,R as Ma,a9 as ql,aa as Vm,ab as _o,ac as Bm,ad as Wm,ae as Gm,af as zm,ag as mi,ah as fc,ai as gi,aj as Km,ak as ii,al as Pt,am as pc,an as qm,ao as Ym,ap as Xm,aq as Zm,ar as Qm,as as Jm,at as mc}from"./vendor-70ada314.js";import{L as B,i as eg,v as Wn,M as bi,b as Ci,c as La,d as hr,e as tg,a as tt,f as To,g as ng,h as rg,r as Oo,j as G,k as ig,l as ag,m as sg,T as Vn,C as og,D as lg,n as dg,o as ug,p as hg,q as Fa,N as cg,S as vg,s as fg,t as pg,W as mg,u as gg,w as bg,x as Cg,y as Sg,z as yg,A as Eg,B as gc,E as bc,F as wg,G as Pg,H as _g,I as Tg,J as Og,K as Dg,O as xg,P as Ig,Q as Aa,R as Ng,U as Cc,V as Yl,X as Mg,Y as Lg,Z as Fg,_ as Sc,$ as Do,a0 as xo,a1 as sr,a2 as Ag,a3 as Xl,a4 as Rg,a5 as jg,a6 as kg,a7 as $g,a8 as Io,a9 as yc,aa as $s,ab as Ug,ac as Hg,ad as Zl,ae as ha,af as Ql,ag as Ec,ah as Vg,ai as Ra,aj as Bg,ak as Wg,al as Gg,am as zg,an as Kg,ao as qg,ap as Yg,aq as wc,ar as Xg,as as Pc,at as _c,au as Jl,av as Zg,aw as Qg,ax as Jg,ay as eb,az as tb,aA as nb,aB as rb,aC as ib}from"./index-e703c935.js";import{T as wt,g as ab,c as Ar,d as sb,e as ob,h as Tc,P as Si,B as K,i as cr,M as No,D as Oc,j as En,k as lb,S as yi,R as ca,l as Er,m as va,n as ae,o as Us,p as Rr,q as db,r as ub,s as hb,C as Dc,t as Mo,v as cb,w as vb,G as wr,x as fb,K as fe,y as pe,z as pb,A as mb,O as gb,E as bb,F as xc,H as Hs,J as Bn,L as Ic,N as Cb,Q as Ke,U as Sb,V as yb,W as Nc,X as Mc,Y as Eb,Z as wb,_ as Pb,$ as He,a0 as _b,a1 as Tb,a2 as Ob,a3 as Lo,a4 as Fo,a5 as Db,a6 as xb,a7 as Ib,a8 as Pr,a9 as wn,aa as Nb,ab as Mb,ac as Lb,ad as Ie,ae as Fb,af as Ao,ag as Ab,ah as Lc,ai as Fc,aj as Ro,ak as jo,al as Ac,am as Rc,an as jc,f as Rb,ao as kc,ap as jb,aq as kb,ar as ko,as as fa,at as $b,au as $c,av as ye,aw as Ub,ax as Hb,ay as Vb,az as Uc,aA as ja,aB as Hc,aC as Vc,aD as vt,aE as Bb,aF as Ot,aG as Bc,aH as Tn,aI as Wc,aJ as Gc,aK as Wb,aL as Gb,I as _r,aM as zc,aN as zb,aO as Kb,aP as qb,aQ as Yb,aR as Xb,aS as Zb,aT as Qb,aU as Jb,aV as eC,aW as tC,aX as nC,aY as rC,aZ as iC,a_ as aC,a$ as Yt,b as ka,b0 as sC,b1 as oC,b2 as Kc,b3 as lC,b4 as dC,b5 as qc,b6 as uC,b7 as Xe,b8 as hC,b9 as cC,ba as vC,bb as fC,bc as pC,bd as mC,be as gC,bf as bC,bg as CC,bh as SC,bi as aa,bj as yC,bk as EC,bl as wC,bm as PC,bn as ai,bo as _C,bp as TC,bq as OC,br as Zr,bs as DC}from"./useUser-8a9c44b4.js";import{u as qM,a as YM}from"./useUser-8a9c44b4.js";import{c as bs,P as $o,b as xC,h as IC,p as NC,o as MC,s as LC,t as FC}from"./plotly-33051b85.js";import{e as Uo,l as ki,K as si,a as Yc}from"./monaco-0b69f16f.js";import"./helpers-de833af9.js";function Tr(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,AC=32,RC=33,jC=150,Vs=200,Zc=500,Qc=250,kC={spellCheck:!1},$C=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange","tooltip"];function ed(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 td(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ed(Object(t),!0).forEach(function(n){UC(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ed(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function UC(r,e,t){return e=HC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function HC(r){var e=VC(r,"string");return typeof e=="symbol"?e:String(e)}function VC(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 BC(r,e){if(r==null)return{};var t=WC(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 WC(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=BC(r,$C),d=i==null&&o!=null?"action-button-icon-with-tooltip":void 0;return u.jsxs(Im,{type:"popover",onOpenChange:s,children:[u.jsxs(lc,td(td({},l),{},{"aria-label":e??i,isQuiet:n,children:[u.jsx(Po,{UNSAFE_className:d,children:u.jsx(ne,{icon:t})}),i==null?null:u.jsx(dc,{children:i}),o==null?null:u.jsx(wt,{children:o})]})),a]})}function GC(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([...ab(0,e-1)].filter(i=>!r.has(String(i))).map(i=>String(i)))),{selection:n,isInverted:t}}function zC(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 KC(r){var e=r==null?void 0:r.UNSAFE_getDOMNode().lastElementChild;return av(e)}function qC(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 Ho(){var r=v.useRef(!1);return v.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),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 YC(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)})}}var XC=B.module("useAsyncInterval");function sv(r,e){var t=Ho(),n=v.useRef(0),i=v.useRef(0),a=v.useRef(null),s=v.useCallback(YC(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){XC.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 ZC(r,e){return v.useCallback(function(){var t=r(...arguments);return e(),t},[e,r])}function pa(r,e){var t=v.useMemo(()=>Le(r,e),[r,e]);return v.useEffect(()=>()=>t.cancel(),[t]),t}function QC(r){var[e,t]=v.useState(r);return v.useEffect(()=>{t(r)},[r]),[e,t]}function JC(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 eS(r){r.preventDefault()}function lv(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=v.useMemo(()=>"useSubmitButtonRef-".concat(Ee()),[]),t=v.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),n=v.useMemo(()=>({id:e,onSubmit:r?void 0:eS}),[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 tS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eg,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 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 nS(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 rS(r,e,t){var n=v.useRef(null),[i,a]=v.useState(null),s=v.useCallback(nS(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 id(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 iS(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){id(a,n,i,s,o,"next",l)}function o(l){id(a,n,i,s,o,"throw",l)}s(void 0)})}}function ui(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(iS(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 ad(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 sd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ad(Object(t),!0).forEach(function(n){aS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ad(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function aS(r,e,t){return e=sS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sS(r){var e=oS(r,"string");return typeof e=="symbol"?e:String(e)}function oS(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 lS(r,e,t,n){var i=arguments.length===4;return v.useCallback(a=>{var s=i?a??n:a;t(sd(sd({},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 Ei(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 dS(r){var e=cv(kC,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((w,E)=>w-E);var S=[];e.forEach((w,E)=>{if(b[0]===E){var x=g.get(b.shift()),D=m.get(x);S.push(D)}else S.push(w)}),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 Vo(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 uS=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:zC,defaultGetKey:fv,extractSpectrumHTMLElement:iv,extractSpectrumLastChildHTMLElement:KC,findSpectrumComboBoxScrollArea:qC,getSelectedItemCountOrAll:GC,identityExtractHTMLElement:av,isSelectionEqual:ev,isSelectionMaybeInvertedEqual:tv,mapSelection:nv,optimizeSelection:rv,useAsyncInterval:sv,useCallbackWithAction:ZC,useContextOrThrow:Ar,useCopyToClipboard:sb,useDebouncedCallback:pa,useDebouncedValue:Ei,useDependentState:QC,useEffectNTimesWhen:JC,useFormWithDetachedSubmitButton:lv,useForwardedRef:ob,useIsEqualMemo:ov,useIsMountedRef:Ho,useMappedRef:dv,useMappedSelection:uv,useOnScrollOffsetChangeCallback:hv,useOnScrollRef:tS,usePopoverOnScrollRef:rS,usePrevious:Tc,usePromiseFactory:ui,usePropChangeCallback:lS,useResizeObserver:Vo,useSetAttributesCallback:cv,useSpectrumDisableSpellcheckRef:dS,useWindowedListData:vv},Symbol.toStringTag,{value:"Module"})),hS="_spectrumActionBar_tmmkp_5",cS="_spectrumDialogComponentHeading_tmmkp_9",vS="_spectrumEllipsis_tmmkp_14",Bo={spectrumActionBar:hS,spectrumDialogComponentHeading:cS,spectrumEllipsis:vS};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 $i(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){fS(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 fS(r,e,t){return e=pS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pS(r){var e=mS(r,"string");return typeof e=="symbol"?e:String(e)}function mS(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(Nm,{children:[u.jsx(uc,{level:3,UNSAFE_className:Bo.spectrumDialogComponentHeading,children:e}),u.jsx(Mm,{}),u.jsx(hc,{children:u.jsx(Lm,$i($i({},s),{},{children:n}))}),u.jsxs(Fm,{children:[u.jsx(Kl,{variant:"secondary",onPress:i,children:"Cancel"}),u.jsx(Kl,$i($i({},o),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function gS(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 bS=["icon","label","tooltip"];function ld(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 dd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ld(Object(t),!0).forEach(function(n){CS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ld(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function CS(r,e,t){return e=SS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function SS(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)}function ES(r,e){if(r==null)return{};var t=wS(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 wS(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=ES(r,bS);return u.jsxs(lc,dd(dd({},i),{},{"aria-label":t,isQuiet:!0,height:Xc,children:[u.jsx(Po,{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 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 PS(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){Qt(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 Qt(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=TS(r,"string");return typeof e=="symbol"?e:String(e)}function TS(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 OS=100,Bs;(function(r){r.UP="UP",r.DOWN="DOWN"})(Bs||(Bs={}));class It 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=PS({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,OS),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(It.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(It.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(It.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(It.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===It.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===It.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(Si,{ref:this.popper,options:h,className:Y("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}Qt(It,"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(It,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});Qt(It,"MENU_NAVIGATION_DIRECTION",Bs);const DS=It;function Wo(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(D){return D.trim().split(o).filter(T=>T).join(`
|
|
2
|
+
`.concat(o.trim()))}function g(D){return D.split(`
|
|
3
|
+
`).map(T=>T.trim()).join(" ")}function C(){if(m.current){m.current.style.height="0";var D=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);D>0&&(m.current.style.height="".concat(D,"px"))}}function y(D){var T=D.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 w(){m.current&&document.activeElement!==m.current&&m.current.focus()}function E(){o&&(c(g(h)),n(g(h)))}function x(){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:w,onBlur:E,onPaste:x,spellCheck:i,disabled:s,"data-testid":d})}Wo.propTypes={value:_.string.isRequired,onChange:_.func.isRequired,className:_.string,placeholder:_.string,spellCheck:_.bool,disabled:_.bool,delimiter:_.string,id:_.string,"data-testid":_.string};Wo.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function wi(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})}wi.displayName="ButtonGroup";wi.propTypes={children:_.node.isRequired,className:_.string,style:_.object,"data-testid":_.string};wi.defaultProps={className:null,style:{},"data-testid":void 0};function xS(r){var{blockInteraction:e=!0,children:t,debounceMs:n,isOpen:i=!1}=r,{value:a}=Ei(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 IS(r){var{className:e,icon:t,isOpen:n=!1,subtitle:i,title:a}=r;return u.jsx(bi,{isOpen:n,className:e,children:u.jsx(Ci,{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 $a(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(bi,{isOpen:e,onOpened:C,children:[u.jsx(La,{closeButton:!1,children:t}),u.jsx(Ci,{children:y}),u.jsxs($a,{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(wi,{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 Ua=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})});Ua.displayName="Button";Ua.propTypes={children:_.node,className:_.string,disabled:_.bool,onClick:_.func,style:_.shape({}),id:_.string};Ua.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Ws=Ua;function hd(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 cd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hd(Object(t),!0).forEach(function(n){NS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hd(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){var{styleProps:e,selectedItemCount:t,onClearSelection:n}=r;return u.jsx(Am,cd(cd({UNSAFE_className:Bo.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:n}))}function Ha(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=AS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function AS(r){var e=RS(r,"string");return typeof e=="symbol"?e:String(e)}function RS(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 jS=Ut;var kS=B.module("TimeInput"),$S="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",US=["00:00:00","12:34:56","23:59:59"];function vd(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(cr.formatTime(a)),f=v.useRef(a),[p,m]=v.useState(),b=v.useRef(null);v.useImperativeHandle(e,()=>({focus:()=>{var E;(E=b.current)===null||E===void 0||E.focus()},setSelection:E=>{var x;(x=b.current)===null||x===void 0||x.focus(),m(E)}}),[]),v.useEffect(function(){f.current!==a&&(c(cr.formatTime(a)),f.current=a)},[f,a]);function g(E,x,D){var T=E.selectionStart===0?24:60,I=parseInt(D,10)-x;return Number.isNaN(I)?I=0:t?I=(I%T+T)%T:I=Math.min(Math.max(0,I),T-1),"".concat(I).padStart(2,"0")}function C(E,x,D,T,I){return T===0&&I===2&&x===1&&parseInt(D,10)>1?"0".concat(D).concat(E.substring(2)):Oc(E,x,D)}var y=v.useCallback(E=>{kS.debug("handleChange",E),c(E),f.current=cr.parseTime(vd(E)),i(f.current)},[i]),S=v.useCallback(()=>{var E=vd(h);E!==h&&c(E),o()},[h,o]),w=v.useCallback(E=>{m(E),l(E)},[l]);return u.jsx(No,{ref:b,className:n,example:US,getNextSegmentValue:g,getPreferredReplacementString:C,onChange:y,onSelect:w,pattern:$S,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 ma=bv;function fd(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 HS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fd(Object(t),!0).forEach(function(n){Sn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Sn(r,e,t){return e=VS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function VS(r){var e=BS(r,"string");return typeof e=="symbol"?e:String(e)}function BS(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 pd=-1,Gs;(function(r){r.UP="UP",r.DOWN="DOWN"})(Gs||(Gs={}));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 cr.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===pd){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:pd,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(ma,{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=HS({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",Gs);Sn(ut,"DROP_DOWN_MENU_HEIGHT",125);Sn(ut,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:hr,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 WS=ut;var GS=B.module("DateInput"),zS="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",KS=["2000-01-01","2022-12-31"],qS="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=>{GS.debug("handleChange",p),d(p),n(p)},[n]);return u.jsx("div",{className:"d-flex flex-row align-items-center",children:u.jsx(No,{ref:e,className:Y(t),example:KS,getNextSegmentValue:lb,onChange:f,onSelect:c,pattern:zS,placeholder:qS,selection:h,value:l,onFocus:a,onBlur:s,"data-testid":o})})});Cv.displayName="DateInput";const YS=Cv;function Sv(r,e,t){return e=XS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XS(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)}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(yi,{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 QS(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(ca.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:w}=S.target;c(w),o(w===""?null:a(w))},[a]),g=v.useCallback(()=>{d([])},[]),C=v.useCallback(S=>{S.key==="Enter"&&m()},[m]),y=v.useMemo(()=>14+ar(t.length,1,6)*Er.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(Er,{itemCount:t.length,items:t.map((S,w)=>({value:S,isSelected:ca.isSelected(l,w)})),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:tg,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 JS=B.module("ErrorBoundary");class ey 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;JS.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(tt,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function ty(r,e,t){return e=ny(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ny(r){var e=ry(r,"string");return typeof e=="symbol"?e:String(e)}function ry(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 vr 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=vr.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=vr.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(va,{className:"hcm-parent",checked:vr.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(va,{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(Si,{options:{placement:"bottom"},isShown:s,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}ty(vr,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const iy=vr;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 Cs(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){ay(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 ay(r,e,t){return e=sy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sy(r){var e=oy(r,"string");return typeof e=="symbol"?e:String(e)}function oy(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(Rm,{draggableId:d,index:s,isDragDisabled:!o,children:(f,p)=>u.jsxs("div",{className:"context-menu-wrapper",ref:i?a:null,children:[u.jsxs("div",Cs(Cs(Cs({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:To,tooltip:"Close"})]})),u.jsx(ae,{actions:l})]})},d)});wv.displayName="NavTab";const ly=wv;function gd(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 bd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gd(Object(t),!0).forEach(function(n){dy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function dy(r,e,t){return e=uy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uy(r){var e=hy(r,"string");return typeof e=="symbol"?e:String(e)}function hy(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 cy=500,vy=.01,fy=5e-4;function Cd(r){return r.scrollLeft===0}function Sd(r){return r.scrollLeft+r.clientWidth===r.scrollWidth||r.scrollWidth===0}function py(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 my(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(Cd(o.current)),p(Sd(o.current)))},[t]);Vo(o.current,m);var b=v.useCallback(O=>{Us.stopDragging(),O.destination&&(i==null||i(O.source.index,O.destination.index))},[i]),g=v.useCallback(()=>{if(o.current!=null){var O=Cd(o.current);O!==h&&c(O);var M=Sd(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:O}=o.current,M=O.length-1;M>=0;M-=1){var A=O[M];if(A.offsetLeft<o.current.scrollLeft-5){A.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"});return}}},[]),S=v.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:O}=o.current,M=0;M<O.length;M+=1){var A=O[M];if(A.offsetLeft+5>o.current.scrollLeft+o.current.offsetWidth){A.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"});return}}},[]),w=v.useCallback(function(O,M){var A=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,O==="left"?H.scrollLeft=M-A:O==="right"&&(H.scrollLeft=M+A),C.current.rAF=requestAnimationFrame(q=>{var re=k??q,V=q-re,N=vy*V+.5*fy*V**2;N=Math.min(N,H.scrollWidth),w(O,M,N,re)}))},[]),E=v.useCallback(()=>{var{holdTimer:O,rAF:M}=C.current;O!=null&&(clearTimeout(O),C.current.holdTimer=void 0),M!=null&&(cancelAnimationFrame(M),C.current.rAF=void 0),window.removeEventListener("mouseup",E)},[]);v.useEffect(()=>()=>window.removeEventListener("mouseup",E),[E]);var x=v.useCallback(O=>{o.current!=null&&(C.current.holdTimer=window.setTimeout(w,cy,O,o.current.scrollLeft)),C.current.cancelClick=!1,window.addEventListener("mouseup",E)},[E,w]),D=v.useCallback(()=>{x("left")},[x]),T=v.useCallback(()=>{x("right")},[x]);v.useEffect(function(){var M,A=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",A),()=>{var k;(k=o.current)===null||k===void 0||k.removeEventListener("wheel",A)}},[]);var I=v.useMemo(()=>{var O=new Map;return t.forEach(M=>{var{key:A}=M,k=[()=>py(M,t,a),()=>{var H;return(H=s==null?void 0:s(M))!==null&&H!==void 0?H:[]}];O.set(A,k)}),O},[s,t,a]),j=v.useRef(null),W=t.find(O=>O.key===e),L=t.map((O,M)=>{var{key:A}=O,k=O===W;return u.jsx(ly,{tab:O,index:M,isActive:k,activeRef:j,onSelect:n,onClose:a,isDraggable:i!=null,contextActions:I.get(A)},A)});return v.useEffect(function(){j.current!=null&&j.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:ng,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-left",tooltip:"Scroll left",onClick:y,onMouseDown:D,disabled:h}),u.jsx(jm,{onDragStart:Us.startDragging,onDragEnd:b,children:u.jsx(km,{droppableId:"droppable-tab-navigation",direction:"horizontal",children:(O,M)=>u.jsxs("div",bd(bd({ref:A=>{A!=null&&(o.current=A,O.innerRef(A))}},O.droppableProps),{},{className:Y("nav nav-tabs",{dragging:M.draggingFromThisWith}),role:"tablist",onScroll:g,children:[L,O.placeholder]}))})}),l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:rg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-right",tooltip:"Scroll right",onClick:S,onMouseDown:T,disabled:f})]})}function gy(){var{selectedThemeKey:r,setSelectedThemeKey:e,themes:t}=Rr(),n=v.useCallback(i=>{e(i)},[e]);return u.jsx($m,{label:"Pick a color scheme",items:t,selectedKey:r,onSelectionChange:n,children:i=>u.jsx(cc,{children:i.name},i.themeKey)})}function by(r){var{className:e,style:t}=r;return u.jsx("div",{className:Y("dh-logo",e),style:t})}var Cy=.025,Sy=.9,yy=.1,Ey=.618,yd=80,Jn={SIZE:8,DOT_SIZE:2},sn=18,wy=250,Py=60*1e3,_y={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 Ty(){return Oo(_y)}var Oy=X.memo(()=>{var{activeThemes:r}=Rr(),e=v.useMemo(Ty,[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:O}=e,M=document.createElement("canvas");M.width=Jn.SIZE,M.height=Jn.SIZE;var A=M.getContext("2d");return A!=null&&(A.fillStyle=O,A.fillRect(0,0,Jn.DOT_SIZE,Jn.DOT_SIZE),A.fillStyle=L,A.fillRect(0,0,Jn.SIZE,Jn.SIZE)),A==null?void 0:A.createPattern(M,"repeat")}function g(L){var O=Math.random()-.5,M=Cy*O;return L<yy?M=Math.abs(M):L>Sy&&(M=-Math.abs(M)),L+M}function C(){for(var L=[],O=Ey,M=0;M<d+sn;M+=1)O=g(O),L.push(O);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,O){O.beginPath(),O.moveTo(-1,h+1),O.lineTo(-1,h*L[0]);for(var M=0;M<L.length;M+=1)O.lineTo(M,h*L[M]);O.lineTo(d+sn,h*L[L.length-1]),O.lineTo(d+sn,h+1),O.closePath()}function w(L){L.beginPath();for(var O=1;O<d;O+=yd)L.moveTo(O,0),L.lineTo(O,h);for(var M=1;M<h;M+=yd)L.moveTo(0,M),L.lineTo(d,M)}function E(L){var O,M,A;f=(O=f)!==null&&O!==void 0?O:L;var{background:k,foregroundStroke:H,gridColor:q}=e;G(o),o.fillStyle=k,o.fillRect(0,0,d,h),w(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)-((A=f)!==null&&A!==void 0?A:0)>1e3/sn){for(var V,N=Math.floor(((L??0)-((V=f)!==null&&V!==void 0?V:0))/(1e3/sn)),P=0;P<N;P+=1)p.shift(),p.push(g(p[p.length-1]));f=L}c!=null&&cancelAnimationFrame(c),c=requestAnimationFrame(E)}var x=Le(()=>{c=requestAnimationFrame(L=>{m(),y(),a(!1),E(L)})},wy,{leading:!0});function D(){a(!0),c!=null&&cancelAnimationFrame(c),c=null,f=null}var T=Le(()=>{D()},Py);function I(){c==null&&(a(!1),m(),y(),c=requestAnimationFrame(E)),T()}function j(){document.hasFocus()&&I()}function W(){c!=null&&cancelAnimationFrame(c),T(),x()}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(),E(),T(),window.addEventListener("resize",W),window.addEventListener("focus",I),window.addEventListener("blur",D),window.addEventListener("mousemove",j),window.addEventListener("keydown",j),()=>{c!=null&&cancelAnimationFrame(c),window.removeEventListener("resize",W),window.removeEventListener("focus",I),window.removeEventListener("blur",D),window.removeEventListener("mousemove",j),window.removeEventListener("keydown",j),T.cancel(),x.cancel()}},[e]),u.jsx("div",{className:"random-area-plot-animation-container",ref:n,children:u.jsx("canvas",{ref:t,className:i?"shade":""})})});const Pv=Oy;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(dc,{UNSAFE_className:Bo.spectrumEllipsis,children:e??u.jsx(u.Fragment,{children:" "})}),e==null||e===""?null:u.jsx(wt,{options:n,children:e})]})}var Dy=["scrollRef","getItemDisplayText","getKey"];function Ed(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 wd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ed(Object(t),!0).forEach(function(n){xy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ed(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xy(r,e,t){return e=Iy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Iy(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)}function My(r,e){if(r==null)return{};var t=Ly(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 Ly(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 Fy(r){var{scrollRef:e,getItemDisplayText:t,getKey:n}=r,i=My(r,Dy),a=v.useCallback(s=>{var o=n(s),l=t(s);return u.jsx(cc,{textValue:l??String(o),children:u.jsx(_v,{text:l})},o)},[t,n]);return u.jsx(Um,wd(wd({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var Go=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:ig,className:"linked btn-socketed-icon",transform:"down-1"}),u.jsx(ne,{icon:ag,className:"is-invalid btn-socketed-icon"})]})});Go.displayName="SocketedButton";Go.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 zo=Go;var Ay=500;function Ry(r){var{heading:e,content:t,delayMs:n=Ay}=r,[i,a]=v.useState(!1);return v.useEffect(()=>{window.setTimeout(()=>{a(!0)},n)},[n]),i?u.jsxs(Hm,{children:[u.jsx(Po,{size:"XXL",children:u.jsx(ne,{icon:sg})}),u.jsx(uc,{children:e}),t==null?null:u.jsx(hc,{children:t})]}):null}const jy="_modified_5rbci_24",ky="_track_5rbci_35",$y="_handle_5rbci_15",Uy="_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:jy,"flex-spacer":"_flex-spacer_5rbci_31",track:ky,"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:$y,ticks:Uy,"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),Pd=parseInt(Tv["popover-width"],10),ft=24*60*60-1,_d=5*60;function Hy(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(Vy,{startTime:o,endTime:d,onStartTimeChange:p,onEndTimeChange:m,isStartModified:i,isEndModified:a}),u.jsxs("div",{className:"track",ref:c,children:[u.jsx(By,{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(Td,{track:c,time:o,setTime:p}),u.jsx(Td,{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 Vy(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 x;(x=m.current)===null||x===void 0||x.setSelection(b.current)}if(g.current!==null){var D;(D=p.current)===null||D===void 0||D.setSelection(g.current)}},[l]);function C(E){e<=t?n(E):i(E)}function y(E){e<=t?i(E):n(E)}var S=v.useCallback(E=>{b.current=E,g.current=null},[]),w=v.useCallback(E=>{b.current=null,g.current=E},[]);return u.jsxs("div",{className:"time-slider-popovers",children:[u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(d/ft*100,"% - ").concat(Pd/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(ma,{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(ma,{ref:m,allowValueWrapping:!1,value:c,onChange:y,onSelect:w,"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(Pd/2,"px)")}})]})}function By(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 Td(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=_d*Math.round(b/_d),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:To,tooltip:"Close notification",className:"my-2",onClick:o})]})})}Ov.TYPE=Object.freeze({ERROR:"error"});function Wy(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??Ee());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 Gy=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:Jc,AutoCompleteInput:DS,AutoResizeTextarea:Wo,BasicModal:_n,BulkActionBar:FS,Button:K,ButtonGroup:wi,ButtonOld:Ws,CSS_VAR_EXPRESSION_PREFIX:og,CardFlip:Ha,Checkbox:va,Collapse:jS,ComboBox:db,ConfirmActionButton:gS,ConfirmationDialog:pv,ContextActionUtils:ub,ContextActions:ae,ContextMenuItem:hb,ContextMenuRoot:Dc,CopyButton:Mo,CustomTimeSelect:WS,DEFAULT_DARK_THEME_KEY:lg,DEFAULT_DARK_THEME_PALETTE:dg,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:Oc,DEFAULT_LIGHT_THEME_KEY:ug,DEFAULT_PRELOAD_DATA_VARIABLES:hg,DateInput:YS,DateTimeInput:cb,DebouncedModal:xS,DebouncedSearchInput:Ev,DragUtils:Us,DraggableItemList:vb,DropdownMenu:En,EditableItemList:QS,ErrorBoundary:ey,GLOBAL_SHORTCUTS:wr,HierarchicalCheckboxMenu:iy,IconActionButton:mv,InfoModal:IS,ItemList:Er,ItemListItem:fb,get KEY(){return fe},LoadingOverlay:tt,LoadingSpinner:Fa,Logo:by,get MODIFIER(){return pe},MaskedInput:No,Menu:pb,MenuItem:mb,Modal:bi,ModalBody:Ci,ModalFooter:$a,ModalHeader:La,NON_WHITESPACE_REGEX:cg,NavTabList:my,Option:gb,Page:bb,Popper:Si,RadioGroup:xc,RadioItem:Hs,RandomAreaPlotAnimation:Pv,SVG_ICON_MANUAL_COLOR_MAP:vg,SearchInput:yi,SearchableCombobox:Fy,Select:Bn,SelectValueList:Ic,Shortcut:Cb,ShortcutRegistry:Ke,SocketedButton:zo,Stack:Sb,THEME_CACHE_LOCAL_STORAGE_KEY:fg,TMP_CSS_PROP_PREFIX:pg,TableViewEmptyState:Ry,TextWithTooltip:_v,ThemeContext:yb,ThemeExport:Vn,ThemePicker:gy,ThemeProvider:Nc,TimeInput:ma,TimeSlider:Hy,ToastNotification:Ov,Tooltip:wt,UISwitch:Mc,ValidateLabelInput:Wy,WHITESPACE_REGEX:mg,calculatePreloadStyleContent:gg,createCssVariableResolver:bg,createPreloadStyleElement:Cg,extractDistinctCssVariableExpressions:Sg,fillToLength:Eb,getActiveThemes:yg,getDefaultBaseThemes:Eg,getExpressionRanges:gc,getThemeKey:bc,getThemePreloadData:wg,overrideSVGFillColors:Pg,preloadTheme:_g,replaceSVGFillColor:Tg,resolveCssVariablesInRecord:Oo,resolveCssVariablesInString:Og,setThemePreloadData:Dg,themeDHDefault:wb,themeDark:xg,themeLight:Ig,trimTrailingMask:Pb,useTheme:Rr},Symbol.toStringTag,{value:"Module"}));function zy(r,e){var t=He(),n=v.useMemo(()=>new t.CoreClient(r,e),[t,r,e]);return v.useEffect(()=>()=>{n.disconnect()},[n]),n}var Ko=v.createContext(null);function Dv(r){var{serverUrl:e,options:t,children:n}=r,i=zy(e,t);return u.jsx(Ko.Provider,{value:i,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 Ky(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 xv=v.createContext(null);function Iv(r){var[e,t]=v.useState(null),[n,i]=v.useState(null),a=v.useContext(xv),s=v.useContext(Aa);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=Ky(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]=Iv(n);return a!=null?(t==null||t(a),null):i==null?null:u.jsx(Aa.Provider,{value:i,children:e})});Nv.displayName="DeferredApiBootstrap";function Gn(){return Ar(Ko,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}function qo(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function Yo(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function qy(r){return qo(r)||Yo(r)}var Xo=v.createContext(null);function Mv(r){if(Yo(r))return{id:r.id,type:r.type};if(qo(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 Ar(Xo,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}const Yy=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Ng,ApiContext:Aa,ClientBootstrap:Dv,ClientContext:Ko,DeferredApiBootstrap:Nv,DeferredApiContext:xv,ObjectFetcherContext:Xo,getVariableDescriptor:Lv,isIdVariableDescriptor:Yo,isNameVariableDescriptor:qo,isVariableDescriptor:qy,sanitizeVariableDescriptor:Mv,useApi:He,useClient:Gn,useDeferredApi:Iv,useObjectFetcher:Fv},Symbol.toStringTag,{value:"Module"}));function Xy(r){return function(t){var{children:n}=t;return u.jsx(Aa.Provider,{value:r,children:n})}}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 Zy(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 Ss=B.module("MessageUtils"),Av="io.deephaven.message.LoginOptions.request",Rv="io.deephaven.message.SessionDetails.request",jv="io.deephaven.broadcast",Zo="io.deephaven.broadcast.Login",kv="io.deephaven.broadcast.Logout";function Va(r){var e=r;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function $v(r){return Va(r)&&r.message===Zo}function Uv(r){return Va(r)&&r.message===kv}function Hv(r){var e=r;return e!=null&&typeof e.id=="string"}function Qo(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ee(),t=arguments.length>2?arguments[2]:void 0;return{message:r,id:e,payload:t}}function Qy(r,e){return{id:r,payload:e}}function Jo(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function el(r){return zs.apply(this,arguments)}function zs(){return zs=Zy(function*(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=Jo();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((n,i)=>{var a,s=Ee(),o=l=>{var{data:d}=l;if(!Hv(d)){Ss.debug("Ignoring non-deephaven response",d);return}if(Ss.debug("Received message",d),(d==null?void 0:d.id)!==s){Ss.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 _b("Request timed out"))},e),t.postMessage(Qo(r,s),"*")})}),zs.apply(this,arguments)}function Jy(r,e,t){return e=eE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eE(r){var e=tE(r,"string");return typeof e=="symbol"?e:String(e)}function tE(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),Jy(this,"isNoConsolesError",!0)}}function Bv(r){return r.isNoConsolesError}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 Ba(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 or=B.module("SessionUtils");function nE(r,e){return or.info("Starting connection to '".concat(e,"'...")),new r.IdeConnection(e)}function Wv(r,e,t){return Ks.apply(this,arguments)}function Ks(){return Ks=Ba(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:Ee.generate()};return or.info("Console session established",s),{session:a,config:s,connection:e,details:t,dh:r}}),Ks.apply(this,arguments)}function rE(r,e,t){return or.info("createCoreClient",e),new r.CoreClient(e,t)}function iE(r){return r!=null&&typeof r=="object"}function aE(){return qs.apply(this,arguments)}function qs(){return qs=Ba(function*(){var r=yield el(Rv);if(!iE(r))throw new Error("Unexpected session details response: ".concat(r));return r}),qs.apply(this,arguments)}function sE(){return Ys.apply(this,arguments)}function Ys(){return Ys=Ba(function*(){var r=new URLSearchParams(window.location.search);switch(r.get("authProvider")){case"parent":return aE()}return{}}),Ys.apply(this,arguments)}function oE(r,e,t){return Xs.apply(this,arguments)}function Xs(){return Xs=Ba(function*(r,e,t){var n;try{n=yield Wv(r,e,t)}catch(i){if(!Bv(i))throw i}return n}),Xs.apply(this,arguments)}const lE=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:jv,BROADCAST_LOGIN_MESSAGE:Zo,BROADCAST_LOGOUT_MESSAGE:kv,BooleanColumnFormatter:Tb,CharColumnFormatter:Ob,DateTimeColumnFormatter:Lo,DateUtils:Fo,DecimalColumnFormatter:Db,DefaultColumnFormatter:xb,FETCH_TIMEOUT:Ib,Formatter:Pr,FormatterUtils:wn,IntegerColumnFormatter:Nb,LOGIN_OPTIONS_REQUEST:Av,NoConsolesError:Vv,SESSION_DETAILS_REQUEST:Rv,StringColumnFormatter:Mb,TableColumnFormatter:Lb,TableUtils:Ie,createComboboxFilterArgs:Fb,createConnection:nE,createCoreClient:rE,createFilterConditionFactory:Ao,createKeyFromOffsetRow:Ab,createNotNullOrEmptyFilterCondition:Lc,createOnTableUpdatedHandler:Fc,createSearchTextFilter:Ro,createSelectedValuesFilter:jo,createSessionWrapper:Wv,createShowOnlyEmptyFilterCondition:Ac,createValueFilter:Rc,defaultRowDeserializer:jc,fetchVariableDefinition:Rb,generateEmptyKeyedItems:kc,getColumnFormats:jb,getDateTimeFormatterOptions:kb,getSessionDetails:sE,getSize:ko,getWindowParent:Jo,isBroadcastLoginMessage:$v,isBroadcastLogoutMessage:Uv,isClosed:fa,isCustomColumnFormatDefined:$b,isMessage:Va,isNoConsolesError:Bv,isResponse:Hv,loadSessionWrapper:oE,makeMessage:Qo,makeResponse:Qy,padFirstAndLastRow:$c,requestParentResponse:el},Symbol.toStringTag,{value:"Module"}));var Id=B.module("useTableListener"),dE=(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 fr=dE;function uE(r,e,t){return e=hE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hE(r){var e=cE(r,"string");return typeof e=="symbol"?e:String(e)}function cE(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 vE extends Error{constructor(){super(...arguments),uE(this,"isColumnNameError",!0)}}const fE=vE;function pE(r,e,t){return e=mE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mE(r){var e=gE(r,"string");return typeof e=="symbol"?e:String(e)}function gE(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 Error{constructor(){super(...arguments),pE(this,"isTableDisconnectError",!0)}}const CE=bE;var Hi=B.module("useTable"),SE=(r,e,t,n)=>{var i=He(),[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 fE("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(w=>w.get(S)));l(y)},[a]),m=v.useCallback(()=>{f(new CE("Table disconnected"))},[]),b=v.useCallback(()=>{f(null)},[]);return fr(r,i.Table.EVENT_UPDATED,p),fr(r,i.Table.EVENT_DISCONNECT,m),fr(r,i.Table.EVENT_RECONNECT,b),{columns:a,data:o,error:c??d}};const Gv=SE;var yE=(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=yE;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 EE(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)})}}var Gt=B.module("TableInput"),ys=250;function tl(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=He(),p=v.useMemo(()=>{var V=wn.getColumnFormats(a),N=wn.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:P={},defaultIntegerFormatOptions:R={}}=a;return new Pr(f,V,N,P,R)},[f,a]),[m,b]=v.useState(""),[g,C]=v.useState(new Set(s)),[y,S]=v.useState(),w=v.useRef(null),E=Math.min((e=y==null?void 0:y.size)!==null&&e!==void 0?e:0,ys),{column:x,data:D,error:T}=zv(y,0,ys-1,i),I=v.useCallback(V=>x?p.getFormattedString(V,x.type,x.name):"".concat(V),[x,p]),[j,W]=v.useMemo(()=>{var V=new Set(g),N=[];if(D==null)return[N,null];if(D.forEach(R=>{var U="".concat(R),Q=g.has(U);Q&&V.delete(U),N.push({value:U,displayValue:I(R),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(R=>{P.delete(R)}),[N,P]}return[N,null]},[D,g,I]);v.useEffect(()=>{W!==null&&(C(W),l(Array.from(W)))},[l,W]);var L=v.useCallback(function(){var V=EE(function*(N){try{var P=yield N;Gt.debug("Table resolved",P),S(P)}catch(R){if(ye.isCanceled(R))return;Gt.error(R)}});return function(N){return V.apply(this,arguments)}}(),[]);v.useEffect(()=>{var V=ye.makeCancelable(h);return L(V),()=>{Gt.debug2("Cancel table promise"),V.cancel()}},[h,L]);var O=v.useCallback(V=>{var{value:N}=V.target;b(N);var P=j.findIndex(U=>U.displayValue.includes(N));if(P>-1){var R;Gt.debug2("Found ".concat(N," at index ").concat(P)),(R=w.current)===null||R===void 0||R.scrollIntoView(P)}else Gt.debug2("".concat(N," not found"))},[j,w]),M=v.useCallback(V=>{if(Gt.debug("handleSelect",V),V>=j.length){Gt.error("Invalid index",V);return}var N=j[V].value,P=new Set(g);j[V].isSelected?P.delete(N):P.add(N),C(P),l(Array.from(P))},[l,j,g]),A=v.useCallback(()=>{var V=j.map(P=>P.value),N=new Set(V);C(N),l(V)},[j,l]),k=v.useCallback(()=>{C(new Set),l([])},[l]),H=v.useCallback(()=>{},[]),q=v.useCallback(V=>{var N,{relatedTarget:P}=V;Gt.debug("handleChildBlur",P,P instanceof HTMLElement,c.current,(N=c.current)===null||N===void 0?void 0:N.contains(P)),(!P||c.current&&P instanceof HTMLElement&&!c.current.contains(P))&&d()},[d]),re=j.length===0;return u.jsxs("div",{ref:c,className:Y("table-input-container d-flex flex-column position-relative",n),children:[u.jsx(yi,{disabled:!!T||re,value:m,placeholder:"Search",onChange:O,className:"mb-2 d-flex",onBlur:q}),u.jsx(Ic,{className:"table-input-list",disabled:y===void 0||re,isInvalid:o,items:re?[{value:"Empty",isSelected:!1}]:j,itemCount:E,offset:0,onSelect:M,onViewportChange:H,ref:w,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>E&&u.jsxs(u.Fragment,{children:["Table is too large, showing the first ",ys," items."]})}),u.jsxs("div",{children:[u.jsx("button",{type:"button",className:"btn btn-link",onBlur:q,onClick:A,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(tt,{isLoaded:y!=null,isLoading:y==null&&T==null,errorMessage:(t=T==null?void 0:T.message)!==null&&t!==void 0?t:null})})]})}tl.displayName="TableInput";tl.defaultProps={isInvalid:!1,className:void 0};var Md=B.module("useBroadcastChannel");function nl(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ub,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(!Va(a)){Md.debug("Ignoring non-deephaven message",a);return}Md.debug("event received",a),r(i)}return t.addEventListener("message",n),()=>{t.removeEventListener("message",n)}},[t,r]),t}function Wa(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]);nl(t)}var ga="io.deephaven.web.client.auth.refreshToken",Kv=v.createContext(null),wE=B.module("RefreshTokenUtils");function Zs(){var r=yr.get(ga);try{if(r!=null)return JSON.parse(r)}catch(e){wE.error("Error parsing refresh token",r,e)}return null}function Qs(r){if(r==null){yr.remove(ga);return}var e=JSON.stringify({bytes:r.bytes,expiry:r.expiry}),t=new Date(r.expiry);yr.set(ga,e,{secure:!0,sameSite:"strict",expires:t})}function qv(r){var{children:e}=r,t=He(),n=Gn(),[i,a]=v.useState(Zs());v.useEffect(function(){var d=n.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,h=>{var{detail:c}=h;Qs(c),a(c)});return d},[t,n,i]);var s=v.useCallback(()=>{a(Zs())},[]),o=v.useCallback(()=>{Qs(null),a(null)},[]);return Wa(s,o),u.jsx(Kv.Provider,{value:i,children:e})}function nn(){var r=He();return v.useMemo(()=>new Ie(r),[r])}function PE(r,e,t,n){var i=nn(),[a,s]=v.useState(""),{value:o}=Ei(a,t),l=v.useCallback(f=>{s(f.trim())},[]),{data:d,isLoading:h}=ui(i.doesColumnValueExist,[r,e,o,n]),c=h||a!==o?null:d;return{valueTrimmed:a,valueTrimmedDebounced:o,valueExists:c,trimAndUpdateValue:l}}var Ld=B.module("useDebouncedViewportSearch"),_E=200;function TE(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_E,n=nn(),{table:i,applyFiltersAndRefresh:a}=r,s=v.useMemo(()=>Le(o=>{if(Ld.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(()=>()=>{Ld.debug("Cancelling debounced search function"),s.cancel()},[s]),s}var Yv=300;function OE(r){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:n,mapItemToValue:i}=r,a=nn(),s=uv(e,i),{value:o}=Ei(s,Yv),l=ov(o,tv);return v.useMemo(()=>jo(a,t,l.selection,n,l.isInverted),[t,l,n,a])}function rl(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(()=>Hb(...t.map(i=>i(r))),[r,...t])}function DE(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 Fd(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 xE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Fd(a,n,i,s,o,"next",l)}function o(l){Fd(a,n,i,s,o,"throw",l)}s(void 0)})}}function IE(r){var{table:e,columnName:t,defaultValue:n,itemHeight:i,topOffset:a=0,value:s}=r;return v.useCallback(xE(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 il(r){var[,e]=v.useState(0),t=He();return fr(r,t.Table.EVENT_SIZECHANGED,()=>{e(n=>n+1)}),ko(r)}var NE=B.module("useInitializeViewportData");function Xv(r){var e=vv({}),t=Math.max(0,il(r));return v.useEffect(()=>{var n=e.items.length;t!==n&&(NE.debug("size changed:",{currentSize:n,targetSize:t}),e.setItems(Array.from(kc(0,t-1))))},[t,r]),e}function Zv(r,e,t){return v.useCallback(function(i){var[a,s]=$c(i,e,t,ko(r));r==null||r.setViewport(a,s)},[r,t,e])}var Ad=B.module("useViewportData");function al(r){var{table:e,itemHeight:t=1,scrollDebounce:n=jC,viewportSize:i=10,viewportPadding:a=50,deserializeRow:s=jc}=r,o=Xv(e),l=Zv(e,i,a),d=v.useCallback(b=>{e&&!fa(e)?l(b):Ad.debug("setViewport called on closed table.",e)},[e,l]),h=v.useCallback(b=>{e&&!fa(e)?(e.applyFilter(b),d(0)):Ad.debug("applyFiltersAndRefresh called on closed table.",e)},[d,e]),c=He(),f=v.useMemo(()=>Fc(o,s),[s,o]);fr(e,c.Table.EVENT_UPDATED,f);var p=il(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 sl(r,e){var{applyFiltersAndRefresh:t}=r;v.useEffect(()=>{t(e)},[t,e])}function ME(r,e){for(var t=nn(),[n,i]=v.useState(""),a=v.useMemo(()=>Ro(t,e,n),[e,n,t]),s=pa(i,Vs),o=al({table:r,itemHeight:RC,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=rl(o.table,a,...d);return sl(o,c),{list:o,onSearchTextChange:s}}function LE(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=nn(),n=v.useMemo(()=>Lc(t),[t]);return v.useMemo(()=>Ao(r,n,e),[r,e,n])}function Qv(r){v.useEffect(()=>()=>{r!=null&&(fa(r)||r.close())},[r])}function FE(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}=ui(s.doesColumnValueExist,[e,t,d,!1]),{isDebouncing:S}=Ei(d,Vs),w=S||y?null:C,E=v.useMemo(()=>Ro(s,t,d),[d,t,s]),x=v.useMemo(()=>jo(s,t,new Set(b.keys()),!1,!0),[t,b,s]),{data:D}=ui(s.createDistinctSortedColumnTable,[e,t,"asc",...i]);Qv(D);var T=al({table:D,itemHeight:AC,viewportSize:Zc,viewportPadding:Qc}),I=f.length>0&&T.size===0,j=b.has(f),W=pa(c,Vs),L=v.useCallback(q=>{l(q),W(q)},[W]),O=pa(m,0),M=v.useCallback(q=>{if(l(""),c(""),m(q),O(null),q!=null){var re=T.viewportData.findItem(q);if(re!=null){var V=n(re);g(N=>{var P=new Map(N);return P.set(V,{value:V}),P})}}},[c,O,T.viewportData,n]),A=v.useCallback(q=>{g(re=>{if(q.size===0)return re;var V=new Map(re);for(var N of q)V.set(N,{value:N});return V})},[]),k=v.useCallback(q=>{g(re=>{if(q==="all")return new Map;var V=new Map(re);for(var N of q)V.delete(N);return V})},[]),H=rl(T.table,E,x);return sl(T,H),v.useMemo(()=>({list:T,hasSearchTextWithZeroResults:I,searchText:o,searchTextExists:w,searchTextIsInSelectedValues:j,selectedKey:p,selectedValueMap:b,onSearchTextChange:L,onSelectKey:M,onAddValues:A,onRemoveValues:k}),[I,T,A,k,L,M,o,w,j,p,b])}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 AE(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 RE(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(AE(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}=ui(i,[]);return v.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:s,isError:o,isLoading:l}}function jE(r,e){var t=nn(),n=v.useMemo(()=>Ac(t,r),[r,t]);return v.useMemo(()=>Ao(e,n),[e,n])}function kE(r,e,t){var n=nn();return v.useMemo(()=>Rc(n,r,e,t),[r,t,n,e])}const $E=Object.freeze(Object.defineProperty({__proto__:null,DEBOUNCE_MS:Yv,REFRESH_TOKEN_KEY:ga,RefreshTokenBootstrap:qv,RefreshTokenContext:Kv,TableDropdown:Vb,TableInput:tl,makeApiContextWrapper:Xy,readRefreshToken:Zs,storeRefreshToken:Qs,useBroadcastChannel:nl,useBroadcastLoginListener:Wa,useCheckIfExistsValue:PE,useDebouncedViewportSearch:TE,useDebouncedViewportSelectionFilter:OE,useFilterConditionFactories:rl,useFilteredItemsWithDefaultValue:DE,useGetItemPosition:IE,useInitializeViewportData:Xv,useNotNullOrEmptyFilter:LE,usePickerWithSelectedValues:FE,useSearchableViewportData:ME,useSelectDistinctTable:RE,useSetPaddedViewportCallback:Zv,useShowOnlyEmptyFilter:jE,useTable:Gv,useTableClose:Qv,useTableColumn:zv,useTableListener:fr,useTableSize:il,useTableUtils:nn,useValueFilter:kE,useViewportData:al,useViewportFilter:sl},Symbol.toStringTag,{value:"Module"}));var Jv=v.createContext(!1);function UE(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(Jv.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 Pi=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 ba(r){return"AuthPlugin"in r}function ol(r){return"TablePlugin"in r}function tf(r){return ef(r)||ba(r)||ol(r)}function HE(r){return"type"in r&&r.type===nt.DASHBOARD_PLUGIN}function _i(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 VE=B.module("@deephaven/plugin.PluginUtils");function Js(r,e){return r==null||!_i(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function sf(r){var e=u.jsx(ne,{icon:Cc});if(!_i(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 VE.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:bc(n,o),name:o,styleContent:d}})}).flat()}function Ga(){return Ar(Pi,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function BE(r){var{fetch:e,type:t}=r,n=Ga(),i=v.useMemo(()=>[...n.values()].filter(_i).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 WE=Object.freeze(Object.defineProperty({__proto__:null,PluginType:nt,PluginsContext:Pi,WidgetView:BE,getIconForPlugin:sf,getThemeDataFromPlugins:of,isAuthPlugin:rf,isDashboardPlugin:HE,isLegacyAuthPlugin:ba,isLegacyDashboardPlugin:ef,isLegacyPlugin:tf,isLegacyTablePlugin:ol,isTablePlugin:nf,isThemePlugin:af,isWidgetPlugin:_i,pluginSupportsType:Js,usePlugins:Ga},Symbol.toStringTag,{value:"Module"}));function GE(r){if(r==null)return!1;var e=r;return e.Component!==void 0&&typeof e.isAvailable=="function"}var lf="io.deephaven.auth.AnonymousAuthenticationHandler",zE="io.deephaven.authentication.psk.PskAuthenticationHandler";function jd(r,e,t){return e=KE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function KE(r){var e=qE(r,"string");return typeof e=="symbol"?e:String(e)}function qE(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 YE extends Error{constructor(){super(...arguments),jd(this,"name","AuthenticationError"),jd(this,"isAuthenticationError",!0)}}const df=YE;function kd(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 XE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){kd(a,n,i,s,o,"next",l)}function o(l){kd(a,n,i,s,o,"throw",l)}s(void 0)})}}var $d=B.module("AuthPluginBase");function ll(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 Uc("Login canceled.")}function h(){return c.apply(this,arguments)}function c(){return c=XE(function*(){try{var f=yield t();d(),$d.info("Logging in..."),yield n.login(f),d(),o(!0)}catch(b){if(!l){var p;$d.error("Unable to login:",b);var m=(p=Tr(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(tt,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:Tr(i)})}var ZE={canLogout:!1};function QE(r){var{children:e}=r,t=He(),n=v.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return u.jsx(ll,{getLoginOptions:n,children:u.jsx(ja.Provider,{value:ZE,children:e})})}var JE={Component:QE,isAvailable:r=>r.includes(lf)};const uf=JE;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 ew(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 tw=B.module("AuthPluginParent"),nw={canLogout:!1};function rw(r){return r!=null&&typeof r.type=="string"}function iw(){return eo.apply(this,arguments)}function eo(){return eo=ew(function*(){tw.info("Logging in by delegating to parent window...");var r=yield el(Av);if(!rw(r))throw new Error("Unexpected login options response: ".concat(r));return r}),eo.apply(this,arguments)}function aw(){var r;return(r=new URLSearchParams(window.location.search).get("authProvider"))!==null&&r!==void 0?r:""}function sw(r){var{children:e}=r;return u.jsx(ll,{getLoginOptions:iw,children:u.jsx(ja.Provider,{value:nw,children:e})})}var ow={Component:sw,isAvailable:()=>Jo()!=null&&aw()==="parent"};const hf=ow;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(Fa,{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 Hd(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){Hd(a,n,i,s,o,"next",l)}function o(l){Hd(a,n,i,s,o,"throw",l)}s(void 0)})}}var to="io.deephaven.authentication.psk.PskAuthenticationHandler",ff="psk",no="io.deephaven.web.client.auth.psk.token",lr=B.module("AuthPluginPsk");function lw(){return new URLSearchParams(window.location.search).get(ff)}function dw(){lr.debug2("clearWindowToken");var r=new URL(window.location.href);r.searchParams.delete(ff),window.history.replaceState(null,"",r.href)}function Vd(){var r;return(r=yr.get(no))!==null&&r!==void 0?r:null}function ws(r){lr.debug2("Storing token in cookie",r),r!=null?yr.set(no,r,{secure:!0,sameSite:"strict"}):yr.remove(no)}function uw(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 E=Es(function*(x){var D=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:to,token:x}),a.current=T,yield T,lr.info("Logged in successfully"),a.current!==T)return;ws(x),c(!0)}catch(W){if(a.current!==T)return;if(d(!0),D){var I;lr.error("Unable to login",W);var j=(I=Tr(W))!==null&&I!==void 0?I:"Unable to login: Verify credentials.";o(new df(j))}}p(!1)});return function(x){return E.apply(this,arguments)}}(),[n]),C=v.useCallback(()=>{a.current=null,p(!1)},[]),y=v.useCallback(Es(function*(){lr.debug("onLogin");var E=Vd();h||f||E==null||g(E,!1)}),[h,f,g]),S=v.useCallback(()=>{ws(null)},[]);Wa(y,S),v.useEffect(()=>{var E=!1;function x(){return D.apply(this,arguments)}function D(){return D=Es(function*(){var T,I=(T=lw())!==null&&T!==void 0?T:Vd();if(dw(),I==null){d(!0);return}p(!0);try{yield n.login({type:to,token:I}),E||(ws(I),c(!0),p(!1))}catch{E||(d(!0),p(!1))}}),D.apply(this,arguments)}return x(),()=>{E=!0}},[n]);var w=v.useCallback(()=>{f?C():g(m)},[C,f,g,m]);return v.useEffect(function(){var x;(x=i.current)===null||x===void 0||x.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:Tr(s),isLoggingIn:f,onSubmit:w,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:E=>{o(void 0),b(E.target.value)}})]})})})}),u.jsx(tt,{"data-testid":"auth-psk-loading",isLoaded:h||l,isLoading:!h&&!l})]})}var hw={Component:uw,isAvailable:r=>r.includes(to)};const pf=hw;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 Ps(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){cw(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 cw(r,e,t){return e=vw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vw(r){var e=fw(r,"string");return typeof e=="symbol"?e:String(e)}function fw(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 pw=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&&pw.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 Ps(Ps({name:d,operateAs:h,groups:c},a),{},{permissions:Ps({canUsePanels:m,canCopy:f,canDownloadCsv:p,canLogout:b},s)})}const mw=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:lf,AUTH_HANDLER_TYPE_PSK:zE,AuthPluginAnonymous:uf,AuthPluginBase:ll,AuthPluginParent:hf,AuthPluginPsk:pf,Login:vf,LoginForm:cf,UserContext:Hc,UserOverrideContext:Vc,UserPermissionsOverrideContext:ja,getAppInitValue:mf,getUserFromConfig:gf,isAuthPlugin:GE},Symbol.toStringTag,{value:"Module"})),bf=typeof bs=="function"?bs:bs.default;$o.register([xC,IC,NC,MC,LC,FC]);function et(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=bw(r,"string");return typeof e=="symbol"?e:String(e)}function bw(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){et(this,"dh",void 0),et(this,"listeners",void 0),et(this,"formatter",void 0),et(this,"rect",void 0),et(this,"isDownsamplingDisabled",void 0),et(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}))}}et(De,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");et(De,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");et(De,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");et(De,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");et(De,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");et(De,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");et(De,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");et(De,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");et(De,"EVENT_ERROR","ChartModel.EVENT_ERROR");const St=De;function Wd(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?Wd(Object(t),!0).forEach(function(n){Ue(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Wd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ue(r,e,t){return e=Cw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cw(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)}var Br=B.module("ChartUtils"),Gd="io.deephaven.time.DateTime",yw=36e5,Ew=1e6;function ww(r){return r.asDate!==void 0}function Pw(r){return r.asNumber!==void 0}function zd(r){return r.dhTimeZone!==void 0}function _w(r){return r!=null&&r.range!=null&&(r.autorange===!1||r.autorange===void 0)}class z{static getPlotlyErrorBars(e,t,n,i){var a=n.map((o,l)=>o-e[l]),s=t.map((o,l)=>e[l]-o);return{type:"data",symmetric:!1,array:a,arrayminus:s,color:i.error_band_line_color}}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*)(%?)(.*)/);G(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,w="",E="0".concat(m).concat(g,".").concat(S).concat(w).concat(y),x=z.convertNumberPrefix(s),D=z.convertNumberPrefix(p);return{tickformat:E,tickprefix:x,ticksuffix:D,automargin:!0}}static addTickSpacing(e,t,n){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},s=i;return n&&(s=i/Ew),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]:z.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=z.getAllAxes(e);return z.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];_w(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 getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Br.warn("Unable to handle colorway property: ".concat(e.colorway))),t}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())}getAxisFormats(e,t){for(var n=this,i=new Map,a={tickformat:null,ticksuffix:null},s=z.getAllAxes(e),o=z.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:w}=S,{type:E}=w,x=o.get(E);G(x);var D=x.indexOf(w),T=n.getAxisPropertyName(E);if(T!=null){var I=z.getAxisLayoutProperty(T,D);if(i.has(I))Br.debug("".concat(I," already added."));else{Br.debug("Adding ".concat(I," to axisFormats."));var j=n.getPlotlyAxisFormat(S,t);if(j===null)i.set(I,a);else{i.set(I,j);var{businessCalendar:W}=w;if(W!=null){var L=[],{businessPeriods:O,businessDays:M,holidays:A,timeZone:k}=W,H=t==null?void 0:t.getColumnTypeFormatter(Gd),q;zd(H)&&(q=H.dhTimeZone);var re=q?(k.standardOffset-q.standardOffset)/60:0;A.length>0&&L.push(...n.createRangeBreakValuesFromHolidays(A,k,q)),O.forEach(V=>L.push({pattern:"hour",bounds:[z.periodToDecimal(V.close)+re,z.periodToDecimal(V.open)+re]})),M.length<n.daysOfWeek.length&&n.createBoundsFromDays(M).forEach(V=>L.push({pattern:"day of week",bounds:V})),j.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(z.MODE_LINES),(n??!0)&&a.add(z.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(z.MODE_LINES),(n??!1)&&a.add(z.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?z.ORIENTATION.HORIZONTAL:z.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:s,isLinesVisible:o,isShapesVisible:l,plotStyle:d,lineColor:h,shapeColor:c,sources:f,shape:p,shapeSize:m}=e,b=f.some(w=>{var E;return(E=w.axis)===null||E===void 0?void 0:E.businessCalendar}),g=this.getChartType(d,b),C=this.getPlotlyChartMode(d,o??void 0,l??void 0),y=this.getPlotlySeriesOrientation(e),S=z.makeSeriesData(g,C,s,a,y);return this.addSourcesToSeriesData(S,d,f,t),this.addStylingToSeriesData(S,d,i,h,c,p,m,n),S}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);vc(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,n){var 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,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:d}=this,h=e;if(h.marker={line:{}},h.line={width:1},t===d.plot.SeriesPlotStyle.AREA?h.fill="tozeroy":t===d.plot.SeriesPlotStyle.STACKED_AREA?h.stackgroup="stack":t===d.plot.SeriesPlotStyle.STEP?h.line.shape="hv":t===d.plot.SeriesPlotStyle.HISTOGRAM?(h.width=[],h.marker.line!==void 0&&Object.assign(h.marker.line,{color:n.paper_bgcolor,width:1})):t===d.plot.SeriesPlotStyle.OHLC?(h.increasing={line:{color:n.ohlc_increasing}},h.decreasing={line:{color:n.ohlc_decreasing}}):t===d.plot.SeriesPlotStyle.PIE?(h.textinfo="label+percent",h.outsidetextfont={color:n.title_color}):t===d.plot.SeriesPlotStyle.TREEMAP&&(h.hoverinfo="text",h.textinfo="label+text",h.tiling={packing:"squarify",pad:0},h.textposition="middle center",h.outsidetextfont={color:n.title_color}),i!=null&&(t===d.plot.SeriesPlotStyle.BAR?h.marker.color=i:h.line.color=i),a!=null&&(h.marker.color=a),s!=null&&s.length>0)try{h.marker.symbol=z.getMarkerSymbol(s)}catch(c){Br.warn("Unable to handle shape",s,":",c)}o!=null&&(h.marker.size=o*z.DEFAULT_MARKER_SIZE),l!=null&&t!==d.plot.SeriesPlotStyle.PIE&&(h.visible=l)}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,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=e,l=z.getAllAxes(t),d=0;d<t.charts.length;d+=1){var h=t.charts[d],c=i==null?void 0:i(h),f=this.getChartBounds(t,h,a,s);this.updateLayoutAxes(o,h.axes,l,n,a,s,f,c)}this.removeStaleAxes(o,l)}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=z.AXIS_SIZE_PX/n,y=z.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)},w=z.groupArray(t.axes,"position"),E=(a=w.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return E.length>0&&(n>0?S.right-=(S.right-S.left)*Math.max(0,Math.min(z.LEGEND_WIDTH_PX/n,z.MAX_LEGEND_SIZE)):S.right-=(S.right-S.left)*z.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&&zd(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 Ie.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=z.addTickSpacing(o,i,!0)):Ie.isNumberType(a)&&(o=z.getPlotlyNumberFormat(t,a,s),o=z.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,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:d}=this,h=a>0?Math.max(z.MIN_AXIS_SIZE,Math.min(z.AXIS_SIZE_PX/s,z.MAX_AXIS_SIZE)):z.DEFAULT_AXIS_SIZE,c=s>0?Math.max(z.MIN_AXIS_SIZE,Math.min(z.AXIS_SIZE_PX/a,z.MAX_AXIS_SIZE)):z.DEFAULT_AXIS_SIZE,f=e,p=z.groupArray(t,"position"),m=z.groupArray(t,"type"),b=[...m.keys()],g=z.groupArray(n,"type"),C=0;C<b.length;C+=1){var y=b[C],S=this.getAxisPropertyName(y);if(S!=null){var w=m.get(y),E=g.get(y),x=y===d.plot.AxisType.Y,D=x?s:a;G(w),G(E);for(var T=0;T<w.length;T+=1){var I=w[T],j=E.indexOf(I),W=z.getAxisLayoutProperty(S,j);f[W]==null&&(f[W]=this.makeLayoutAxis(y,i));var L=f[W];if(L!=null){this.updateLayoutAxis(L,I,T,p,h,c,o);var{range:O,autorange:M}=L;if(l!=null&&O!==void 0&&(M===void 0||M===!1)){var A=l(I),[k,H]=A(O);Br.debug("Setting downsample range",D,k,H),I.range(D,k,H)}else I.range(D)}}}}}removeStaleAxes(e,t){for(var n=e,i=z.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);G(l);var d=l.length,h=this.getAxisPropertyName(o);if(h!=null)for(var c=z.getAxisLayoutProperty(h,d);n[c]!=null;)delete n[c],d+=1,c=z.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)||[],w=Math.max(o.left,o.left+(y.length-1)*s),E=Math.min(o.right-(S.length-1)*s,o.right);f.domain=[w,E]}else if(t.type===d.plot.AxisType.Y){var x=i.get(d.plot.AxisPosition.BOTTOM)||[],D=i.get(d.plot.AxisPosition.TOP)||[],T=Math.max(o.bottom,o.bottom+(x.length-1)*a),I=Math.min(o.top-(D.length-1)*a,o.top);f.domain=[T,I]}}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=yw*(z.periodToDecimal(d)-z.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,Gd,t),n):e}makeFigureSettings(e,t){var{dh:n}=this,{series:i,xAxis:a,type:s}=e,o=z.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(ww(e))return n.i18n.DateTimeFormat.format(z.DATE_FORMAT,e,t);if(Pw(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(Ie.isDateType(t)&&typeof e=="string"){var a=e,s=z.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,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}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:z.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},yanchor:"top",pad:Vi({},z.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:Vi({},z.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(z,"DEFAULT_AXIS_SIZE",.15);Ue(z,"MIN_AXIS_SIZE",.025);Ue(z,"MAX_AXIS_SIZE",.2);Ue(z,"AXIS_SIZE_PX",75);Ue(z,"LEGEND_WIDTH_PX",50);Ue(z,"MAX_LEGEND_SIZE",.25);Ue(z,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));Ue(z,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");Ue(z,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));Ue(z,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));Ue(z,"SUBTITLE_LINE_HEIGHT",25);Ue(z,"DEFAULT_MARKER_SIZE",6);Ue(z,"MODE_MARKERS","markers");Ue(z,"MODE_LINES","lines");const Me=z;function Tw(r,e,t){return e=Ow(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ow(r){var e=Dw(r,"string");return typeof e=="symbol"?e:String(e)}function Dw(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),Tw(this,"isDownsamplingError",!0)}}function Kd(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 qd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kd(Object(t),!0).forEach(function(n){We(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Kd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function We(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=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)}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),We(this,"currentSeries",void 0),We(this,"PlotComponent",void 0),We(this,"plot",void 0),We(this,"plotWrapper",void 0),We(this,"columnFormats",void 0),We(this,"dateTimeFormatterOptions",void 0),We(this,"decimalFormatOptions",void 0),We(this,"integerFormatOptions",void 0),We(this,"rect",void 0),We(this,"ranges",void 0),We(this,"isSubscribed",void 0),We(this,"isLoadedFired",void 0),We(this,"resizeObserver",void 0),We(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(Yl),attr:"fill-warning"});var c=!!l;if(c&&d.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:bn.convertIcon(Yl),attr:"fill-warning"}),i||a||s||h){var f=bn.downsampleButtonTitle(a,s),p=bn.downsampleButtonAttr(a,s),m=a?Mg:Lg;d.push({name:f,title:"Downsampling status",icon:bn.convertIcon(m),click:this.handleDownsampleClick,attr:p})}var b=o.some(S=>{var{type:w}=S;return w!=null&&!w.includes("3d")}),g=o.some(S=>{var{type:w}=S;return w!=null&&w.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:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=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)}componentDidUpdate(e){var{isActive:t,model:n,settings:i}=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))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:qd(qd({},t),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=Me.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})}}}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 Pr(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(Si,{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(Mo,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}We(bn,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Fo.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:$o,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const dl=bn;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){Se(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 Se(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 Fe=B.module("FigureChartModel");class za extends St{constructor(e,t,n){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,Se(this,"chartUtils",void 0),Se(this,"dh",void 0),Se(this,"figure",void 0),Se(this,"settings",void 0),Se(this,"theme",void 0),Se(this,"data",void 0),Se(this,"layout",void 0),Se(this,"seriesDataMap",void 0),Se(this,"pendingSeries",void 0),Se(this,"oneClicks",void 0),Se(this,"filterColumnMap",void 0),Se(this,"lastFilter",void 0),Se(this,"isConnected",void 0),Se(this,"seriesToProcess",void 0),Se(this,"addPendingSeries",Le(()=>{for(var o=Me.getAxisTypeMap(this.figure),{pendingSeries:l}=this,d=function(){var f,p=l[h],m=i.figure.charts.find(b=>b.series.includes(p));i.addSeries(p,o,(f=m==null?void 0:m.showLegend)!==null&&f!==void 0?f:null),p.subscribe()},h=0;h<l.length;h+=1)d();this.pendingSeries=[]},za.ADD_SERIES_DEBOUNCE)),Se(this,"getTimeZone",ot((o,l)=>{if(l!=null){var d=l.getColumnTypeFormatter(o);if(d!=null)return d.dhTimeZone}})),Se(this,"getValueTranslator",ot((o,l)=>{var d=this.getTimeZone(o,l);return h=>this.chartUtils.unwrapValue(h,d)})),Se(this,"getValueParser",ot((o,l)=>{var d=this.getTimeZone(o,l);return h=>this.chartUtils.wrapValue(h,o,d)})),Se(this,"getRangeParser",ot((o,l)=>d=>{var[h,c]=d,f=this.getValueParser(o,l);return h=f(h),c=f(c),[h,c]})),Se(this,"getAxisRangeParser",ot((o,l)=>d=>{var h=Me.getSourceForAxis(o,d);return h!=null?this.getRangeParser(h.columnType,l):c=>c})),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 Me(e),this.figure=t,this.settings=a,this.theme=n,this.data=[];var s={data:{},layout:this.chartUtils.makeDefaultLayout(n)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:s},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=Me.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(j=>j.type===e.dh.plot.AxisType.X),y=b.find(j=>j.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,w,E,x,D=((S=(w=n.get(C.type))===null||w===void 0?void 0:w.findIndex(j=>j===C))!==null&&S!==void 0?S:0)+1,T=((E=(x=n.get(y.type))===null||x===void 0?void 0:x.findIndex(j=>j===y))!==null&&E!==void 0?E:0)+1,I={align:"center",x:.5,y:1,yshift:17,text:g,showarrow:!1,xref:"x".concat(D," domain"),yref:"y".concat(T," domain")};e.layout.annotations==null?e.layout.annotations=[I]:e.layout.annotations.push(I)}}},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,Me.getSeriesVisibility(e.name,this.settings),this.theme,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=Me.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=Me.DEFAULT_MARGIN.t+i*Me.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=Me.DEFAULT_TITLE_PADDING.t+i*Me.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,this.theme,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&&vc(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=Me.getPlotlyErrorBars(h,c,f,this.theme)),m&&b&&m!==p&&(a.error_y=Me.getPlotlyErrorBars(p,m,b,this.theme))}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}}Se(za,"ADD_SERIES_DEBOUNCE",50);const ro=za;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 _s(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 ul{static makeModelFromSettings(e,t,n,i){return _s(function*(){var a=yield ul.makeFigureFromSettings(e,t,n);return new ro(e,a,i,t)})()}static makeFigureFromSettings(e,t,n){return _s(function*(){var i=yield n.copy();return i.applyCustomColumns(n.customColumns),i.applyFilter(n.filter),i.applySort(n.sort),e.plot.Figure.create(new Me(e).makeFigureSettings(t,i))})()}static makeModel(e,t,n,i){return _s(function*(){return new ro(e,n,i,t)})()}}const pr=ul,Lw="var(--dh-color-chart-colorway)",Fw="var(--dh-color-chart-grid)",Aw="var(--dh-color-chart-axis-line)",Rw="var(--dh-color-chart-axis-line-zero)",Qd={"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:Lw,gridcolor:Fw,linecolor:Aw,zerolinecolor:Rw,"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 Jd=B.module("ChartTheme");function hl(){var r,e=Oo(Qd);return e.colorway=gc((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Fg.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),Jd.debug2("Chart theme:",Qd),Jd.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function mr(r,e,t){return e=jw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jw(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)}class be extends St{static get theme(){return be._theme==null&&(be._theme=hl()),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=new Me(e).makeDefaultLayout(be.theme);return t.title="Chart",t.xaxis&&(t.xaxis.title="Datestamp"),t.yaxis&&(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),mr(this,"data",void 0),mr(this,"filterFields",void 0),mr(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)}}mr(be,"random",Math.random.bind(Math));mr(be,"smoothing",1.5);mr(be,"_theme",void 0);const $w=be,Sf=bf($o);var cl=v.createContext(null);function yf(r){var{children:e}=r,{activeThemes:t}=Rr(),n=v.useMemo(hl,[t]);return u.jsx(cl.Provider,{value:n,children:e})}function io(r){return r.setFigure!==void 0}function Ti(){return Ar(cl,"No ChartThemeContext value found.")}const Uw=Object.freeze(Object.defineProperty({__proto__:null,Chart:dl,ChartModel:St,ChartModelFactory:pr,ChartThemeContext:cl,ChartThemeProvider:yf,ChartUtils:Me,DownsamplingError:Cf,FigureChartModel:ro,MockChartModel:$w,Plot:Sf,defaultChartTheme:hl,isFigureChartModel:io,useChartTheme:Ti},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 Hw(r){return r.component!==void 0}var Pf=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Vw=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ef,isGLComponentConfig:wf,isReactComponentConfig:Hw,itemDefaultConfig:Pf},Symbol.toStringTag,{value:"Module"}));function sa(r,e,t){return e=Bw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bw(r){var e=Ww(r,"string");return typeof e=="symbol"?e:String(e)}function Ww(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 hi{constructor(){sa(this,"_mSubscriptions",void 0),sa(this,"off",this.unbind),sa(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[hi.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[hi.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(hi,"ALL_EVENT","__all");const Ft=hi;function _t(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)}class ao 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 Kw=Object.freeze(Object.defineProperty({__proto__:null,Container:ao,ItemContainer:ao},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 vl(r){return window.requestAnimationFrame(r)}function qw(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 fl(){return(Math.random()*1e15).toString(36).replace(".","")}function Yw(r,e){var t=r.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function pl(r){return Z.trim(r.replace(/(<([^>]+)>)/gi,""))}function lt(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=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)}class Qw 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=Qw;function er(r,e,t){return e=Jw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jw(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 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=Ma.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 Ca=["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"],tP=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ml(r){if(Ca.length>36)throw new Error("Too many keys in config minifier map");var e={};return gl(r,e,"_min"),e}function so(r){if(Ca.length>36)throw new Error("Too many keys in config minifier map");var e={};return gl(r,e,"_max"),e}function gl(r,e,t){var n=t==="_min"?nP:rP;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,Ca);e[o]=s}gl(a,s,t)}else{var l=n(a,tP);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,Ca);e[d]=l}}}}function nP(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function rP(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function Ts(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=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 oo{constructor(e,t){Ts(this,"name",void 0),Ts(this,"origin",void 0),Ts(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Bi(r,e,t){return e=sP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sP(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)}let lP=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=lP,dP=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:oo,DragListener:Oi,EventEmitter:Ft,EventHub:Df,ReactComponentHandler:Of,animFrame:vl,filterXss:Yw,getHashValue:_f,getQueryStringParam:Tf,getUniqueId:fl,minifyConfig:ml,removeFromArray:qw,stripTags:pl,unminifyConfig:so},Symbol.toStringTag,{value:"Module"}));function ln(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 xf 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-"+fl();e=ml(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=cP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cP(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 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",pl((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=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=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 If{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=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 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=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)}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 Os(r,e,t){return e=SP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function SP(r){var e=yP(r,"string");return typeof e=="symbol"?e:String(e)}function yP(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 Qr{constructor(e,t,n,i){Os(this,"element",void 0),Os(this,"_header",void 0),Os(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 EP(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 _P extends Error{constructor(e,t){super(),EP(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const jn=_P,TP=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:jn},Symbol.toStringTag,{value:"Module"}));function Ne(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)}function ci(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(),Ne(this,"config",void 0),Ne(this,"type",void 0),Ne(this,"contentItems",void 0),Ne(this,"parent",void 0),Ne(this,"layoutManager",void 0),Ne(this,"element",void 0),Ne(this,"childElementContainer",void 0),Ne(this,"componentName",void 0),Ne(this,"isInitialised",!1),Ne(this,"isMaximised",!1),Ne(this,"isRoot",!1),Ne(this,"isRow",!1),Ne(this,"isColumn",!1),Ne(this,"isStack",!1),Ne(this,"isComponent",!1),Ne(this,"tab",void 0),Ne(this,"_pendingEventPropagations",void 0),Ne(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=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,ci(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 oo(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 oo&&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,vl(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Wr(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=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 Ff extends $e{constructor(e,t,n){super(e,t,n,Z()),Wr(this,"config",void 0),Wr(this,"componentName",void 0),Wr(this,"container",void 0),Wr(this,"parent",void 0),Wr(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 ao(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=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 Sa 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}),vl(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}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 tu(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){lo(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 lo(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=FP(r,"string");return typeof e=="symbol"?e:String(e)}function FP(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 uo extends $e{constructor(e,t,n){super(e,tu(tu({},t),{},{type:"root"}),null,Z('<div class="lm_goldenlayout lm_item lm_root"></div>')),lo(this,"childElementContainer",void 0),lo(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 Sa)||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 nu(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?nu(Object(t),!0).forEach(function(n){st(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):nu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function st(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 ho 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,w,E,x,D,T,I,j,W=this.header.element.offset();(S=this.layoutManager.dropTargetIndicator)===null||S===void 0||S.highlightArea({x1:(w=W==null?void 0:W.left)!==null&&w!==void 0?w:0,x2:((E=W==null?void 0:W.left)!==null&&E!==void 0?E:0)+100,y1:(x=(D=this.header.element.offset())===null||D===void 0?void 0:D.top)!==null&&x!==void 0?x:0,y2:((T=(I=this.header.element.offset())===null||I===void 0?void 0:I.top)!==null&&T!==void 0?T:0)+((j=this.header.element.innerHeight())!==null&&j!==void 0?j:0)});return}var L=this.header.tabsContainer,O=(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(!(!O||!M)){e<O.left?e=O.left+1:e>O.right&&(e=O.right-1);var A,k;if(!(M.left<e&&e<M.right)){for(var H=0;H<y;H++){var q;if(A=this.header.tabs[H].element,k=(q=A.get(0))===null||q===void 0?void 0:q.getBoundingClientRect(),k&&k.left<e&&e<k.right){this._dropIndex=H;break}}if(A&&k&&e<k.left+k.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var re;this._dropIndex=Math.min(((re=this._dropIndex)!==null&&re!==void 0?re:0)+1,y),A.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 N=V+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);N=Math.min(N,((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:N,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 jP=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:$e,Component:Ff,ContentItem:$e,Root:uo,RowOrColumn:Sa,Stack:ho,isComponent:ht,isRoot:Lf,isStack:ci},Symbol.toStringTag,{value:"Module"}));function Xt(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)}class xi{constructor(e,t){var n;Xt(this,"header",void 0),Xt(this,"contentItem",void 0),Xt(this,"element",Z(xi._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(xi,"_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=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 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 xi(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 Qr(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 Qr(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 Qr(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 Qr(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 Gr(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 Af{constructor(e,t,n){Gr(this,"_isVertical",void 0),Gr(this,"_size",void 0),Gr(this,"_grabSize",void 0),Gr(this,"_dragListener",void 0),Gr(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 WP=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:xf,DragProxy:zn,DragSource:If,DragSourceFromEvent:Nf,DropTargetIndicator:Di,Header:en,HeaderButton:Qr,Splitter:Af,Tab:xi},Symbol.toStringTag,{value:"Module"}));var GP={config:Vw,container:Kw,controls:WP,errors:TP,items:jP,utils:dP};const zP=GP;function ru(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?ru(Object(t),!0).forEach(function(n){ue(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ru(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ue(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 Rf extends Ft{static minifyConfig(e){return ml(e)}static unminifyConfig(e){return so(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:Sa.bind(this,!0),row:Sa.bind(this,!1),stack:ho,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 ho)&&t&&!(this.isSubWindow===!0&&t instanceof uo)&&(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=fl();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 xf(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 If(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(ci(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=so(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=pl((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 uo(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=>{ci(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}ue(Rf,"__lm",zP);const jf=Rf,YP="_lm_dragging_1qalq_1",XP="_lm_goldenlayout_1qalq_1",ZP="_lm_header_1qalq_1",QP="_lm_controls_1qalq_1",JP="_lm_tabpreviousbutton_1qalq_1",e0="_lm_tabnextbutton_1qalq_1",t0="_lm_tab_1qalq_1",n0="_lm_active_1qalq_1",r0="_lm_close_tab_1qalq_1",i0="_lm_content_1qalq_1",a0="_lm_dragProxy_1qalq_1",s0="_lm_dropTargetIndicator_1qalq_1",o0="_march_1qalq_1",l0="_lm_inner_1qalq_1",d0="_lm_splitter_1qalq_1",u0="_lm_selectable_1qalq_1",h0="_lm_tabdropdown_list_1qalq_1",c0="_lm_title_1qalq_1",v0="_lm_title_before_1qalq_1",f0="_lm_selected_1qalq_1",p0="_lm_focusin_1qalq_1",m0="_lm_window_blur_1qalq_1",g0="_lm_popout_1qalq_1",b0="_lm_maximise_1qalq_1",C0="_lm_tabdropdown_1qalq_1",S0="_lm_close_1qalq_1",y0="_lm_tabdropdown_search_1qalq_1",E0="_lm_tabs_1qalq_1",w0="_lm_keyboard_active_1qalq_1",P0="_lm_maximised_1qalq_1",_0="_lm_items_1qalq_1",iu={"tab-height":"28px","drag-border-width":"5px",lm_dragging:YP,lm_goldenlayout:XP,lm_header:ZP,lm_controls:QP,lm_tabpreviousbutton:JP,lm_tabnextbutton:e0,lm_tab:t0,lm_active:n0,lm_close_tab:r0,lm_content:i0,lm_dragProxy:a0,lm_dropTargetIndicator:s0,march:o0,lm_inner:l0,lm_splitter:d0,lm_selectable:u0,lm_tabdropdown_list:h0,lm_title:c0,lm_title_before:v0,lm_selected:f0,lm_focusin:p0,lm_window_blur:m0,lm_popout:g0,lm_maximise:b0,lm_tabdropdown:C0,lm_close:S0,lm_tabdropdown_search:y0,lm_tabs:E0,lm_keyboard_active:w0,lm_maximised:P0,lm_items:_0},au=Object.freeze({tabHeight:parseInt(iu["tab-height"],10),dragBorderWidth:parseInt(iu["drag-border-width"],10)});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 zt(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){kf(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 kf(r,e,t){return e=T0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function T0(r){var e=O0(r,"string");return typeof e=="symbol"?e:String(e)}function O0(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 dr(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 ou(r){return r.type==="stack"}class F{static activateTab(e,t){var n=F.getStackForRoot(e,t,!1);if(!n){dn.error("Could not find stack for config",t);return}var i=F.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=F.getStackForRoot(e,t,!1);if(!n)return dn.error("Could not find stack for config",t),!1;var i=F.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&&ci(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&&ql(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=F.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&&ql(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:F.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?(ou(n)&&delete n.activeItemIndex,F.dropLayoutMinorChange(i)):dr(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;if(n){var i=F.cloneLayout(e),a=F.cloneLayout(t);return F.dropLayoutMinorChange(i),F.dropLayoutMinorChange(a),Mt(i,a)}return Mt(e,t)}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(dr(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:Ee(),props:t(o,l)}))}else if(a.content!==void 0){var d=F.hydrateLayoutConfig(a.content,t);ou(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=Ee.generate()),o!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,o);return}var h=i||{id:d.id,component:d.component};G(e);var c=a?F.addStack(e):F.getStackForRoot(e,h);G(c);var f=F.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(()=>{F.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=F.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=F.getStackForRoot(e,t,!1,!1,!1);if(!i){dn.warn("Cannot find stack for component, ignoring close",t);return}var a=F.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=F.getStackForRoot(e,t,!1);if(!i){dn.error("Could not find stack for config",t);return}var a=F.getContentItemInStack(i,t);a&&a.setTitle(n)}static cloneComponent(e,t){var n=F.getStackForRoot(e,t,!1);if(!n)return dn.error("Could not find stack for config",t),null;var{props:i={}}=t,a=F.getPanelComponentState(t),s={type:"react-component",component:t.component,props:zt(zt({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Ee.generate()};return F.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(dr(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:au.tabHeight,borderWidth:au.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=F.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return F.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=F.getComponentConfigFromContainer(t);if(n&&dr(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]:F.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(F,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Uf=X.forwardRef((r,e)=>{var t=F.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 vi(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 Ka&&typeof r.registerComponent=="function"}function Kn(r){if(!Hf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}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 du(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){pn(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 pn(r,e,t){return e=D0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function D0(r){var e=x0(r,"string");return typeof e=="symbol"?e:String(e)}function x0(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 Ka{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 F.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&dr(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=F.getStackForConfig(this.layout.root,{id:e});return(t=n&&F.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=>vi(n)&&t instanceof n.WrappedComponent||!vi(n)&&t instanceof n))}updatePanel(e){var t=F.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=F.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=du(du({},e),{},{props:i}),{root:s}=this.layout;F.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;F.closeComponent(n,t)}addClosedPanel(e){var t=F.getComponentConfigFromContainer(e);if(t&&dr(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(Ka,"MAX_CLOSED_PANEL_COUNT",100);var I0=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=F.getIdFromContainer(e);I0.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(tt,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}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 ya(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){N0(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 N0(r,e,t){return e=M0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function M0(r){var e=L0(r,"string");return typeof e=="symbol"?e:String(e)}function L0(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 qa(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),ya(ya({},r),{},{componentState:null,props:a,type:"react-component"})}function Ya(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return ya(ya({},r),{},{localDashboardId:e})}function bl(r){var e=vi(r)&&r.WrappedComponent.prototype!=null&&r.WrappedComponent.prototype.isReactComponent!=null||r.prototype!=null&&r.prototype.isReactComponent!=null,t=!vi(r)&&"$$typeof"in r&&r.$$typeof===Vm.ForwardRef;return e||t}const Bf={dehydrate:qa,hydrate:Ya};var Xa=X.createContext(void 0),F0=_.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}),A0=_.shape({registerComponent:_.func,root:_.shape({addChild:_.func}),on:_.func,off:_.func,eventHub:Wf}),Za=Object.freeze({Container:F0,EventHub:Wf,Layout:A0});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 R0(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=Ee.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:w}=l;F.openComponent({root:w,config:S,dragEvent:f})}},[t,a,o,l,i]);An(d,n,a,s),ce(l.eventHub,te.OPEN,h)}function j0(){var r=v.useContext(Xa);if(r==null)throw new Error("LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?");return 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 k0(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){$0(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 $0(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 V0=Object.freeze({}),B0=new Map,Gf=r=>r.api,W0=r=>r.user,zf=r=>r.storage,Kf=r=>zf(r).commandHistoryStorage,qf=r=>zf(r).fileStorage,G0=r=>r.defaultWorkspaceSettings,Yf=r=>{var{workspace:e}=r;return e},Ii=r=>{for(var e=Yf(r).data.settings,t=k0({},G0(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},Cl=r=>Ii(r).timeZone,z0=r=>{var e;return(e=Ii(r).defaultNotebookSettings)!==null&&e!==void 0?e:V0},Sl=r=>r.activeTool,K0=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:B0},Xf="SET_ACTIVE_TOOL",q0="SET_API",Y0="SET_COMMAND_HISTORY_STORAGE",X0="SET_FILE_STORAGE",Z0="SET_PLUGINS",Q0="SET_USER",Zf="SET_WORKSPACE",J0="SET_DEFAULT_WORKSPACE_SETTINGS",e_="SET_WORKSPACE_STORAGE",t_="SET_SERVER_CONFIG_VALUES";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 Nn(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){n_(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 n_(r,e,t){return e=r_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function r_(r){var e=i_(r,"string");return typeof e=="symbol"?e:String(e)}function i_(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 a_=r=>({type:Zf,payload:r}),s_=r=>(e,t)=>{e(a_(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(s_(a))},o_=r=>e=>e(Qf({settings:r})),Jf=r=>({type:Xf,payload:r});function vu(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 Ds(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vu(Object(t),!0).forEach(function(n){l_(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function l_(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=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)}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?Ds(Ds({},t),i):Ds({},i)}default:return t}}}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){h_(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 h_(r,e,t){return e=c_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function c_(r){var e=v_(r,"string");return typeof e=="symbol"?e:String(e)}function v_(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 f_(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:pu(pu({},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 p_=On(q0,null),m_=On(Xf,null),g_=On(Z0,null),b_=On(Y0,null),C_=On(X0,null),S_=On(e_,null),y_=_o({commandHistoryStorage:b_,fileStorage:C_,workspaceStorage:S_}),E_=ep(Q0,null),w_=ep(Zf,null),P_=On(J0,null),__=On(t_,null);var T_={activeTool:m_,api:p_,plugins:g_,storage:y_,user:E_,workspace:w_,defaultWorkspaceSettings:P_,serverConfigValues:__};const O_=T_;function mu(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 gu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mu(Object(t),!0).forEach(function(n){co(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):mu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function co(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=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 I_{constructor(){co(this,"reducers",{}),co(this,"listener",null)}register(e,t){var n;this.reducers=gu(gu({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var N_=new I_;const Qa=N_;var bu=B.module("redux-logger"),M_=r=>e=>t=>{bu.debug("dispatching",t);var n=e(t);return bu.debug("next state",r.getState()),n};const L_=M_;var F_=B.module("redux-crashReporter"),A_=r=>e=>t=>{try{return e(t)}catch(n){throw F_.error("Error executing",t," with state ",r.getState(),":",n),n}};const R_=A_,j_=[L_,R_,Bm];var xs;Object.entries(O_).map(r=>{var[e,t]=r;return Qa.register(e,t)});var k_=(xs=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&xs!==void 0?xs:zm,tp=Wm(_o(Qa.reducers),k_(Gm(...j_)));Qa.setListener(r=>{tp.replaceReducer(_o(r))});const $_=tp;var yl="SET_DASHBOARD_DATA";const U_=f_(yl,{},!1),np={dashboardData:U_};var H_=new Map,rp=Object.freeze({}),V_=Object.freeze([]),ip=r=>r.dashboardData,Ve=(r,e)=>{var t;return(t=ip(r)[e])!==null&&t!==void 0?t:rp},ap=(r,e)=>{var t;return(t=Ve(r,e).closed)!==null&&t!==void 0?t:V_},El=(r,e)=>{var t;return(t=Ve(r,e).openedMap)!==null&&t!==void 0?t:H_},wl=(r,e)=>{var t;return(t=Ve(r,e).pluginDataMap)!==null&&t!==void 0?t:rp},sp=(r,e,t)=>wl(r,e)[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 ur(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){B_(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 B_(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=G_(r,"string");return typeof e=="symbol"?e:String(e)}function G_(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 Pl=(r,e)=>({type:yl,id:r,payload:e}),At=(r,e)=>(t,n)=>t(Pl(r,ur(ur({},Ve(n(),r)),e))),op=(r,e,t)=>(n,i)=>n(Pl(r,ur(ur({},Ve(i(),r)),{},{pluginDataMap:ur(ur({},wl(i(),r)),{},{[e]:t})})));function z_(r,e){var t=mi(),n=fc(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 Qa.register(e,t)});function K_(r){var{children:e}=r;return u.jsx(u.Fragment,{children:e})}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 zr(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){q_(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 q_(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=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 Ki=B.module("DashboardLayout"),Z_=Object.freeze({}),Q_=[],yu=()=>{},Eu=r=>r;function _l(r){var e,t,{id:n,children:i,emptyDashboard:a=u.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:o=Q_,onLayoutChange:l=yu,onLayoutInitialized:d=yu,hydrate:h=Ya,dehydrate:c=qa,panelWrapper:f=K_}=r,p=mi(),m=(e=fc(P=>Ve(P,n)))!==null&&e!==void 0?e:Z_,[b,g]=v.useState(!1),[C,y]=v.useState(!1),[S,w]=v.useState(),[E]=v.useState((t=m==null?void 0:m.closed)!==null&&t!==void 0?t:[]),[x,D]=v.useState(!1),[T,I]=v.useState(s.getReactChildren()),j=v.useMemo(()=>new Map,[]),W=v.useMemo(()=>new Map,[]),L=v.useCallback(function(P,R){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,R,Q,me);function $(ie,ve){var we=R,Hr=f,Qn=bl(we),{glContainer:Vr,glEventHub:In}=ie;return u.jsx(Vf,{glContainer:Vr,glEventHub:In,children:u.jsx(Hr,zr(zr({},ie),{},{children:Qn?u.jsx(we,zr(zr({},ie),{},{ref:ve})):u.jsx(we,zr({},ie))}))})}$.displayName="DashboardWrapper(".concat((U=R.displayName)!==null&&U!==void 0?U:P,")");var J=s.registerComponent(P,X.forwardRef($));return j.set(P,Q),W.set(P,me),J},[h,c,j,W,s,f]),O=v.useCallback((P,R)=>{var U;return((U=j.get(P))!==null&&U!==void 0?U:Eu)(R,n)},[j,n]),M=v.useCallback((P,R)=>{var U;return((U=W.get(P))!==null&&U!==void 0?U:Eu)(R,n)},[W,n]),A=v.useMemo(()=>new Ka(s,O,M,new Map,E,P=>{var{closed:R,openedMap:U}=P;p(At(n,{closed:R,openedMap:U}))}),[M,p,O,n,E,s]),k=v.useCallback(()=>{if(!C){x||(d(),D(!0));var P=s.toConfig(),R=P.content,U=F.dehydrateLayoutConfig(R,M),Q=S==null||!F.isEqual(S,U);Ki.debug("handleLayoutStateChanged",Q,R,U),Q&&(g(s.root.contentItems.length===0),w(U),l(U),I(s.getReactChildren()))}},[M,x,C,S,s,l,d]),H=v.useCallback(P=>{var R=F.getIdFromContainer(P);s.eventHub.emit(te.DRAGGING,R),y(!0)},[s.eventHub]),q=v.useCallback(P=>{var R=F.getIdFromContainer(P);s.eventHub.emit(te.DROPPED,R),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 R=P.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),U="".concat(R,"-component");P.element.addClass(U)}},[]),V=v.useCallback(()=>{I(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 N=Tc(o);return v.useEffect(function(){if(N!==o&&o!==S){Ki.debug("Setting new layout content...");for(var R=F.hydrateLayoutConfig(o,O);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var U=0;U<R.length;U+=1)s.root.addChild(R[U]);g(s.root.contentItems.length===0)}},[O,s,o,S,A,N]),u.jsxs(u.Fragment,{children:[b&&a,T,X.Children.map(i,P=>P!=null?X.cloneElement(P,{id:n,layout:s,panelManager:A,registerComponent:L}):null)]})}_l.propTypes={id:_.string.isRequired,children:_.node,data:_.shape({}),emptyDashboard:_.node,layout:Za.Layout.isRequired,layoutConfig:_.arrayOf(_.shape({})),onLayoutChange:_.func,onLayoutInitialized:_.func};function wu(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 J_(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wu(Object(t),!0).forEach(function(n){eT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wu(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 rT=100,Is=()=>{},iT=Object.freeze({});function vo(r){var{id:e="default",children:t,emptyDashboard:n,layoutConfig:i,layoutSettings:a=iT,onLayoutConfigChange:s=Is,onGoldenLayoutChange:o=Is,onLayoutInitialized:l=Is,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 w=J_({},F.makeDefaultLayout());w.settings===void 0&&(w.settings={}),Object.assign(w.settings,a),w.content=[];var E=new jf(w,p.current),x=()=>{E.off("initialised",x),b(!0)};return E.on("initialised",x),d!=null&&E.setFallbackComponent(d),E.init(),C(E),o(E),()=>{E.destroy()}},[a,d,o,b,C]);var y=v.useMemo(()=>gi(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},rT),[g]);return Vo(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(Xa.Provider,{value:g,children:u.jsx(_l,{emptyDashboard:n,id:e,layout:g,layoutConfig:i,onLayoutChange:s,onLayoutInitialized:l,hydrate:h,dehydrate:c,panelWrapper:f,children:t})})]})}var Tl="default",Ol="CREATE_DASHBOARD";function aT(r,e){r.on(Ol,e)}function sT(r,e){r.emit(Ol,e)}var oT=["id","isActive","plugins"];function Pu(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 _u(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pu(Object(t),!0).forEach(function(n){lT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function lT(r,e,t){return e=dT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dT(r){var e=uT(r,"string");return typeof e=="symbol"?e:String(e)}function uT(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 hT(r,e){if(r==null)return{};var t=cT(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 cT(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 vT(r){var{id:e,isActive:t,plugins:n}=r,i=hT(r,oT),[a,s]=v.useState(t),o=mi(),l=v.useCallback(d=>{o(e===Tl?Qf({layoutConfig:d}):At(e,{layoutConfig:d}))},[e,o]);return!a&&t&&s(!0),a?u.jsx(vo,_u(_u({id:e,onLayoutConfigChange:l},i),{},{children:n})):u.jsx(tt,{})}const fT=Object.freeze(Object.defineProperty({__proto__:null,CREATE_DASHBOARD:Ol,DEFAULT_DASHBOARD_ID:Tl,Dashboard:vo,DashboardLayout:_l,DashboardUtils:Bf,GLPropTypes:Za,LayoutManagerContext:Xa,LayoutUtils:F,LazyDashboard:vT,PanelErrorBoundary:Vf,PanelEvent:te,PanelManager:Ka,SET_DASHBOARD_DATA:yl,assertIsDashboardPluginProps:Kn,canHaveRef:bl,default:vo,dehydrate:qa,emitCreateDashboard:sT,getAllDashboardsData:ip,getClosedPanelsForDashboard:ap,getDashboardData:Ve,getOpenedPanelMapForDashboard:El,getPluginDataForDashboard:sp,getPluginDataMapForDashboard:wl,hydrate:Ya,isDashboardPluginProps:Hf,isWrappedComponent:vi,listenForCreateDashboard:aT,reducers:np,setDashboardData:Pl,setDashboardPluginData:op,updateDashboardData:At,useDashboardPanel:R0,useDashboardPluginData:z_,useLayoutManager:j0,useListener:ce,usePanelRegistration:An},Symbol.toStringTag,{value:"Module"}));function pT(r){var{type:e}=r,t=He();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:xo});case t.VariableType.FIGURE:return u.jsx(ne,{icon:Do});case t.VariableType.PANDAS:return u.jsx(ne,{icon:Sc});default:return u.jsx(ne,{icon:Cc})}}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 mT(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 Ja(r){var{children:e,language:t}=r,[n,i]=v.useState(null),{activeThemes:a}=Rr();return v.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=mT(function*(){if(e!=null&&a!=null){var d=yield Uo.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 gT{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const lp=gT;class Ea{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)?[]:Km.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 Ea.isTableType(e,t)||Ea.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const fo=Ea;function dp(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})]})}dp.propTypes={children:_.node.isRequired};function po(r,e,t){return e=bT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bT(r){var e=CT(r,"string");return typeof e=="symbol"?e:String(e)}function CT(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 v.Component{constructor(e){super(e),po(this,"timer",void 0),po(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(Fa,{className:"ml-2"}),"Running... ",cr.formatElapsedTime(n)," ",u.jsx(K,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:To,tooltip:"Cancel",onClick:t,disabled:e})]})})}}po(up,"defaultProps",{disabled:!1});const ST=up;function oi(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)}class Or extends v.PureComponent{constructor(e){super(e),oi(this,"mouseX",void 0),oi(this,"mouseY",void 0),oi(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)>=Or.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Or.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;G(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:Ag,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")}}oi(Or,"defaultProps",{message:""});oi(Or,"mouseDragThreshold",5);const wT=Or;function PT(r,e,t){return e=_T(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _T(r){var e=TT(r,"string");return typeof e=="symbol"?e:String(e)}function TT(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 Ou=B.module("ConsoleHistoryItem");class hp extends v.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Ou.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Ou.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(Ja,{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(x=>{h=!0;var{title:D}=x,T="".concat(D),I=e===void 0||e||(a??[]).indexOf(T)>=0,j=u.jsx(K,{kind:"primary",onClick:()=>this.handleObjectClick(x),className:"btn-console-object",disabled:I,icon:i(x.type),children:D},T);d.push(j)})}if(c!=null&&!o){var g,C="".concat((g=c.message)!==null&&g!==void 0?g:c);C||(C=c);var y=u.jsx(wT,{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 w=u.jsx(ST,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(w)}var E=null;return d.length>0&&(E=u.jsx(dp,{children:d})),u.jsxs("div",{className:Y("console-command-result",{"console-result-buttons":h}),children:[l,E]})}}PT(hp,"defaultProps",{disabled:!1});const OT=hp;function DT(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function xT(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(OT,{disabled:e,item:d,openObject:i,language:n,supportsType:a,iconForType:s},DT(l,d));o.push(h)}return u.jsx("div",{className:"container-fluid console-history",children:o})}var IT={name:"Console",CLEAR:Ke.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[pe.CTRL,fe.L],macShortcut:[pe.CTRL,fe.C]}),FOCUS_HISTORY:Ke.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[pe.CTRL,fe.H],macShortcut:[pe.CTRL,pe.OPTION,fe.H]})},NT={name:"Command History",FOCUS_HISTORY:Ke.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:Ke.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]}),SEND_TO_NOTEBOOK:Ke.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[pe.CTRL,fe.ENTER],macShortcut:[pe.CMD,fe.ENTER]}),RUN:Ke.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[pe.ALT,fe.R],macShortcut:[pe.OPTION,fe.R]})},MT={name:"Notebook",RUN:Ke.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[pe.ALT,fe.R],macShortcut:[pe.OPTION,fe.R]}),RUN_SELECTED:Ke.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[pe.ALT,pe.SHIFT,fe.R],macShortcut:[pe.OPTION,pe.SHIFT,fe.R]}),FIND:Ke.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[pe.CTRL,fe.F],macShortcut:[pe.CMD,fe.F],isEditable:!1}),MINIMAP:Ke.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[pe.ALT,fe.M],macShortcut:[pe.OPTION,fe.M]}),WORDWRAP:Ke.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[pe.ALT,fe.Z],macShortcut:[pe.OPTION,fe.Z]})},LT={CONSOLE:IT,COMMAND_HISTORY:NT,NOTEBOOK:MT};const Je=LT,ke=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"});function Ns(r,e,t){return e=FT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function FT(r){var e=AT(r,"string");return typeof e=="symbol"?e:String(e)}function AT(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),Ns(this,"registeredCompletionProvider",void 0),Ns(this,"registeredSignatureProvider",void 0),Ns(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 cp=Rn;function RT(r){var{children:e}=r,{activeThemes:t}=Rr();return v.useEffect(function(){t!=null&&vt.initTheme()},[t]),u.jsx(u.Fragment,{children:e})}function Du(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 jT(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Du(a,n,i,s,o,"next",l)}function o(l){Du(a,n,i,s,o,"throw",l)}s(void 0)})}}function dt(r,e,t){return e=kT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kT(r){var e=$T(r,"string");return typeof e=="symbol"?e:String(e)}function $T(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 Ms=B.module("ConsoleInput"),wa=parseInt(Bb["line-height"],10),vp=6,fp=6,UT=wa+vp+fp,Ls=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:wa,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(Ms.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:wa,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:vp,bottom:fp},value:"",wordWrap:"on"},i=this.commandContainer.current;G(i),this.commandEditor=Uo.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();G(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===si.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,[Yc.CtrlCmd|si.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();G(s);var o=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,o);G(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();G(s);var o=s.getLineCount(),l=s.getLineLength(o)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(o,l);G(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-Ls&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return jT(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:i}=e.props;e.loadingPromise=ye.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+Ls-1}),e.loadingPromise=ye.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=Ls,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,ye.isCanceled(o)){Ms.debug2("Promise canceled, not loading history");return}Ms.error("Error fetching history",o)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),G(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;G(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),UT),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(cp,{model:s,language:t,session:n})]})})}}dt(Ni,"defaultProps",{maxHeight:wa*10,scope:null,disabled:!1});dt(Ni,"INPUT_CLASS_NAME","console-input");const xu=Ni;function Cn(r,e,t){return e=HT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function HT(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 Iu="pasted values",BT=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Fs=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Nu=[".zip"];class Vt extends v.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!BT.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Fs.some(n=>e.endsWith(n))||t&&Nu.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Iu?Xl:e.endsWith(".csv")?Rg:e.endsWith(".zip")?jg:kg}constructor(e){super(e),Cn(this,"fileElem",void 0),Cn(this,"divElem",void 0),Cn(this,"getValidExtensions",se(t=>t?[...Fs,...Nu]:[...Fs])),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();G(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:Iu,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:Xl,action:this.handleMenuPaste,shortcut:wr.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:$g})}),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:Io})}),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=WT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WT(r){var e=GT(r,"string");return typeof e=="symbol"?e:String(e)}function GT(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 pp(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 Mu(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 Lu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mu(Object(t),!0).forEach(function(n){Ye(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Mu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ye(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 Fu="unknown",qT=2147483647,YT=-2147483648,Au=/^[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]+)?$/,Ru=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Ge{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case de.STRING:return de.STRING;case de.INTEGER:return Ge.checkInteger(e);case de.LONG:return Ge.checkLong(e);case de.DOUBLE:return Ge.checkDouble(e);case de.BOOLEAN:return Ge.checkBoolean(e);case de.DATE_TIME:return Ge.checkDateTime(e);case de.LOCAL_TIME:return Ge.checkLocalTime(e);default:return Ge.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Ge.isNotParsableNumber(t)?de.STRING:Ge.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Ge.isNotParsableNumber(t)?de.STRING:t.includes(".")?de.DOUBLE:de.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Ge.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 Au.test(e)?de.DATE_TIME:de.STRING}static checkLocalTime(e){return Ru.test(e)?de.LOCAL_TIME:de.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Ge.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?de.BOOLEAN:Au.test(e)&&e.includes(":")?de.DATE_TIME:Ru.test(e)?de.LOCAL_TIME:de.STRING}return Ge.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>qT||n<YT?de.LONG:de.INTEGER}constructor(e,t,n,i,a,s,o,l,d,h){Ye(this,"onFileCompleted",void 0),Ye(this,"file",void 0),Ye(this,"readHeaders",void 0),Ye(this,"nullString",void 0),Ye(this,"onProgress",void 0),Ye(this,"onError",void 0),Ye(this,"types",void 0),Ye(this,"chunks",void 0),Ye(this,"totalChunks",void 0),Ye(this,"rowCount",void 0),Ye(this,"isZip",void 0),Ye(this,"shouldTrim",void 0),Ye(this,"zipProgress",void 0),Ye(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=Lu(Lu({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)ii.parse(this.file,this.config);else{var e=pp(this.file,this.handleNodeUpdate);ii.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(Fu),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,G(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]=Ge.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
|
+
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;G(t),(e==null||!e.meta.aborted)&&n(t.map(i=>i===Fu||i===de.LOCAL_TIME?de.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const XT=Ge;function ge(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=QT(r,"string");return typeof e=="symbol"?e:String(e)}function QT(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"),JT=650;class Dr{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(Dr.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/ii.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)ii.parse(this.file,this.config);else{var a=pp(this.file,this.handleNodeUpdate);ii.parse(a,this.config),a.resume()}},t=new XT(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=Bc.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Dr.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>=JT||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,G(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(),G(this.headers),G(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(Dr,"generateHeaders",r=>{for(var e=[],t=0;t<r;t+=1)e.push(Dr.generateHeaderRecursive(t));return e});const eO=Dr;function Dl(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 es{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Dl(es,"DEFAULT_TYPE","DEFAULT_CSV");Dl(es,"AUTO","AUTODETECT");Dl(es,"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
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
9
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
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 Jr=es;function mp(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 ju=B.module("CsvInputBar"),aO=Object.entries(Jr.TYPES).map(r=>{var[e,t]=r;return u.jsx("option",{value:e,children:t.name},e)});class gp extends v.Component{constructor(e){super(e),mp(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:Jr.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=Bc.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:Jr.fromExtension(t.name)}):n!=null&&n!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:Jr.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;ju.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;ju.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 eO({onFileCompleted:d,session:n,file:e,type:Jr.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:aO})]}),u.jsx(va,{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"})]})]})}}mp(gp,"defaultProps",{file:null,paste:null,unzip:null});const sO=gp;function Yi(r,e,t){return e=oO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oO(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 ku=B.module("ConsoleMenu");class Pa extends v.PureComponent{static makeItemActions(e,t,n,i,a){if(e.length===0)return[];var s={menuElement:u.jsx(yi,{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=>fo.isTableType(a,o.type));return Pa.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=>fo.isWidgetType(a,o.type));return Pa.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){ku.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){ku.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,{kind:"ghost",disabled:d,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:xo,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,{kind:"ghost",disabled:o.length===0,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:Do,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:yc,tooltip:"More Actions...","aria-label":"More Actions...",onClick:()=>{},children:u.jsx(En,{actions:e,popperOptions:l})})]})}}const dO=Pa;function bp(r,e,t){return e=uO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uO(r){var e=hO(r,"string");return typeof e=="symbol"?e:String(e)}function hO(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 Cp extends v.PureComponent{constructor(e){super(e),bp(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 Uc||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(dO,{dh:t,overflowActions:i,openObject:n,objects:a})]})}}bp(Cp,"defaultProps",{children:null});const cO=Cp;function $u(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?$u(Object(t),!0).forEach(function(n){yt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):$u(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yt(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)}var Rt=B.module("Console"),Uu={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function pO(){return!0}function mO(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",gi(()=>{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:Je.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Je.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},Uu),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(ye.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;G(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;G(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;G(t),!(!e&&Math.abs(t.scrollHeight-t.clientHeight-t.scrollTop)>=1)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;G(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?hr:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ae.groups.high,icon:e?hr:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ae.groups.high,icon:t?hr: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(Uu),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:w,csvPaste:E,dragError:x,csvUploadInProgress:D}=this.state,T=this.getObjects(y),I=Math.round(b*.7),j=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(cO,{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:x,onError:this.handleCsvError,uploadInProgress:D,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(xT,{items:g,openObject:s,language:i,disabled:c,supportsType:p,iconForType:m}),n]})]}),!S&&u.jsx(xu,{ref:this.consoleInput,session:o,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:I,commandHistoryStorage:d}),S&&u.jsx(sO,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:w??void 0,paste:E??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),u.jsx(ae,{actions:j,ignoreClassNames:[xu.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:pO,iconForType:mO});yt(yn,"LOG_THROTTLE",500);const gO=yn;var bO={groovy:"Groovy",python:"Python",scala:"Scala"};class CO{static normalizeScriptLanguage(e){return bO[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
|
+
`),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 mo=CO;function ei(r,e,t){return e=SO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function SO(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)}var Ct=B.module("ScriptEditor");class Sp extends v.Component{constructor(e){super(e),ei(this,"contextActionCleanups",void 0),ei(this,"completionCleanup",void 0),ei(this,"editor",void 0),ei(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(){Ke.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(){Ke.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();G(n);var i=(t=this.editor)===null||t===void 0?void 0:t.getModel();G(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 mo.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(Je.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(Je.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;G(this.editor);var n=this.editor.getModel();G(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(tt,{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(Wc,{ref:this.editorComponent,settings:o,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),c!=null&&c&&u.jsx(cp,{model:l,language:h,session:a})]})})]})}}ei(Sp,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});const EO=Sp;function ti(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=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 _O=250,TO=2500;class ts 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":cr.formatElapsedTime(n)}constructor(e){super(e),ti(this,"timer",void 0),ti(this,"cleanup",void 0),ti(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)},_O)),ti(this,"getPreviewText",ot(t=>t.split(`
|
|
15
|
+
`,TO).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=ts.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(Ja,{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:Io})," Executed with errors"]}),u.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",p?u.jsx("span",{className:"time-string",children:c}):u.jsx(Fa,{className:"loading-spinner-vertical-align"})]})]}),!!h&&u.jsx("div",{className:"error-message",children:h})]})]})}}ti(ts,"defaultProps",{onUpdate:()=>{}});const OO=ts;var DO=512;function yp(r){var{item:e,language:t,isSelected:n,commandHistoryStorage:i}=r,a=e.name.substring(0,DO),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(OO,{item:e,language:t,onUpdate:o,commandHistoryStorage:i})})]})}yp.defaultProps={isSelected:!1};class _a 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:$s,mask:e.icon,transform:"right-5 down-5 shrink-4"}),u.jsx(ne,{icon:Ug,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:_a.renderContent(n)},_a.itemKey(i,n)))})}}const xO=_a;var IO=150,Hu=3,Vu=B.module("CommandHistoryViewportUpdater");function NO(r){var{table:e,columns:t,top:n=0,bottom:i=0,search:a,isReversed:s=!1,onUpdate:o}=r,l=v.useMemo(()=>gi(d=>{var h=d.bottom-d.top,c=Math.max(0,d.top-h*Hu),f=d.bottom+h*Hu;e.setViewport({top:c,bottom:f,columns:d.columns})},IO),[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()=>{Vu.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(()=>()=>{Vu.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function Bu(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 Wu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Bu(a,n,i,s,o,"next",l)}function o(l){Bu(a,n,i,s,o,"throw",l)}s(void 0)})}}function Ht(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 un=B.module("CommandHistory");class Qe 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 Wu(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:[]}})},Qe.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:Hg,shortcut:wr.COPY,action:this.copySelectedCommands,group:ae.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Zl,shortcut:Je.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Qe.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:ha,shortcut:Je.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Qe.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Ql,shortcut:Je.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Qe.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Ec,action:this.createNotebook,group:Qe.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Zl,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Ql,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 Wu(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 Qe.getCommandsFromViewport(t,n,a);var{table:s}=e.props;return e.pending.add(Qe.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<Qe.MAX_SELECTION_COUNT?(un.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(un.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Gc).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(yp,{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=lp.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(yi,{ref:this.searchInputRef,value:s,placeholder:"".concat(m," Command History"),onChange:this.handleSearchChange}),u.jsx(xO,{actions:a,hasSelection:p.length>0})]}),u.jsxs("div",{className:"command-history-list",children:[u.jsx(Er,{ref:this.itemListRef,itemCount:c,items:h,offset:f,selectedRanges:p,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Qe.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),u.jsx(NO,{table:n,top:l,bottom:d,search:o,onUpdate:this.handleViewportUpdate}),u.jsx(ae,{actions:i})]})]})}}Ht(Qe,"ITEM_HEIGHT",29);Ht(Qe,"MAX_SELECTION_COUNT",1e4);Ht(Qe,"SET_SEARCH_DEBOUNCE_MS",150);Ht(Qe,"menuGroups",{send:ae.groups.medium+100});const FO=Qe;class AO 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(Mc,{on:t,onClick:this.handleSwitchClick}),e]})}}const RO=AO;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 zu(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){ct(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 ct(r,e,t){return e=jO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jO(r){var e=kO(r,"string");return typeof e=="symbol"?e:String(e)}function kO(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=fo.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(RO,{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(){G(this.editorContainer),this.editor=Uo.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"}),[[si.Escape],[Yc.Shift|si.Escape]].forEach(e=>{G(this.editor),vt.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[si.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,n,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();G(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=zu(zu({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),n=t==null?void 0:t.getLineCount();G(n);var i=t==null?void 0:t.getLineLength(n);G(i);var a=this.isBottomVisible(),s=[];if(i>0&&(s.push({range:{startLineNumber:n,startColumn:i+1,endLineNumber:n,endColumn:i+1},text:`
|
|
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();G(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
|
+
`&&(n+=`
|
|
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();G(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();G(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 G(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
|
+
`&&(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:Vg,tooltip:"Clear log"}),u.jsx(K,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Ra,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 $O=_e;function Ku(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 UO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ku(a,n,i,s,o,"next",l)}function o(l){Ku(a,n,i,s,o,"throw",l)}s(void 0)})}}var HO=B.module("HeapUsage");function VO(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:a=!0,monitorDuration:s}=r,o=Ti(),[l,d]=v.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=v.useState(!1),f=v.useRef({timestamps:[],usages:[]}),p=Ho(),m=v.useCallback(UO(function*(){try{var A=yield t.getWorkerHeapInfo();if(!p.current)return;if(d(A),a||h){for(var k=(A.totalHeapSize-A.freeMemory)/A.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){HO.warn("Unable to get heap usage",V)}}),[t,p,a,h,s]);sv(m,h?i:n);var b=(A,k)=>Math.round(A*10**k)/10**k,g=2,C=1024**3,{freeMemory:y,totalHeapSize:S,maximumHeapSize:w}=l,E=b(y/C,g),x=b(S/C,g),D=b(w/C,g),T=x-E,I=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:j,usages:W}=f.current,L=(e=j[j.length-1])!==null&&e!==void 0?e:0,O=S/w,M=(S-y)/w;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(O*100,"% - ").concat(O*2,"px")}}),u.jsx("div",{className:Y("used-memory",{"heap-overflow":(S-y)/w>.95}),style:{width:"calc(".concat(M*100,"% - ").concat(M*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[D.toFixed(1)," GB"]}),u.jsx(wt,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[I("In use:","".concat(T.toFixed(g)," of ").concat(D.toFixed(g)," GB"),!0),I("Free:","".concat(E.toFixed(g)," GB")),I("Total:","".concat(x.toFixed(g)," GB")),I("Max:","".concat(D.toFixed(g)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(Sf,{data:[{x:[...j],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 Ep(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)}class gr{static valueForCell(e,t,n){var i="".concat(e,",").concat(t);return n!==void 0&&n&&(i="(".concat(i,")")),i}constructor(e){Ep(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gr.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),gr.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=>gr.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 Wb(i,e,t??new Pr(i),n)}}Ep(gr,"DEFAULT_TYPE","java.lang.String");const GO=gr;function kn(r,e,t){return e=zO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zO(r){var e=KO(r,"string");return typeof e=="symbol"?e:String(e)}function KO(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"),qO=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=Gb.getModelIndex(d,i);l.push(e.columns[h])}return l})),kn(this,"updateViewport",gi((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)},qO))}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 YO=Jt;function Ta(r,e,t){return e=XO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XO(r){var e=ZO(r,"string");return typeof e=="symbol"?e:String(e)}function ZO(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"),QO=150;class Oa extends v.PureComponent{constructor(e){super(e),Ta(this,"listenerCleanup",void 0),Ta(this,"updateViewport",gi((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)},QO)),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}}Ta(Oa,"UPDATE_INTERVAL",1e3);Ta(Oa,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:Oa.UPDATE_INTERVAL});const JO=Oa,eD=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:zc,AdvancedSettingsType:zb,AggregationEdit:Kb,AggregationUtils:qb,Aggregations:Yb,BarIcon:Xb,ChartBuilder:Zb,ColumnHeaderGroup:Qb,CustomColumnBuilder:Jb,DownloadServiceWorkerUtils:eC,FormatColumnWhereIcon:tC,FormatRowWhereIcon:nC,HistogramIcon:rC,InputEditor:iC,IrisGrid:_r,IrisGridMetricCalculator:aC,IrisGridModel:Yt,IrisGridModelFactory:ka,IrisGridPartitionedTableModel:sC,IrisGridRenderer:oC,IrisGridTableModel:Kc,IrisGridTableModelTemplate:lC,IrisGridTestUtils:GO,IrisGridThemeContext:dC,IrisGridThemeProvider:qc,IrisGridTreeTableModel:uC,IrisGridUtils:Xe,LineIcon:hC,OptionType:cC,PieIcon:vC,RollupRows:fC,SHORTCUTS:pC,ScatterIcon:mC,TableCsvExporter:gC,TableSaver:bC,TableViewportUpdater:YO,TreeTableViewportUpdater:JO,VisibilityOrderingBuilder:CC,createDefaultIrisGridTheme:SC,default:_r,isIrisGridTableModelTemplate:aa,isPanelStateV1:yC,isPanelStateV2:EC,isPartitionedGridModel:wC,isPartitionedGridModelProvider:PC},Symbol.toStringTag,{value:"Module"}));function xl(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 ns{}xl(ns,"OPEN","ChartEvent.OPEN");xl(ns,"CLOSE","ChartEvent.CLOSE");xl(ns,"COLUMN_SELECTED","ChartEvent.COLUMN_SELECTED");const Da=ns;function Mi(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)}class jr{}Mi(jr,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Mi(jr,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Mi(jr,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Mi(jr,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Mi(jr,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const pt=jr;function xn(r,e,t){return e=aD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aD(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 rn{}xn(rn,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");xn(rn,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");xn(rn,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");xn(rn,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");xn(rn,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");xn(rn,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");xn(rn,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");xn(rn,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Te=rn;function kr(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)}class Yn{}kr(Yn,"OPEN_GRID","IrisGridEvent.OPEN_GRID");kr(Yn,"CLOSE_GRID","IrisGridEvent.CLOSE_GRID");kr(Yn,"DATA_SELECTED","IrisGridEvent.DATA_SELECTED");kr(Yn,"COLUMN_SELECTED","IrisGridEvent.COLUMN_SELECTED");kr(Yn,"STATE_CHANGED","IrisGridEvent.STATE_CHANGED");kr(Yn,"CREATE_CHART","IrisGridevent.CREATE_CHART");const Et=Yn,wp=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function an(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=uD(r,"string");return typeof e=="symbol"?e:String(e)}function uD(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 Pp(r,e,t){return e=hD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hD(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 Il{}Pp(Il,"OPEN","PandasEvent.OPEN");Pp(Il,"CLOSE","PandasEvent.CLOSE");const vD=Il;function $r(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 Xn{}$r(Xn,"focus","TabEvent.focus");$r(Xn,"blur","TabEvent.blur");$r(Xn,"openPQObject","TabEvent.openPQObject");$r(Xn,"openControl","TabEvent.openControl");$r(Xn,"reload","TabEvent.reload");$r(Xn,"clearAllFilters","TabEvent.clearAllFilters");const ni=Xn;function mD(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 _p 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})}}mD(_p,"defaultProps",{additionalActions:[]});const CD=_p;function Tp(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 Op extends v.PureComponent{constructor(e){super(e),Tp(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(Si,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Tp(Op,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function go(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)}var PD=B.module("Panel");let Dp=class extends v.PureComponent{constructor(e){super(e),go(this,"ref",void 0),go(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:F.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(ni.focus,this.handleTabFocus),a.on(ni.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(ni.focus,this.handleTabFocus),n.off(ni.blur,this.handleTabBlur),n.off(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:F.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=F.getRootFromContainer(t),i=F.getComponentConfigFromContainer(t);G(i),F.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=F.getRootFromContainer(e),i=F.getComponentConfigFromContainer(e);if(i==null){PD.error("Could not get component config from container",e);return}var a=F.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(tt,{errorMessage:s,isLoaded:o,isLoading:l}),!m&&c!=null&&Ma.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(CD,{glContainer:i,additionalActions:this.getAdditionActions(a,d,h)}),h&&u.jsx(Op,{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])]})}};go(Dp,"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=Dp;function Li(r){var{widgetType:e,widgetName:t,glContainer:n,description:i,children:a}=r,s=F.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(Mo,{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:Za.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=_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 Ip 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;Gc(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
|
+
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:w,onShow:E,onTabBlur:x,onTabFocus:D,onTabClicked:T}=this.props,{isPanelDisconnected:I,isWidgetDisconnected:j,isPanelInactive:W}=this.state,L=this.getErrorMessage(),O=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:I||j||l,inactive:W}),componentPanel:n,glContainer:s,glEventHub:o,onClearAllFilters:g,onHide:C,onFocus:y,onBlur:S,onResize:w,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:x,onTabFocus:D,onTabClicked:T,renderTabTooltip:O,errorMessage:L,isLoaded:i,isLoading:a,isClonable:d,isRenamable:h,additionalActions:M,children:[e,W&&u.jsx("div",{className:"fill-parent-absolute"})]})}}xp(Ip,"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=Ip,Nt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var OD=Object.freeze({}),DD=new Map,rs=Object.freeze([]),Nl=(r,e)=>{var t;return(t=Ve(r,e).columns)!==null&&t!==void 0?t:rs},Np=(r,e)=>{var t;return(t=Ve(r,e).filterSets)!==null&&t!==void 0?t:rs},is=(r,e)=>{var t;return(t=Ve(r,e).filters)!==null&&t!==void 0?t:rs},as=(r,e)=>{var t;return(t=Ve(r,e).tableMap)!==null&&t!==void 0?t:DD},ss=(r,e)=>Ve(r,e).isolatedLinkerPanelId,Zn=(r,e)=>{var t;return(t=Ve(r,e).links)!==null&&t!==void 0?t:rs},os=(r,e)=>Ve(r,e).columnSelectionValidator,xD=(r,e)=>{var t;return(t=Ve(r,e).consoleSettings)!==null&&t!==void 0?t:OD},ID=(r,e)=>Ve(r,e).connection,Ur=(r,e)=>Ve(r,e).sessionWrapper,ND=(r,e)=>t=>t(At(r,{connection:e})),MD=(r,e)=>t=>t(At(r,{sessionWrapper:e})),ls=(r,e)=>t=>t(At(r,{links:e})),Mp=(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(ls(r,i.concat(a)))},Lp=(r,e)=>(t,n)=>{var i=Zn(n(),r),a=i.filter(s=>!e.includes(s.id));return t(ls(r,a))},Ml=(r,e)=>t=>t(At(r,{isolatedLinkerPanelId:e})),Fp=(r,e)=>t=>t(At(r,{columnSelectionValidator:e})),Ap=(r,e)=>t=>t(At(r,{consoleSettings:e})),Rp=(r,e)=>t=>t(At(r,{filterSets:e}));function jp(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?Io:Bg;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(Ws,{onClick:h,className:"btn-primary",children:"Add Input Filters"}),u.jsx(Ws,{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})]})]})})}jp.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 fi(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(zo,{className:Y("btn-chart-column-selector",fi.makeButtonClassName(a.name)),onClick:()=>t(a.name),onMouseEnter:()=>{n&&n(a)},onMouseLeave:i,disabled:!a.isValid,isLinked:a.isActive,children:a.name},a.name))})]})})}fi.makeButtonClassName=r=>"btn-chart-column-selector-".concat(r);fi.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function br(r){return r.settings!==void 0}function Ll(r){return r.figure!==void 0}function kp(r){if(r==null)return!1;var{settings:e,tableSettings:t}=r;return typeof e=="object"&&typeof t=="object"}function $p(r){return r!=null&&kp(r.panelState)}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 Yu(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){Dt(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 Dt(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 it=B.module("ChartPanel"),AD=150;function RD(r){return r.inputFilters!=null}function jD(r){return r.panelState!=null}class ds 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=F.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);G(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),AD),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&&br(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&&io(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;G(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;G(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(Da.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){ye.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(),br(e)){var{settings:s}=e;this.pending.add(a.plot.Figure.create(new Me(a).makeFigureSettings(s,t))).then(o=>{io(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&&RD(e.props)&&jD(e.state)){var{inputFilters:s}=e.props,{panelState:o}=e.state;o!=null&&(a=Xe.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=Yu(Yu({},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=fi.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;G(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;br(o)?S=o.table:Ll(o)?S=o.figure:S=o.name;var w=this.getInputFilterColumnMap(c,i),E=this.getLinkedColumnMap(c,s),x=m!=null?this.getWaitingInputMap(m.isFilterRequired(),c,f):new Map,D=m!=null?this.getWaitingFilterMap(m.isFilterRequired(),c,f,E,w):new Map,T=p!=null?"Unable to open chart. ".concat(p):void 0,I=x.size>0,j=c.size>0&&a;return u.jsx(Fi,{className:Y("iris-chart-panel",{"input-required":I}),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(dl,{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:I&&!j&&!y,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(jp,{inputFilterMap:w,linkedColumnMap:E,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:c,waitingFilterMap:D,waitingInputMap:x})}),u.jsx(Hn,{in:j,timeout:Vn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(fi,{columns:this.getSelectorColumns(c,E,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Dt(ds,"defaultProps",{columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{},containerRef:null});Dt(ds,"displayName","ChartPanel");Dt(ds,"COMPONENT","ChartPanel");var kD=(r,e)=>{var{localDashboardId:t,metadata:n}=e,i;n!=null&&br(n)&&(i=n.sourcePanelId);var a=as(r,t),s=El(r,t),o=Sl(r),l=ss(r,t),d=o===Nt.LINKER&&l===void 0;return{columnSelectionValidator:os(r,t),isLinkerActive:d,inputFilters:is(r,t),links:Zn(r,t),source:i!=null?a.get(i):void 0,sourcePanel:i!=null?s.get(i):void 0,settings:Ii(r)}},$D=Pt(kD,{setActiveTool:Jf,setDashboardIsolatedLinkerPanelId:Ml},null,{forwardRef:!0})(ds);const Ai=$D;function xa(r,e,t){return e=UD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function UD(r){var e=HD(r,"string");return typeof e=="symbol"?e:String(e)}function HD(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),xa(this,"container",void 0),xa(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:Je.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;G(t),G(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(FO,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:n}),u.jsx(ae,{actions:a})]})]})}}xa(Ri,"COMPONENT","CommandHistoryPanel");xa(Ri,"TITLE","Command History");var VD=(r,e)=>{var t=Kf(r),n=Ur(r,e.localDashboardId),{session:i,config:a}=n??{},{type:s,id:o}=a??{};return{commandHistoryStorage:t,language:s,session:i,sessionId:o}},BD=Pt(VD,null,null,{forwardRef:!0})(Ri);const Up=BD;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 Zi(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){$n(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 $n(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 Qi=B.module("ConsolePanel"),zD=500,KD=Object.freeze({consoleSettings:{},itemIds:[]});class us 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})},zD)),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({},KD),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=Ee.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&&F.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;G(n);var{config:i,session:a}=n,{title:s}=e;G(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=>Js(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Js(i,e));return n!=null?sf(n):u.jsx(pT,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:a,unzip:s}=this.props;if(i==null)return u.jsx(tt,{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(gO,{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:lp.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(VO,{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(us,"COMPONENT","ConsolePanel");$n(us,"TITLE","Console");$n(us,"contextType",Xa);var qD=(r,e)=>({commandHistoryStorage:Kf(r),sessionWrapper:Ur(r,e.localDashboardId),timeZone:Cl(r),plugins:K0(r)}),YD=Pt(qD,null,null,{forwardRef:!0})(us);const oa=YD;function xt(r,e,t){return e=XD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XD(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 Ji=B.module("DropdownFilter"),QD=150;class tn extends v.Component{constructor(e){super(e),xt(this,"dropdownRef",void 0),xt(this,"getCompatibleColumns",se((a,s)=>a!=null?s.filter(o=>{var{type:l}=o;return l!==void 0&&Ie.isCompatibleType(l,a.columnType)}):[])),xt(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]})),xt(this,"getSelectedOptionIndex",se((a,s)=>a.indexOf(s))),xt(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)))])),xt(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})),xt(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})},QD)),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:Ee(),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),w=s!=null,E=(e=s==null?void 0:s.columnName)!==null&&e!==void 0?e:tn.SOURCE_BUTTON_PLACEHOLDER,x=f!=null?"".concat(f.name," Filter"):null,[D,T]=this.getColumnOptions(S,g),I=this.getValueOptions(h),j=this.getSelectedOptionIndex(h,C),W=!w||g==null,L=b&&!i,O="source-column-btn-".concat(m),M="filter-column-select-".concat(m);return u.jsxs(Ha,{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:O,children:"Source Column"}),u.jsx(zo,{id:O,isLinked:w,onClick:o,onMouseEnter:l,onMouseLeave:d,className:tn.SOURCE_BUTTON_CLASS_NAME,disabled:n,children:E}),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:D}),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}),w&&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:x})}),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(j),ref:this.dropdownRef,onChange:this.handleValueChange,onKeyDown:this.handleDropdownKeyPress,title:"Select Value",children:I})}),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:Ra,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}xt(tn,"defaultProps",{column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}});xt(tn,"PLACEHOLDER","Select a value...");xt(tn,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector");xt(tn,"SOURCE_BUTTON_PLACEHOLDER","Select a column");const Zu=tn;function Ze(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=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)}var Ce=B.module("DropdownFilterPanel"),tx=250,nx=(r,e)=>{var{localDashboardId:t}=e,n=F.getIdFromPanel({props:e}),i=as(r,t),a=Zn(r,t),s=Sl(r),o=ss(r,t),l=s===Nt.LINKER&&(o===void 0||o===n),d=s===Nt.LINKER&&o!==void 0&&o!==n;return{columns:Nl(r,t),columnSelectionValidator:os(r,t),dh:Gf(r),isLinkerActive:l,disableLinking:d,settings:Ii(r),panelTableMap:i,dashboardLinks:a}},rx=Pt(nx,null,null,{forwardRef:!0});class Lt extends v.Component{constructor(e){super(e),Ze(this,"dateTimeFormatter",void 0),Ze(this,"dropdownFilterRef",void 0),Ze(this,"panelContainer",void 0),Ze(this,"pending",void 0),Ze(this,"cleanup",void 0),Ze(this,"columnFormats",void 0),Ze(this,"getCachedValues",ot((c,f,p)=>{var{type:m,name:b}=f;return m!==void 0&&Ie.isDateType(m)?c.map(g=>this.dateTimeFormatter.format(g)):c.map(g=>g!=null&&m!=null?p.getFormattedString(g,m,b):null)})),Ze(this,"getCachedPanelLinks",ot((c,f)=>{var p=F.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})})),Ze(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})),Ze(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})),Ze(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),tx),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 Lo(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 Pr(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(Zu.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=>{ye.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 Pr(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(Zu,{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})})})}}Ze(Lt,"displayName","DropdownFilterPanel");Ze(Lt,"COMPONENT","DropdownFilterPanel");Ze(Lt,"MAX_TABLE_SIZE",256);Ze(Lt,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));var ix=rx(Lt);const Pn=ix;function mt(r){return r.type==="directory"}function ax(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)}class lx extends Error{constructor(){super("No file exists at the path specified"),ax(this,"isFileNotFound",!0)}}const hs=lx;function Qu(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 Ju(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Qu(a,n,i,s,o,"next",l)}function o(l){Qu(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 Ju(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof hs))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 Ju(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 ai("Name cannot be empty");if(t.includes(e))throw new ai('"'.concat(e,'" is a reserved name'));if(n.test(e)){var a,s;throw new ai('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 Fl=26;function bo(r){return mt(r)?ee.makePath(r.filename):ee.getPath(r.filename)}function eh(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=bo(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 dx(r){if(mt(r))return r.isExpanded?Wg:Gg;var e=ee.getMimeType(r.basename);switch(e){case Zt.PYTHON:return Kg;default:return zg}}function Co(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(D=>D.id===o.id))!==null&&e!==void 0?e:!1,b=bo(o),g=i&&d?bo(d):null,C=i&&a&&mt(o)&&g===b,y=i&&a&&g===b,S=i&&!a&&g===b,w=dx(o),E=ee.getDepth(o.filename),x=Array(E).fill(null).map((D,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:D=>h(l,D),onDragOver:D=>c(l,D),onDragEnd:D=>f(l,D),onDrop:D=>p(l,D),draggable:!0,role:"presentation","aria-label":o.basename,children:[x," ",u.jsx(ne,{icon:w,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 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 ea(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){ux(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 ux(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 qe=B.module("FileList"),vx=500,nh="item-list-scroll-pane";function fx(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:a,onSelectionChange:s=()=>{},renderItem:o=Co,rowHeight:l=Fl,overscanCount:d=Er.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(),[w,E]=v.useState([]),x=v.useRef(),D=v.useRef(null),T=v.useRef(null),I=v.useCallback($=>{if($.length===0||h==null)return[];for(var J=[],ie=0;ie<$.length;ie+=1)for(var ve=$[ie],we=ve[0];we<=ve[1];we+=1)we>=h.offset&&we<h.offset+h.items.length&&J.push(h.items[we-h.offset]);return J},[h]),j=v.useCallback($=>{var J=I([[$,$]]);if(J.length>0)return J[0]},[I]),W=v.useCallback(()=>{var $=ca.count(w);if($===0)return null;if($===1){var J=w[0][0],ie=j(J);if(ie!=null)return ie.filename}return"".concat($," items")},[j,w]),L=v.useCallback($=>{if(!(!g||!m)){qe.debug("dropItems",g,"to",$);try{var{files:J,targetPath:ie}=eh(g,m);if(i==null||i(J,ie),$!=null){var ve;E([[$,$]]),(ve=D.current)===null||ve===void 0||ve.focusItem($)}}catch(we){qe.error("Unable to complete move",we)}}},[g,m,i]),O=v.useCallback(($,J)=>{var ie=h.items[$-h.offset];ie!==void 0&&(qe.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;qe.debug2("handleItemDragStart",$,w);var ve=w;ca.isSelected(w,$)||(ve=[[$,$]],E(ve)),C(I(ve)),(ie=D.current)===null||ie===void 0||ie.resetMouseState();var we=document.createElement("div");we.innerHTML='<div class="dnd-placeholder-content">'.concat(W(),"</div>"),we.className="file-list-dnd-placeholder",document.body.appendChild(we),J.dataTransfer.setDragImage(we,0,0),J.dataTransfer.effectAllowed="move",S(we)},[W,I,w]),A=v.useCallback(($,J)=>{J.preventDefault(),qe.debug2("handleItemDragOver",J),b(j($))},[j]),k=v.useCallback(($,J)=>{qe.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(()=>{qe.debug2("handleItemDragExit"),b(void 0)},[]),re=v.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(nh)&&($.preventDefault(),qe.debug2("handleListDragOver",$),b({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),V=v.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(nh)&&(qe.debug("handleListDrop"),L())},[L]),N=v.useCallback(function($){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(qe.debug2("handleSelectionChange",$),J===!0||$!==w){E($);var ie=I($);s(ie)}},[I,s,w]),P=v.useCallback($=>{if(qe.debug2("handleFocusChange",$),$!=null){var[J]=I([[$,$]]);n(J)}else n();x.current=$},[I,n]),R=v.useCallback(($,J)=>{qe.debug("handleViewportChange",$,J),($!==f.top||J!==f.bottom)&&p({top:$,bottom:J})},[f]),U=v.useMemo(()=>{if(!g||!m)return!1;try{return eh(g,m),qe.debug("handleValidateDropTarget true"),!0}catch{return qe.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(){qe.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(){x.current!=null&&P(x.current),w.length>0&&N(w,!0)},[h,P,N,w]),v.useEffect(function(){if(m!=null&&mt(m)&&m.filename!=="/"){var J=setTimeout(()=>{m.isExpanded||t==null||t.setExpanded(m.filename,!0)},vx);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:A,onDragExit:q,onDrop:H})),[k,q,A,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(Er,{ref:D,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:P,onSelect:O,onSelectionChange:N,onViewportChange:R,selectedRanges:w,renderItem:me,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var px={name:"File Explorer",DELETE:Ke.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[fe.DELETE],macShortcut:[pe.CMD,fe.BACKSPACE]}),RENAME:Ke.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[fe.ENTER],macShortcut:[fe.ENTER]})};const rh={FILE_EXPLORER:px};var ih=B.module("FileListItemEditor"),mx=()=>Promise.resolve();function gx(r){var{item:e,onCancel:t,onSubmit:n,validate:i=mx}=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=>ih.info("Unable to validate name",y))},[n,s,h]);v.useEffect(function(){var S=ye.makeCancelable(i(s));return S.then(()=>d(void 0)).catch(w=>{ye.isCanceled(w)||d(w)}),c(S),()=>S.cancel()},[i,s]),v.useEffect(function(){f()},[f]);var b=v.useCallback(()=>{ih.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 ah(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 As(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ah(Object(t),!0).forEach(function(n){bx(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ah(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bx(r,e,t){return e=Cx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cx(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)}function Hp(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=Fl,validateRename:m=()=>Promise.resolve()}=r,[b,g]=v.useState(),[C,y]=v.useState([]),[S,w]=v.useState(),E=v.useCallback(H=>{y(H),c==null||c(H)},[c]),x=v.useCallback(H=>{w(H)},[]),D=v.useCallback(()=>{S&&(s==null||s(S))},[S,s]),T=v.useCallback(()=>{C.length>0&&(o==null||o(C))},[o,C]),I=v.useCallback(()=>{i==null||i()},[i]),j=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)},[]),O=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:I,group:ae.groups.medium}),a&&H.push({title:"New Folder",description:"Create new folder",action:j,group:ae.groups.medium}),s&&H.push({title:"Copy File",description:"Copy the selected file",action:D,group:ae.groups.low,disabled:S==null||mt(S)}),o&&C.length>0&&H.push({title:"Delete",description:"Delete",shortcut:rh.FILE_EXPLORER.DELETE,action:T,group:ae.groups.low}),d&&H.push({title:"Rename",description:"Rename",shortcut:rh.FILE_EXPLORER.RENAME,action:W,group:ae.groups.low,disabled:S==null}),H},[D,T,I,j,W,S,s,i,a,o,d,C,b]),A=v.useCallback(H=>(G(b),m(b,H)),[b,m]),k=v.useCallback(H=>{var{item:q}=H;return b&&b.filename===q.filename?u.jsx(Co,As(As({},H),{},{children:u.jsx(gx,{item:q,validate:A,onSubmit:O,onCancel:L})})):u.jsx(Co,As({},H))},[L,O,b,A]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(fx,{onMove:l,onSelect:h,onSelectionChange:E,onFocusChange:x,renderItem:k,rowHeight:p,table:f,isMultiSelect:e,focusedPath:t}),n&&u.jsx(ae,{actions:M})]})}Hp.displayName="FileListContainer";function sh(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 wx extends ai{constructor(e){super("Name already exists"),sh(this,"isExistingFile",!0),sh(this,"info",void 0),this.info=e}}const la=wx;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 lh(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)})}}var jt=B.module("FileExplorer");function Al(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=Fl}=r,[f,p]=v.useState([]),[m,b]=v.useState();v.useEffect(function(){var O;function M(){return A.apply(this,arguments)}function A(){return A=lh(function*(){jt.debug("initTable"),O=ye.makeCancelable(e.getTable(),k=>k.close());try{b(yield O)}catch(k){ye.isCanceled(k)||jt.error("Unable to initialize table",k)}}),A.apply(this,arguments)}return M(),()=>{O.cancel()}},[e]);var g=v.useCallback(L=>{ye.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]),w=v.useCallback(L=>{jt.debug("handleDelete, pending confirmation",L),p(L)},[]),E=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]),x=v.useCallback(()=>{jt.debug("handleDeleteCancel"),p([])},[]),D=v.useCallback((L,O)=>{var M=ee.reducePaths(L.map(A=>mt(A)?ee.makePath(A.filename):A.filename));M.forEach(A=>{var k=ee.isPath(A)?"".concat(O).concat(ee.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(O).concat(ee.getBaseName(A));e.moveFile(A,k).then(()=>{s(A,k)}).catch(g)})},[g,s,e]),T=v.useCallback((L,O)=>{var M=L.filename,A=mt(L);A&&!M.endsWith("/")&&(M="".concat(M,"/"));var k="".concat(ee.getParent(M)).concat(O);A&&!k.endsWith("/")&&(k="".concat(k,"/")),jt.debug2("handleRename",M,k),e.moveFile(M,k).catch(g),s(M,k)},[g,s,e]),I=v.useCallback(function(){var L=lh(function*(O,M){if(M!==O.basename){ee.validateName(M);var A="".concat(ee.getPath(O.filename)).concat(M);try{var k=yield e.info(A);throw new la(k)}catch(H){if(!(H instanceof hs))throw H}}});return function(O,M){return L.apply(this,arguments)}}(),[e]),j=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(Hp,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:S,onCreateFolder:y,onCreateFile:C,onMove:D,onDelete:w,onRename:T,onSelect:d,onSelectionChange:h,rowHeight:c,table:m,validateRename:I}),u.jsx(_n,{isOpen:j,headerText:W,bodyText:"You cannot undo this action.",onCancel:x,onConfirm:E,confirmButtonText:"Delete"})]})}Al.displayName="FileExplorer";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 Px(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 mn(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=Tx(r,"string");return typeof e=="symbol"?e:String(e)}function Tx(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){ye.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=ye.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return Px(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 hs))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 ai))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 ye.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:qg,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(bi,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(La,{toggle:n,children:a}),u.jsx(Ci,{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(Al,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs($a,{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 Vp=Un;function Ox(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:Ec,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(K,{kind:"ghost",icon:Yg,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 uh(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 Dx(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){uh(a,n,i,s,o,"next",l)}function o(l){uh(a,n,i,s,o,"throw",l)}s(void 0)})}}function Bp(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=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 Ln=B.module("FileExplorerPanel"),Nx=(r,e)=>{var t=qf(r),n=Ur(r,e.localDashboardId),{session:i,config:a}=n??{},s=a==null?void 0:a.type;return{fileStorage:t,language:s,session:i}},Mx=Pt(Nx,null,null,{forwardRef:!0});function Lx(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 Lx(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 Dx(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(Ox,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Al,{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(Vp,{isOpen:a,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}Bp(xr,"COMPONENT","FileExplorerPanel");Bp(xr,"TITLE","File Explorer");var Fx=Mx(xr);const Wp=Fx;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 ta(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){ri(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 ri(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=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 Pe=B.module("FilterSetManager"),jx="Enter name...",ch="No Available Filter Sets";class Ia 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),ri(this,"renameInputRef",X.createRef()),ri(this,"dropdownRef",X.createRef()),ri(this,"editDropdownRef",X.createRef()),ri(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;Pe.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){var{isValueShown:e,filterSets:t,selectedId:n,onChange:i}=this.props;if(Pe.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:[]}),Pe.debug("Update sets",n,i),t(n),n.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){var{getFilterState:e}=this.props;Ia.animateScreenFlash();var t=Ee(),n=e(),i={id:t,title:"",panels:n};Pe.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 Pe.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 Pe.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){Pe.error("Renamed set undefined.");return}var s=this.getNameError(t);if(Pe.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,Pe.debug("Renamed existing set",h)):(h.push(l),Pe.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 Pe.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 Pe.debug("Deleted selected set",t,n,a),Pe.debug("New selection",s,o),{modifiedFilterSets:a,editId:o}})}handleSetUpdate(){var{getFilterState:e}=this.props;Ia.animateScreenFlash();var t=e();this.setState(n=>{var{modifiedFilterSets:i,editId:a}=n;if(a===void 0)return Pe.error("Filter for update not selected."),null;var s=[...i],o=s.findIndex(l=>{var{id:d}=l;return d===a});return o<0?(Pe.error("Selected set for update not found."),null):(s[o]=ta(ta({},s[o]),{},{panels:t}),Pe.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 Pe.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){Pe.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){Pe.debug("No filter selected");return}var i=n.find(a=>{var{id:s}=a;return s===e});if(i===void 0){Pe.debug("Selected id not found in filterSets",e,n);return}Pe.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:$s,mask:Jl,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:Zg,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),g=u.jsxs("div",{className:"fa-layers",children:[u.jsx(ne,{icon:$s,mask:Jl,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:Qg,transform:"shrink-1 down-5 right-7"})]});return u.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:u.jsxs(Ha,{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:jx,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:wc}),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:Xg})]}),t!==void 0&&u.jsx("div",{className:"error-message",children:t})]}),u.jsx("div",{className:"form-group",children:u.jsxs(xc,{onChange:this.handleRestoreFullStateChange,value:"".concat(s),children:[u.jsx(Hs,{value:"false",children:"Restore only filters"}),u.jsx(Hs,{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:ch}),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:Pc,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:ch}),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:_c,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:Ra,transform:"grow-4"})})})]},"back")]})})}}const Gp=Ia;function Rl(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})]})}Rl.propTypes={glContainer:Za.Container.isRequired,widgetName:_.string.isRequired,description:_.string};Rl.defaultProps={description:null};function zp(r){if(r==null)return!1;var e=r;return typeof e.table=="string"}function Kp(r){if(r==null)return!1;var e=r;return typeof e.name=="string"}function vh(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?vh(Object(t),!0).forEach(function(n){xe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xe(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)}var kt=B.module("IrisGridPanel"),Ux=500,Hx={IrisGrid:_r,IrisGridTableModel:Kc,ContextMenuRoot:Dc};function fh(r){if(r==null)throw new Error("No metadata provided");if(Kp(r))return r.name;if(zp(r))return r.table;throw new Error("Unable to determine table name from metadata: ".concat(JSON.stringify(r)))}class Ir extends v.PureComponent{constructor(e){super(e),xe(this,"irisGrid",void 0),xe(this,"pluginRef",void 0),xe(this,"modelPromise",void 0),xe(this,"irisGridState",void 0),xe(this,"gridState",void 0),xe(this,"pluginState",void 0),xe(this,"irisGridUtils",void 0),xe(this,"getGridInputFilters",se((n,i)=>Xe.getInputFiltersForColumns(n,i.filter(a=>{var{value:s,excludePanelIds:o}=a,l=F.getIdFromPanel(this);return s!=null&&(o==null||l!=null&&!o.includes(l))})))),xe(this,"getAlwaysFetchColumns",se((n,i)=>{for(var a=F.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]})),xe(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:Hx};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))})})),xe(this,"getDehydratedIrisGridPanelState",se((n,i,a,s)=>Xe.dehydrateIrisGridPanelState(n,{isSelectingPartition:i,partitions:a,advancedSettings:s}))),xe(this,"getDehydratedIrisGridState",se((n,i,a,s,o,l,d,h,c,f,p,m,b,g,C,y,S,w,E,x,D,T)=>(G(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:w,frozenColumns:E,conditionalFormats:x,columnHeaderGroups:D,partitionConfig:T})))),xe(this,"getDehydratedGridState",se((n,i,a,s,o)=>Xe.dehydrateGridState(n,{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:a}))),xe(this,"getCachedPanelState",se((n,i,a,s)=>({irisGridPanelState:n,irisGridState:i,gridState:a,pluginState:s}))),xe(this,"savePanelState",Le(()=>{var{irisGridState:n,gridState:i,pluginState:a}=this;G(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:w,searchValue:E,selectDistinctColumns:x,selectedSearchColumns:D,sorts:T,invertSearchColumns:I,metrics:j,pendingDataMap:W,frozenColumns:L,conditionalFormats:O,columnHeaderGroups:M,partitionConfig:A}=n;G(o),G(j);var{userColumnWidths:k,userRowHeights:H}=j;G(i);var{isStuckToBottom:q,isStuckToRight:re,movedColumns:V,movedRows:N}=i,P=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(o,d,h,c),this.getDehydratedIrisGridState(o,T,f,m,b,g,C,y,S,w,E,x,D,I,k,H,p,W,L,O,M,A),this.getDehydratedGridState(o,V,N,q,re),a);P!==l&&(kt.debug("Saving panel state",this,P),this.setState({panelState:P}),s==null||s(P))},Ux)),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(zc.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:Ie.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 fh(e)}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});var{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=ye.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 Xe(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=Xe.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;G(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):(G(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=F.getIdFromPanel(this),l;s&&(l=Xe.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){ye.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;G(s);var{metrics:d}=s.state;G(d);var{columnHeaderHeight:h,allColumnXs:c,allColumnWidths:f,right:p,columnHeaderMaxDepth:m}=d,b=a.getColumnIndexByName(e);G(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)),w=l.top+h*m;return[S,w]}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}G(i);var{columns:o,formatter:l}=i,d=Xe.changeFilterColumnNamesToIndexes(i.columns,t).filter(c=>{var[f]=c;return i.isFilterable(f)}),h=Xe.changeFilterColumnNamesToIndexes(i.columns,n).filter(c=>{var[f]=c;return i.isFilterable(f)});G(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=Xe.changeFilterColumnNamesToIndexes(e.columns,d)),h&&(l.advancedFilters=Xe.changeFilterColumnNamesToIndexes(e.columns,h));var{isSelectingPartition:c,partitions:f,advancedSettings:p}=Xe.hydrateIrisGridPanelState(e,o);G(this.irisGridUtils);var{advancedFilters:m,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,quickFilters:y,reverseType:S,rollupConfig:w,aggregationSettings:E,sorts:x,userColumnWidths:D,userRowHeights:T,showSearchBar:I,searchValue:j,selectDistinctColumns:W,selectedSearchColumns:L,invertSearchColumns:O,pendingDataMap:M,frozenColumns:A,conditionalFormats:k,columnHeaderGroups:H,partitionConfig:q}=this.irisGridUtils.hydrateIrisGridState(e,hn(hn({},s),l)),{isStuckToBottom:re,isStuckToRight:V,movedColumns:N,movedRows:P}=Xe.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:N,movedRows:P,partitions:f,quickFilters:y,reverseType:S,rollupConfig:w,aggregationSettings:E,sorts:x,userColumnWidths:D,userRowHeights:T,showSearchBar:I,searchValue:j,selectDistinctColumns:W,selectedSearchColumns:L,invertSearchColumns:O,pendingDataMap:M,frozenColumns:A,isStuckToBottom:re,isStuckToRight:V,columnHeaderGroups:H,partitionConfig:q})}catch(R){kt.error("loadPanelState failed to load panelState",t,R)}}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:w,customColumnFormatMap:E,error:x,isDisconnected:D,isFilterBarShown:T,isSelectingPartition:I,isStuckToBottom:j,isStuckToRight:W,isLoaded:L,isLoading:O,isModelReady:M,model:A,movedColumns:k,movedRows:H,partitions:q,partitionConfig:re,quickFilters:V,reverseType:N,rollupConfig:P,sorts:R,userColumnWidths:U,userRowHeights:Q,showSearchBar:me,searchValue:$,selectDistinctColumns:J,selectedSearchColumns:ie,invertSearchColumns:ve,Plugin:we,pluginFilters:Hr,pluginFetchColumns:Qn,pendingDataMap:Vr,frozenColumns:In,columnHeaderGroups:wm}=this.state,Pm=x!=null?"Unable to open table. ".concat(x):void 0,Gl=fh(h),zl=(e=A==null?void 0:A.description)!==null&&e!==void 0?e:void 0,_m=(t=c==null?void 0:c.pluginState)!==null&&t!==void 0?t:null,Tm=n??this.getPluginContent(we,A,f,p,_m),{permissions:Om}=f,{canCopy:Dm,canDownloadCsv:xm}=Om;return u.jsx(Fi,{errorMessage:Pm,isDisconnected:D,isLoading:O,isLoaded:L,className:"iris-grid-panel",glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Gl,widgetType:"Table",description:zl,componentPanel:this,renderTabTooltip:()=>u.jsx(Rl,{model:A,widgetName:Gl,glContainer:i,description:zl}),children:M&&A&&u.jsx(_r,{advancedFilters:g,aggregationSettings:C,advancedSettings:y,alwaysFetchColumns:this.getAlwaysFetchColumns(d,Qn),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",customColumns:w,customColumnFormatMap:E,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:S,inputFilters:this.getGridInputFilters(A.columns,l),applyInputFiltersOnInit:c==null,isFilterBarShown:T,isSelectingColumn:s!=null,isSelectingPartition:I,isStuckToBottom:j,isStuckToRight:W,movedColumns:k,movedRows:H,partitions:q,partitionConfig:re,quickFilters:V,reverseType:N,rollupConfig:P,settings:m,sorts:R,userColumnWidths:U,userRowHeights:Q,model:A,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:Hr,pendingDataMap:Vr,canCopy:Dm,canDownloadCsv:xm,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:In,theme:b,columnHeaderGroups:wm,children:Tm})})}}xe(Ir,"defaultProps",{onStateChange:()=>{},onPanelStateUpdate:()=>{}});xe(Ir,"displayName","IrisGridPanel");xe(Ir,"COMPONENT","IrisGridPanel");var Vx=(r,e)=>{var{localDashboardId:t=Tl}=e;return{inputFilters:is(r,t),links:Zn(r,t),columnSelectionValidator:os(r,t),user:W0(r),workspace:Yf(r),settings:Ii(r)}},Bx=Pt(Vx,null,null,{forwardRef:!0})(Ir);const Nr=Bx;function li(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)}var ph=B.module("InputFilter"),zx=150;class Mr extends v.Component{constructor(e){super(e),li(this,"inputRef",void 0),li(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})),li(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o})},zx)),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)];ph.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;ph.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?Mr.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(Ha,{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:Mr.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:Ra,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}li(Mr,"PLACEHOLDER","Enter value...");li(Mr,"defaultProps",{column:null,isValueShown:!1,value:null});const Kx=Mr;function cs(r,e,t){return e=qx(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qx(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)}var Xx=250;class vs extends v.Component{constructor(e){super(e),cs(this,"inputFilterRef",void 0),this.handleChange=Le(this.handleChange.bind(this),Xx),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(Kx,{ref:this.inputFilterRef,column:n,columns:i,onChange:this.handleChange,isValueShown:a,value:s})})}}cs(vs,"defaultProps",{panelState:null});cs(vs,"COMPONENT","InputFilterPanel");cs(vs,"displayName","InputFilterPanel");var Zx=(r,e)=>{var{localDashboardId:t}=e;return{columns:Nl(r,t)}},Qx=Pt(Zx,null,null,{forwardRef:!0})(vs);const Cr=Qx;function mh(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?mh(Object(t),!0).forEach(function(n){jl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):mh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function jl(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=eI(r,"string");return typeof e=="symbol"?e:String(e)}function eI(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 Be=B.module("FilterSetManagerPanel");function tI(r){return r.setPanelState!=null}class Lr 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){Be.error("Could not get panel",i);return}var a=F.getComponentNameFromPanel(i),s=F.getIdFromPanel(i);Be.debug("Panel:",i,a);var{glContainer:o=null}=i.props;if(o==null){Be.error("Could not get panel container",i);return}var l=F.getComponentConfigFromContainer(o);if(l==null){Be.error("Could not get component config from container",o);return}var d=F.getPanelComponentState(l);if(d==null){Be.debug("Panel state is null ".concat(s));return}switch(a){case F.getComponentName(Ir):{var h;s!=null&&(h=this.getIrisGridPanelFilters(s,d)),h!=null&&t.push({panelId:s,type:a,state:h});break}case F.getComponentName(Cr):case F.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 Be.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=Lr.changeFilterIndexesToColumnNames(i,o));var h;return l&&(h=Lr.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;Be.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;Be.debug("Apply filters from filter set",e),n.forEach(a=>{var{panelId:s,type:o,state:l}=a;if(s==null){Be.debug("panel is null",s);return}if(!t.has(s)){Be.debug("Ignore closed panel",s);return}Be.debug("Apply panel filters",s,o,l);var d=t.get(s);switch(o){case F.getComponentName(Ir):this.restoreIrisGridFilters(d,l,i);break;case F.getComponentName(Cr):case F.getComponentName(Pn):this.restoreInputFilterState(d,l);break}})}handleSetsUpdate(e){var{setDashboardFilterSets:t,localDashboardId:n}=this.props;Be.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=F.getIdFromPanel(e);if(h==null){Be.error("Panel Id is null.");return}var c=d.get(h);if(c==null){Be.error("Unable to get table for panel ".concat(h,"."));return}Be.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,Be.debug("restoreInputFilterState",e,n),e&&tI(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(Gp,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:i,filterSets:n,selectedId:a,getFilterState:this.handleGetFilterState})})})}}jl(Lr,"defaultProps",{panelState:null});jl(Lr,"COMPONENT","FilterSetManagerPanel");var nI=(r,e)=>{var{localDashboardId:t}=e;return{filterSets:Np(r,t),dashboardOpenedPanelMap:El(r,t),dashboardInputFilters:is(r,t),panelTableMap:as(r,t)}},rI=Pt(nI,{setDashboardFilterSets:Rp},null,{forwardRef:!0})(Lr);const da=rI;function pi(r,e,t){return e=iI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iI(r){var e=aI(r,"string");return typeof e=="symbol"?e:String(e)}function aI(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 gh=B.module("LogPanel");class fs extends v.PureComponent{constructor(e){super(e),pi(this,"isBottomVisible",void 0),pi(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){gh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){gh.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($O,{session:n,ref:i=>{this.logView=i}})]})}}pi(fs,"defaultProps",{session:null});pi(fs,"COMPONENT","LogPanel");pi(fs,"TITLE","Log");var sI=(r,e)=>{var t;return{session:(t=Ur(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},oI=Pt(sI,null,null,{forwardRef:!0})(fs);const qp=oI;function lI(r,e,t){return e=dI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dI(r){var e=uI(r,"string");return typeof e=="symbol"?e:String(e)}function uI(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 Yp 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:Pc})]})}),t]})}}lI(Yp,"defaultProps",{isEditing:!1});function hI(r,e,t){return e=cI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cI(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 fI=B.module("MarkdownStartPage");class Xp 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(fI.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(bi,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal",children:[u.jsx(La,{children:"Are you sure you want to permanently delete this note?"}),u.jsx(Ci,{children:"You can't undo this action."}),u.jsxs($a,{children:[u.jsx(K,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),u.jsx(K,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(a)},children:"Delete"})]})]})]})]})})}}hI(Xp,"defaultProps",{closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}});const pI=Xp;function Zp(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=gI(r,"string");return typeof e=="symbol"?e:String(e)}function gI(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 bI=r=>{var{children:e,className:t}=r,n=t!=null&&t!==void 0&&t.startsWith("language-")?t.substring(9):"plaintext";return u.jsx("pre",{children:u.jsx("code",{children:u.jsx(Ja,{language:n,children:X.Children.map(e,i=>typeof i=="string"?i.trim():i)})})})};class Qp extends v.PureComponent{constructor(e){super(e),Zp(this,"container",void 0),this.container=null}render(){var{isEditing:e,content:t,onEditorInitialized:n}=this.props;return u.jsx("div",{className:"markdown-editor-container",ref:i=>{this.container=i},children:e?u.jsx(Wc,{settings:{language:"markdown",value:t,lineNumbers:"off"},onEditorInitialized:n}):u.jsx(pc,{components:{code:bI},children:t})})}}Zp(Qp,"defaultProps",{isEditing:!1,content:""});function di(r,e,t){return e=CI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function CI(r){var e=SI(r,"string");return typeof e=="symbol"?e:String(e)}function SI(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 ra=B.module("MarkdownPanel");class kl extends v.Component{constructor(e){super(e),di(this,"markdownEditor",void 0),di(this,"editor",void 0),di(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){G(this.markdownEditor);var{container:t}=this.markdownEditor;if(this.editor&&t){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=F.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(pI,{closedMarkdowns:o,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):u.jsx(Yp,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:u.jsx(Qp,{ref:l=>{this.markdownEditor=l},isEditing:i,content:s??void 0,onEditorInitialized:this.handleEditorInitialized})})})}}di(kl,"defaultProps",{panelState:null});di(kl,"COMPONENT","MarkdownPanel");var yI=(r,e)=>{var{localDashboardId:t}=e;return{closedPanels:ap(r,t)}},EI=Pt(yI,null,null,{forwardRef:!0})(kl);const ir=EI;function ua(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)}class Jp extends v.PureComponent{constructor(e){super(e),ua(this,"commands",void 0),ua(this,"codeElements",void 0),ua(this,"editorScrollView",void 0),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=X.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}updateHasCode(){var{hasCode:e}=this.state;this.commands.size===0&&e?this.setState({hasCode:!1}):this.commands.size>0&&!e&&this.setState({hasCode:!0})}getNextStartLine(e){var t=[...this.commands.keys()],n=t.findIndex(i=>i===e)+1;return n>=t.length?null:t[n]}handleRunSelected(e){var t,n;e.preventDefault(),e.stopPropagation();var{nextStartLine:i}=this.state,a=[...this.commands.keys()],s=a.findIndex(b=>b===i||i==null);if(!(s<0)){var o=a[s],l=this.commands.get(o),d=this.getNextStartLine(o),h=(t=this.codeElements.get(o))===null||t===void 0?void 0:t.current,c=h==null||(n=h.parentElement)===null||n===void 0?void 0:n.nextElementSibling;if(c!=null){var f,{offsetTop:p}=c,m=p;(f=this.editorScrollView.current)===null||f===void 0||f.scroll({top:m,left:0})}this.runCode(l),this.setState({nextStartLine:d})}}runCode(e){var{onRunCode:t}=this.props;t(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){var{children:t,className:n,inline:i,node:a}=e,{hasRunCode:s,nextStartLine:o}=this.state,{children:l,position:d}=a;G(d);var{start:h}=d,{line:c}=h,f=l[0].value,p=X.createRef(),m=this.commands.size===0,b=o===c||m&&o==null&&!s,g=n!==void 0&&n.startsWith("language-")?n.substring(9):"plaintext";return i!=null&&i?u.jsx("code",{className:n,children:t}):(this.commands.set(c,f),this.codeElements.set(c,p),u.jsxs("div",{className:Y("markdown-notebook-code-block",{"is-selected":b}),ref:p,onClick:()=>{this.setState({nextStartLine:c})},role:"presentation",children:[u.jsx(K,{kind:"ghost",icon:ha,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(f),this.setState({nextStartLine:c})},tooltip:"Run code"}),u.jsx("code",{children:u.jsx(Ja,{language:g,children:X.Children.map(t,C=>typeof C=="string"?C.trim():C)})})]}))}renderLink(e){var{onLinkClick:t}=this.props,{href:n,children:i,target:a}=e;return u.jsx("a",{href:n,onClick:t,target:a,children:i})}render(){var{content:e,transformImageUri:t,transformLinkUri:n}=this.props,{hasCode:i,hasRunCode:a,nextStartLine:s}=this.state;return u.jsxs("div",{className:"markdown-notebook",children:[u.jsx("div",{className:"markdown-notebook-toolbar",children:u.jsx(K,{className:Y("btn-play-selected-cell",{flashing:i&&!a}),kind:"ghost",icon:ha,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:a&&s==null||!i,children:"Run Selected Code"})}),u.jsx("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:u.jsx(pc,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[qm],transformLinkUri:n,transformImageUri:t,includeElementIndex:!0,children:e})})]})}}ua(Jp,"defaultProps",{onRunCode:()=>{}});const _I=Jp;function bh(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 Ch(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){bh(a,n,i,s,o,"next",l)}function o(l){bh(a,n,i,s,o,"throw",l)}s(void 0)})}}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 at(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){ze(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 ze(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=OI(r,"string");return typeof e=="symbol"?e:String(e)}function OI(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("NotebookPanel"),yh=400;class je extends v.Component{static handleError(e){ye.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),ze(this,"pending",void 0),ze(this,"debouncedSavePanelState",void 0),ze(this,"debouncedLoad",void 0),ze(this,"notebook",void 0),ze(this,"tabTitleElement",void 0),ze(this,"tabInitOnce",void 0),ze(this,"editor",void 0),ze(this,"getSettings",se((f,p)=>at(at({},f),{},{minimap:{enabled:p}}))),ze(this,"getOverflowActions",se((f,p)=>[{title:"Find",icon:eb,action:this.handleFind,group:ae.groups.high,shortcut:Je.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:tb,action:this.handleCopy,group:ae.groups.medium,order:20},{title:"Rename File",icon:nb,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?hr:void 0,action:this.handleMinimapChange,group:ae.groups.low,shortcut:Je.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?hr:void 0,action:this.handleWordWrapChange,group:ae.groups.low,shortcut:Je.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),yh),this.debouncedLoad=Le(this.load.bind(this),yh),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);G(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;G(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 Ch(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:a,settings:s}=e.state;G(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 Ch(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;ye.isCanceled(t)||(ye.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){ye.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:w,showDeleteModal:E,showSaveAsModal:x}=this.state,D=f&&!a.isHidden&&!b,T=(e=g==null?void 0:g.itemName)!==null&&e!==void 0?e:je.DEFAULT_NAME,I=T.endsWith(".md"),j=(g==null?void 0:g.id)!=null,W=this.getSettings(S,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=C!=null,O=y===W.language,M=!p||!L||!O,A=!p,k=[{action:this.handleSave,shortcut:wr.SAVE},{action:this.handleMinimapChange,shortcut:Je.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Je.NOTEBOOK.WORDWRAP}],H=mo.getDisabledRunTooltip(L,O,"Notebook extension","Run"),q=mo.getDisabledRunTooltip(L,O,"Notebook extension","Run Selected"),re=[{title:j?"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&&Ma.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:[!I&&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:ha,transform:"grow-4"}),tooltip:"Run ".concat(Je.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:Jg,transform:"grow-4"}),tooltip:"Run Selected ".concat(Je.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),q!=null&&u.jsx(wt,{children:q})]}),u.jsx(K,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:wc,tooltip:"Save ".concat(wr.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(K,{kind:"ghost",className:"btn-overflow",disabled:A,icon:yc,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(En,{actions:this.getDropdownOverflowActions,popperOptions:je.POPPER_OPTIONS})})]}),u.jsx(EO,{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:D,ref:N=>{this.notebook=N}})]}),I&&u.jsx(_I,{content:(n=W.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),u.jsx(Vp,{isOpen:x,type:"file",defaultValue:T,title:j?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(_n,{isOpen:E,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:w,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})]})]})}}ze(je,"COMPONENT","NotebookPanel");ze(je,"POPPER_OPTIONS",{placement:"bottom-end"});ze(je,"DEFAULT_NAME","Untitled");ze(je,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");ze(je,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");ze(je,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var DI=(r,e)=>{var t=qf(r),n=z0(r),i=Ur(r,e.localDashboardId),{session:a,config:s}=i??{},{type:o}=s??{};return{fileStorage:t,defaultNotebookSettings:n,session:a,sessionLanguage:o}},xI=Pt(DI,{updateSettings:o_},null,{forwardRef:!0})(je);const fn=xI;function em(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:_c,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})}function Eh(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 wh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eh(Object(t),!0).forEach(function(n){ps(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Eh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ps(r,e,t){return e=II(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function II(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)}class $l extends v.Component{constructor(e){super(e),ps(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(Nr,wh(wh({ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate},this.props),{},{children:u.jsx(em,{onClick:this.handleReload})}))}}ps($l,"defaultProps",{panelState:null});ps($l,"COMPONENT","PandasPanel");const tm=$l;function Ph(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 _h(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ph(a,n,i,s,o,"next",l)}function o(l){Ph(a,n,i,s,o,"throw",l)}s(void 0)})}}function Th(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{constructor(e){Th(this,"items",void 0),Th(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 _h(function*(){throw new Error("Method not implemented.")})()}setViewport(e){var t=this;return _h(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 AI=FI;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 Kr(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 RI(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)}class $I{constructor(e){RI(this,"items",void 0),this.items=e}getTable(){var e=this;return Kr(function*(){return new AI(e.items)})()}saveFile(e){throw new Error("Method not implemented.")}loadFile(e){throw new Error("Method not implemented.")}copyFile(e,t){return Kr(function*(){throw new Error("Method not implemented.")})()}deleteFile(e){var t=this;return Kr(function*(){t.items=t.items.filter(n=>n.filename!==e)})()}moveFile(e,t){var n=this;return Kr(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 Kr(function*(){var n=t.items.filter(a=>a.filename===e);if(n.length===0)throw new hs;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 UI=$I;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 Na(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){HI(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 HI(r,e,t){return e=VI(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function VI(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)}function xh(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 WI(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){xh(a,n,i,s,o,"next",l)}function o(l){xh(a,n,i,s,o,"throw",l)}s(void 0)})}}function GI(r,e,t,n,i,a){return So.apply(this,arguments)}function So(){return So=WI(function*(r,e,t,n,i,a){var s,o,l,d;if(br(n)?(s=n.settings,o=n.table,l=void 0,d=n.tableSettings):(s={},o="",l=Ll(n)?n.figure:n.name,d={}),a!=null&&(a.tableSettings!=null&&(d=a.tableSettings),a.table!=null&&(o=a.table),a.figure!=null&&(l=a.figure),a.settings!=null&&(s=Na(Na({},s),a.settings))),l==null&&o==null){var h=yield i();return pr.makeModel(r,s,h,e)}if(l!=null){var c;if(n.type===r.VariableType.FIGURE){var f={name:l,type:r.VariableType.FIGURE};c=yield t(f)}else c=yield i();return pr.makeModel(r,s,c,e)}var p={name:o,type:r.VariableType.TABLE},m=yield t(p);return new Xe(r).applyTableSettings(m,d,Cl($_.getState())),pr.makeModelFromSettings(r,s,m,e)}),So.apply(this,arguments)}var Ul=v.forwardRef((r,e)=>{var t=He(),n=Ti(),i=Fv(),a=$p(r)?r.panelState:void 0,{fetch:s,metadata:o,localDashboardId:l}=r,d=v.useMemo(()=>({metadata:o,localDashboardId:l,makeModel:()=>{if(o==null)throw new Error("Metadata is required for chart panel");return GI(t,n,i,o,s,a)}}),[o,l,t,n,i,s,a]);return u.jsx(Ai,Na(Na({ref:e},r),d))});Ul.displayName="ChartPanelPlugin";const zI=Ul;function Ih(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 KI(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Ih(a,n,i,s,o,"next",l)}function o(l){Ih(a,n,i,s,o,"throw",l)}s(void 0)})}}function nm(r){var e=He(),t=Ti(),[n,i]=v.useState(),{fetch:a}=r;return v.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=KI(function*(){var d=yield a(),h=yield pr.makeModel(e,void 0,d,t);s||i(h)}),l.apply(this,arguments)}return o(),()=>{s=!0}},[e,a,t]),n?u.jsx(dl,{model:n}):null}var qI={name:"ChartPanel",title:"Chart",type:nt.WIDGET_PLUGIN,component:nm,panelComponent:Ul,supportedTypes:"Figure",icon:Do};const YI=qI;function rm(r){Kn(r);var{id:e,layout:t}=r,n=He(),i=Ti(),a=v.useCallback(s=>{var{metadata:o,panelId:l=Ee.generate(),table:d}=s,{settings:h}=o,c=()=>pr.makeModelFromSettings(n,h,d,i),f=Me.titleFromSettings(h),p={type:"react-component",component:Ai.COMPONENT,props:{localDashboardId:e,id:l,metadata:o,makeModel:c},title:f,id:l},{root:m}=t;F.openComponent({root:m,config:p})},[i,n,e,t]);return ce(t.eventHub,Et.CREATE_CHART,a),null}var XI={name:"ChartBuilderPlugin",type:nt.DASHBOARD_PLUGIN,component:rm};const ZI=XI;function Nh(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 Mh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nh(Object(t),!0).forEach(function(n){QI(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Nh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function QI(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=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)}var Oe=B.module("ConsolePlugin");function Lh(r){return r.notebook!==void 0}function tN(r){Kn(r)}function nN(r){tN(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=mi(),p=v.useCallback(()=>i.getLastUsedPanelOfType(oa),[i]),m=v.useCallback((N,P)=>{d(R=>new Map(R.set(N,P)))},[d]),b=v.useCallback(N=>{d(P=>(P.delete(N),new Map(P)))},[d]),g=v.useCallback((N,P)=>{c(R=>new Map(R.set(N,P)))},[c]),C=v.useCallback(N=>{c(P=>(P.delete(N),new Map(P)))},[c]),y=v.useCallback(function(N){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,U=N&&N.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: ",N,P,R),Q.addCommand(N,P,R)}},[p]),S=v.useCallback(N=>{f(Ap(e,N))},[f,e]),w=v.useCallback(N=>{var{language:P}=N,R=P==="python"?"py":P,U=null;return R==null?(Oe.debug("No extension for language",P),U="Untitled-".concat(o.current)):U="Untitled-".concat(o.current,".").concat(R),o.current+=1,U},[]),E=v.useCallback(function(N){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:R}=N;if(R!=null&&l.has(R))return l.get(R);if(R!=null&&h.has(R))return h.get(R);if(P)return Ee.generate()},[l,h]),x=v.useCallback((N,P)=>{F.renameComponent(n.root,{id:N},P)},[n.root]),D=v.useCallback((N,P)=>{Oe.debug("Rename file panel",N,P);var R;if(l.has(N)&&(R=l.get(N),b(N),R!=null&&m(P,R)),h.has(N)&&(R=h.get(N),C(N),R!=null&&g(P,R)),R===void 0){Oe.debug2("File ".concat(N," isn't open, no need to rename the tab"));return}x(R,ee.getBaseName(P))},[l,h,x,m,g,b,C]),T=v.useCallback(N=>{var P=E(N,!1);if(P==null){Oe.error("Could not find panel id for file metadata",N);return}F.activateTab(n.root,{id:P})},[E,n.root]),I=v.useCallback((N,P,R)=>{if(Oe.debug("registerFilePanel",N,P,R),P==null||P.id==null){Oe.debug("Ignore empty file id",P);return}var{id:U}=P;if(R){g(U,N);return}if(l.has(U)){var Q=l.get(U);if(N===Q){Oe.debug("Update tab title for file ".concat(U));var{itemName:me}=P;D(U,me)}else Oe.error("File ".concat(U," already associated with a different tab ").concat(Q));return}m(U,N),h.has(U)&&C(U)},[l,h,D,m,g,C]),j=v.useCallback((N,P)=>{if(Oe.debug("unregisterFileTab",N,P),N==null||N.id==null){Oe.debug("Ignore empty file id",N);return}var{id:R}=N;if(P){C(R);return}b(R)},[b,C]),W=v.useCallback((N,P)=>{Oe.debug("closeFilePanel",N);var{id:R}=N,U=null,Q=!1;if(l.has(R))U=l.get(R);else if(h.has(R))U=h.get(R),Q=!0;else{Oe.debug("File ".concat(R," isn't open, ignore close event"));return}j(N,Q),F.closeComponent(n.root,{id:U},P)},[n.root,l,h,j]),L=v.useCallback(N=>{var{itemName:P}=N;return ee.getBaseName(P)},[]),O=v.useCallback(N=>{var{id:P}=N;return Oe.debug("fileIsOpen",N,P,l),P!=null&&l.has(P)},[l]),M=v.useCallback(N=>{var{id:P}=N;return Oe.debug("fileIsOpenAsPreview",N,P,h),P!=null&&h.has(P)},[h]),A=v.useCallback(N=>{if(N!=null){var P=i.getOpenedPanelById(N);P&&Lh(P)&&P.focus()}},[i]),k=v.useCallback(N=>{var{id:P,settings:R,fileMetadata:U,session:Q,sessionLanguage:me,isPreview:$=!1}=N,J={settings:R,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(N,P,R){var U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:w(R)},Q=E(U);if(O(U)&&Q!=null){Oe.debug("File is already open, focus panel"),T(U),A(Q);return}var me=F.getStackForComponentTypes(n.root,[fn.COMPONENT]),$=k({id:Q,settings:R,fileMetadata:U,session:N,sessionLanguage:P});Oe.debug("createNotebook",$,l),F.openComponentInStack(me,$)},[O,A,w,E,n.root,k,l,T]),q=v.useCallback(function(N,P,R,U){var Q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;Oe.debug("selectNotebook",U,Q);var me=O(U),$=M(U),[J]=[...h.values()],ie=!Q,ve=ie&&J?J:E(U);if(ve==null||ve==="")throw new Error("Unable to retrieve or create panelId for metadata",U);if(me||$)T(U);else{var we=F.getStackForComponentTypes(n.root,[fn.COMPONENT]),Hr=k({id:ve,settings:R,fileMetadata:U,session:N,sessionLanguage:P,isPreview:ie});F.openComponentInStack(we,Hr)}if($&&Q){var Qn=U.id,Vr=F.getStackForConfig(n.root,{component:fn.COMPONENT,id:ve}),In=F.getContentItemInStack(Vr,{component:fn.COMPONENT,id:ve});In&&ht(In)&&(In.container.emit(he.PROMOTE_FROM_PREVIEW),C(Qn),m(Qn,ve))}Q&&A(ve)},[T,O,M,A,E,n.root,k,h,C,m]),re=v.useCallback(function(N,P){var R=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&&Lh(Q)?R!=null&&R.value!=null&&Q.notebook!=null&&Q.notebook.append(R.value):U&&H(N,P,R)},[H,i]),V=v.useCallback((N,P)=>Bf.hydrate(Mh(Mh({},N),{},{notebooksUrl:s}),P),[s]);return An(a,oa,t),An(a,Up),An(a,Wp),An(a,qp),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,x),ce(n.eventHub,he.RENAME_FILE,D),ce(n.eventHub,he.SEND_TO_NOTEBOOK,re),ce(n.eventHub,he.REGISTER_FILE,I),ce(n.eventHub,he.UNREGISTER_FILE,j),null}var qr=B.module("FilterPlugin");function Fh(r,e){return r.concat(e)}function im(r){Kn(r);var{id:e,layout:t,registerComponent:n}=r,i=mi(),[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(Fh,[]).sort((S,w)=>{var E=Ot.toLower(S.name),x=Ot.toLower(w.name);if(E!==x)return E>x?1:-1;var D=Ot.toLower(S.type),T=Ot.toLower(w.type);return D!==T?D>T?1:-1:0}).reduce((S,w)=>((S.length===0||Ot.toLower(S[S.length-1].name)!==Ot.toLower(w.name)||Ot.toLower(S[S.length-1].type)!==Ot.toLower(w.type))&&S.push(w),S),[]),C=Array.from(s.values()).reduce(Fh,[]).sort((S,w)=>S.timestamp-w.timestamp),y=new Map(o);qr.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)=>{qr.debug2("handleColumnsChanged",g,C),a.set(g,[].concat(C)),l()},[a,l]),h=v.useCallback((g,C)=>{qr.debug2("handleFiltersChanged",g,C),s.set(g,[].concat(C)),l()},[s,l]),c=v.useCallback((g,C)=>{qr.debug2("handleTableChanged",g,C),o.set(F.getIdFromPanel(g),C),l()},[o,l]),f=v.useCallback(g=>{qr.debug2("handlePanelUnmount",g),a.delete(g),s.delete(g),o.delete(F.getIdFromPanel(g)),l()},[a,s,o,l]),p=v.useCallback(g=>{var{title:C="DropdownFilter",metadata:y={},panelState:S=null,id:w=Ee.generate(),focusElement:E=F.DEFAULT_FOCUS_SELECTOR,createNewStack:x=!1,dragEvent:D=null}=g,T={type:"react-component",component:Pn.COMPONENT,props:{id:w,metadata:y,panelState:S,localDashboardId:e},title:C,id:w},{root:I}=t;F.openComponent({root:I,config:T,focusElement:E,createNewStack:x,dragEvent:D})},[t,e]),m=v.useCallback(g=>{var{title:C="InputFilter",metadata:y={},panelState:S=null,id:w=Ee.generate(),focusElement:E=F.DEFAULT_FOCUS_SELECTOR,createNewStack:x=!1,dragEvent:D=void 0}=g,T={type:"react-component",component:Cr.COMPONENT,props:{id:w,metadata:y,panelState:S,localDashboardId:e},title:C,id:w},{root:I}=t;F.openComponent({root:I,config:T,focusElement:E,createNewStack:x,dragEvent:D})},[t,e]),b=v.useCallback(g=>{var{title:C="FilterSets",metadata:y={},panelState:S=null,id:w=Ee.generate(),focusElement:E=F.DEFAULT_FOCUS_SELECTOR,createNewStack:x=!1,dragEvent:D=null}=g,T={type:"react-component",component:da.COMPONENT,props:{id:w,metadata:y,panelState:S,localDashboardId:e},title:C,id:w},{root:I}=t;F.openComponent({root:I,config:T,focusElement:E,createNewStack:x,dragEvent:D})},[t,e]);return v.useEffect(function(){var C=[n(Pn.COMPONENT,Pn),n(Cr.COMPONENT,Cr),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 rN={name:"FilterPlugin",type:nt.DASHBOARD_PLUGIN,component:im};const iN=rN;var aN=B.module("@deephaven/app-utils/useTablePlugin");function am(){var r=Ga(),e=v.useCallback(t=>{var n=r.get(t);if(n!=null){if(nf(n))return n.component;if(ol(n))return n.TablePlugin}var i="Unable to find table plugin ".concat(t,".");throw aN.error(i),new Error(i)},[r]);return e}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 sN(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)})}}function sm(r,e,t){var n=He(),i=am(),a=v.useMemo(()=>({loadPlugin:i,localDashboardId:e,makeModel:function(){var s=sN(function*(){var l=yield r();return ka.makeModel(n,l)});function o(){return s.apply(this,arguments)}return o}(),metadata:t}),[n,r,e,i,t]);return a}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 jh(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){oN(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 oN(r,e,t){return e=lN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lN(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 Hl=v.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=sm(n,t,i);return u.jsx(Nr,jh(jh({ref:e},r),a))});Hl.displayName="GridPanelPlugin";const uN=Hl;function kh(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 hN(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){kh(a,n,i,s,o,"next",l)}function o(l){kh(a,n,i,s,o,"throw",l)}s(void 0)})}}function om(r){var e=He(),[t,n]=v.useState(),{fetch:i}=r;return v.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=hN(function*(){var l=yield i(),d=yield ka.makeModel(e,l);a||n(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(_r,{model:t}):null}var cN={name:"IrisGridPanel",title:"Table",type:nt.WIDGET_PLUGIN,component:om,panelComponent:Hl,supportedTypes:["Table","TreeTable","HierarchicalTable","PartitionedTable"],icon:xo};const vN=cN;function $h(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?$h(Object(t),!0).forEach(function(n){lm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):$h(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function lm(r,e,t){return e=fN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fN(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)}function dm(r){var e=r;return typeof e.getCoordinateForColumn=="function"}function Uh(r){var e=r;return dm(r)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function Hh(r){var e;return r.description===void 0||!((e=r.description)!==null&&e!==void 0&&e.startsWith("Preview of type: "))}var Yr=B.module("LinkerUtils");class ms{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 Yr.debug2("Incompatible panel ids",e,t,n),"invalid";if(e.panelComponent==null||t.panelComponent==null)return Yr.error("PanelComponent should not be null",e,t),"invalid";var a=(i=ms.ALLOWED_LINKS.get(e.panelComponent))===null||i===void 0?void 0:i.includes(t.panelComponent);if(a===void 0||!a)return Yr.debug2("Incompatible panel components",e,t),"invalid";var{columnType:s}=e,{columnType:o}=t,l=o===null||Ie.isCompatibleType(s,o);if(!l)return Yr.debug2("Incompatible type",s,o),"invalid";switch(t.panelComponent){case F.getComponentName(Ai):return"chartLink";case F.getComponentName(Nr):return"tableLink";case F.getComponentName(Pn):return"filterSource"}return Yr.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:Ee.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:Ee.generate(),end:cn(cn({},a.end),{},{panelId:n})}))}),i}}lm(ms,"ALLOWED_LINKS",new Map([[F.getComponentName(Nr),[F.getComponentName(Nr),F.getComponentName(Ai),F.getComponentName(Pn)]]]));const Fn=ms;function um(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 bN=B.module("LinkerLink"),Vh=.015,Bh=1.5,hm=12,cm=12,Wh=2,ia=Math.sqrt((cm*.5)**2+hm**2),Gh=Math.asin(cm*.5/hm),zh=15,vn=Math.PI*.5;class Sr 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(Ie.isNumberType(e)||Ie.isCharType(e))return _C(t);if(Ie.isTextType(e))return TC(t);if(Ie.isDateType(e))return OC(t);if(Ie.isBooleanType(e)){if(t===Zr.eq)return"is equal to";if(t===Zr.notEq)return"is not equal to"}throw new Error("Unrecognized column type: ".concat(e))}catch(n){return bN.warn(n),""}}constructor(e){super(e),um(this,"getOperators",se((t,n)=>{var{onOperatorChanged:i}=this.props,a=Ie.getFilterTypes(n);return Ie.isBooleanType(n)&&(a=[Zr.eq,Zr.notEq]),a.flatMap((s,o)=>{if(s==="eqIgnoreCase"||s==="notEqIgnoreCase")return[];var l="";return s==="startsWith"?l="a*":s==="endsWith"?l="*z":l=Ie.getFilterOperatorString(s),[{title:Sr.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,w=Math.max(y,Math.min(i+(s-i)/2+m*(f*Vh)**Bh,g)),E=Math.max(S,Math.min(a+(o-a)/2+b*(f*Vh)**Bh,C)),x="M ".concat(i," ").concat(a," Q ").concat(w," ").concat(E," ").concat(s," ").concat(o),D="M ".concat(y," ").concat(S," L ").concat(y," ").concat(C," L ").concat(g," ").concat(C," L ").concat(g," ").concat(S,` z
|
|
25
|
+
`).concat(Sr.makeCirclePath(i,a,zh),`
|
|
26
|
+
`).concat(Sr.makeCirclePath(s,o,zh)),T="link-select-clip-".concat(l),I=Math.atan2(o-E,s-w),j=I-Gh+Math.PI,W=I+Gh+Math.PI,L=s+Math.cos(I)*Wh,O=o+Math.sin(I)*Wh,M=L+Math.cos(j)*ia,A=O+Math.sin(j)*ia,k=L+Math.cos(W)*ia,H=O+Math.sin(W)*ia,q="".concat(L,",").concat(O," ").concat(M,",").concat(A," ").concat(k,",").concat(H),re=.25*i+.5*w+.25*s,V=.25*a+.5*E+.25*o,N=w-i+(s-w),P=E-a+(o-E),R=P/N,U=20,Q=U/Math.sqrt(1+R**2),me=Q*R,$=Q*-1,J=me*-1;Number.isFinite(R)?R>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)):R<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=Ie.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:D,clipRule:"evenodd"})}),u.jsx("path",{className:"link-select",d:x,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:"url(#".concat(T,")"),"data-testid":"link-select"}),u.jsx("path",{className:"link-background",d:x}),u.jsx("path",{className:"link-foreground",d:x}),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+(R>=0?me:J),left:re+(R>=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+(R<0?me:J),left:re+(R<0?Q:$)},onClick:this.handleDelete,icon:Wn,tooltip:"Delete"})]})]})}}um(Sr,"defaultProps",{className:"",isSelected:!1,onClick(){},onDelete(){}});const CN=Sr;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){Vl(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 Vl(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=yN(r,"string");return typeof e=="symbol"?e:String(e)}function yN(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 Rs=B.module("LinkerOverlayContent");class vm extends v.Component{constructor(e){super(e),Vl(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){Rs.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(!dm(a))throw new Error("Panel does not have getCoordinateForColumn method: ".concat(n));try{var s=a.getCoordinateForColumn(i);if(s!=null)return s}catch{Rs.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 F.getTabPoint(o)}handleOperatorChanged(e,t){var{links:n,onLinksUpdated:i}=this.props,a=n.map(s=>s.id===e?qh(qh({},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:w,end:E,operator:x}=m,D=w.columnType,[T,I]=this.getPointFromLinkPoint(w),j=(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:I;if(E!=null&&([j,W]=this.getPointFromLinkPoint(E)),S!=null&&S){var[L,O]=[T,I];[T,I]=[j,W],[j,W]=[L,O]}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:I,x2:j,y2:W,id:C,className:M,operator:x,startColumnType:D,type:y}}catch(A){return Rs.warn("Unable to get point for link",m,A),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:w,operator:E,startColumnType:x,type:D}=m;return u.jsx(CN,{className:w,id:S,x1:b,y1:g,x2:C,y2:y,onClick:a,onDelete:s,isSelected:n.has(S),operator:E,startColumnType:x,type:D,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:rb,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:wr.LINKER_CLOSE,isGlobal:!0}]})]})}}Vl(vm,"defaultProps",{disabled:"false"});const EN=vm;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){fm(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 fm(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 Ae=B.module("Linker"),_N=(r,e)=>({activeTool:Sl(r),dh:Gf(r),isolatedLinkerPanelId:ss(r,e.localDashboardId),links:Zn(r,e.localDashboardId),timeZone:Cl(r)}),TN=Pt(_N,{setActiveTool:Jf,setDashboardLinks:ls,addDashboardLinks:Mp,deleteDashboardLinks:Lp,setDashboardIsolatedLinkerPanelId:Ml,setDashboardColumnSelectionValidator:Fp});class ON extends v.Component{constructor(e){super(e),fm(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(Da.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(Da.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=F.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=F.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(!Hh(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=F.getIdFromPanel(e);if(o!=null){var l=F.getComponentNameFromPanel(e),{name:d,type:h}=t;if(s==null||s.start==null){var c={id:Ee.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:I}=T;return(I==null?void 0:I.panelId)===y});this.deleteLinks(S);break}case"chartLink":{var w=b===!0?p:g,E=b===!0?g:p;Ae.debug("creating chartlink",{existingLinkEnd:w,start:p,end:g});var x=f.filter(T=>{var{end:I,start:j}=T;return(j==null?void 0:j.panelId)===E.panelId&&(I==null?void 0:I.panelId)===w.panelId&&(I==null?void 0:I.columnName)===w.columnName&&(I==null?void 0:I.columnType)===w.columnType});this.deleteLinks(x);break}}var D={start:b!==void 0&&b?g:p,end:b!==void 0&&b?p:g,id:m,type:C,operator:Zr.eq};Ae.info("creating link",D),this.setState({linkInProgress:void 0,selectedIds:new Set([m])},()=>{this.addLinks([D])})}}}}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?Uh(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?Uh(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=F.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:w}=t[d.columnName],E="".concat(w);if(w===null&&y&&S&&(w=void 0),m!=null&&Ie.isDateType(m)){var x=new Lo(i,{timeZone:s,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Fo.FULL_DATE_FORMAT});E=x.format(w)}var D={operator:c,text:E,value:w,startColumnIndex:C};g.push(D),b.set(p,{columnType:m,filterList:g}),o.set(f,b)}}o.forEach((T,I)=>{this.setPanelFilterMap(I,T)})}handlePanelCloned(e,t){var{links:n}=this.props,i=F.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:Xh(Xh({},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(!Hh(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=F.getIdFromPanel(e);if(o==null)return!1;var l={panelId:o,panelComponent:F.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(EN,{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 DN=TN(ON);const xN=DN;function pm(r){Kn(r);var{id:e,layout:t,panelManager:n}=r;return u.jsx(xN,{layout:t,localDashboardId:e,panelManager:n})}var IN={name:"LinkerPlugin",type:nt.DASHBOARD_PLUGIN,component:pm};const NN=IN;function mm(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=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)}class Fr{static getNewMarkdownTitle(e){for(var t="".concat(Fr.DEFAULT_TITLE),n=0;e.indexOf(t)>=0;)n+=1,t="".concat(Fr.DEFAULT_TITLE,"-").concat(n);return t}}mm(Fr,"DEFAULT_TITLE","Note");mm(Fr,"DEFAULT_CONTENT",`# Markdown Note
|
|
27
|
+
|
|
28
|
+
This note can be edited using **markdown** for styling.`);const js=Fr;function gm(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===js.DEFAULT_CONTENT?null:qa(o)},[]),s=v.useCallback(function(){var{title:o="",metadata:l={},id:d=Ee.generate(),focusElement:h=F.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(w=>{var E;return(E=w.title)!==null&&E!==void 0?E:""}),g=o!=null&&o!==""?o:js.getNewMarkdownTitle(b),C=m.length>0?null:js.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;F.openComponent({root:S,config:y,focusElement:h,createNewStack:c,dragEvent:f})},[e,t,n]);return v.useEffect(function(){var l=[i(ir.COMPONENT,ir,Ya,a)];return()=>{l.forEach(d=>d())}},[a,i]),ce(t.eventHub,wp.OPEN,s),null}var FN={name:"MarkdownPlugin",type:nt.DASHBOARD_PLUGIN,component:gm};const AN=FN;function Zh(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?Zh(Object(t),!0).forEach(function(n){RN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Zh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function RN(r,e,t){return e=jN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jN(r){var e=kN(r,"string");return typeof e=="symbol"?e:String(e)}function kN(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 Bl=v.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=sm(n,t,i);return u.jsx(tm,Qh(Qh({ref:e},r),a))});Bl.displayName="PandasPanelPlugin";const $N=Bl;function Jh(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 ks(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function s(l){Jh(a,n,i,s,o,"next",l)}function o(l){Jh(a,n,i,s,o,"throw",l)}s(void 0)})}}function bm(r){var e=He(),[t,n]=v.useState(),[i,a]=v.useState(!0),[s,o]=v.useState(!1),{fetch:l}=r,d=v.useCallback(ks(function*(){var c=yield l();return ka.makeModel(e,c)}),[e,l]),h=v.useCallback(ks(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=ks(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(tt,{isLoaded:s,isLoading:i}),t&&u.jsx(_r,{model:t,children:u.jsx(em,{onClick:h})})]})}var UN={name:"PandasPanel",title:"Pandas",type:nt.WIDGET_PLUGIN,component:bm,panelComponent:Bl,supportedTypes:"pandas.DataFrame",icon:Sc};const HN=UN;function ec(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 Xr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ec(Object(t),!0).forEach(function(n){VN(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ec(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function VN(r,e,t){return e=BN(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function BN(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)}var GN=B.module("WidgetLoaderPlugin");function zN(r){var e;function t(n,i){var a,s=r.component,{metadata:o}=n,l=bl(s);return u.jsx(Fi,Xr(Xr({widgetName:(a=o==null?void 0:o.name)!==null&&a!==void 0?a:void 0,widgetType:r.title},n),{},{children:l?u.jsx(s,Xr(Xr({},n),{},{ref:i})):u.jsx(s,Xr({},n))}))}return t.displayName="WidgetLoaderPlugin(".concat((e=r.component.displayName)!==null&&e!==void 0?e:r.name,")"),v.forwardRef(t)}function Cm(r){var e=Ga(),t=v.useMemo(()=>{var o=new Map;return e.forEach(l=>{_i(l)&&[l.supportedTypes].flat().forEach(d=>{if(d!=null&&d!==""){if(o.has(d)){var h;GN.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=Ee.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;F.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,zN(l)):a(l.name,d)});return()=>{o.forEach(l=>l())}},[a,t]),ce(i.eventHub,te.OPEN,s),null}var KN={name:"WidgetLoaderPlugin",type:nt.DASHBOARD_PLUGIN,component:Cm};const qN=KN;function gs(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=XN(r,"string");return typeof e=="symbol"?e:String(e)}function XN(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{}gs(ji,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");gs(ji,"INPUT_FILTER","ControlType.INPUT_FILTER");gs(ji,"MARKDOWN","ControlType.MARKDOWN");gs(ji,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const ZN=ji;var QN=_.shape({state:_.shape({panelState:_.shape({})})}),JN=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired,columnType:_.string.isRequired}),tc=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired}),Sm=_.shape({start:tc,end:tc,id:_.string,isReversed:_.bool}),eM=_.arrayOf(Sm),tM=_.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}),nM=Object.freeze({LinkPoint:JN,Link:Sm,Links:eM,Panel:QN,User:tM});const rM=nM;var iM=(r,e)=>r[e]===null?null:_.bool,aM=(r,e)=>r[e]===null?null:_.string,sM=Object.freeze({nullableBoolean:iM,nullableString:aM});const oM=sM,lM=Object.freeze(Object.defineProperty({__proto__:null,ChartBuilderPlugin:rm,ChartBuilderPluginConfig:ZI,ChartEvent:Da,ChartPanel:Ai,ChartPanelPlugin:zI,ChartPluginConfig:YI,ChartWidgetPlugin:nm,CommandHistoryPanel:Up,CommonPropTypes:oM,ConsoleEvent:pt,ConsolePanel:oa,ConsolePlugin:nN,ControlType:ZN,DropdownFilterPanel:Pn,FileExplorerPanel:Wp,FilterPlugin:im,FilterPluginConfig:iN,FilterSetManager:Gp,FilterSetManagerPanel:da,GridPanelPlugin:uN,GridPluginConfig:vN,GridWidgetPlugin:om,InputFilterEvent:Te,InputFilterPanel:Cr,IrisGridEvent:Et,IrisGridPanel:Nr,LinkerPlugin:pm,LinkerPluginConfig:NN,LinkerUtils:Fn,LogPanel:qp,MarkdownEvent:wp,MarkdownPanel:ir,MarkdownPlugin:gm,MarkdownPluginConfig:AN,MockFileStorage:UI,NotebookEvent:he,NotebookPanel:fn,PandasEvent:vD,PandasPanel:tm,PandasPanelPlugin:$N,PandasPluginConfig:HN,PandasWidgetPlugin:bm,Panel:Wt,TabEvent:ni,ToolType:Nt,UIPropTypes:rM,WidgetLoaderPlugin:Cm,WidgetLoaderPluginConfig:qN,WidgetPanel:Fi,WidgetPanelTooltip:Li,addDashboardLinks:Mp,deleteDashboardLinks:Lp,getColumnSelectionValidatorForDashboard:os,getColumnsForDashboard:Nl,getDashboardConnection:ID,getDashboardConsoleSettings:xD,getDashboardSessionWrapper:Ur,getFilterSetsForDashboard:Np,getInputFiltersForDashboard:is,getIsolatedLinkerPanelIdForDashboard:ss,getLinksForDashboard:Zn,getTableMapForDashboard:as,isChartPanelDehydratedProps:$p,isChartPanelFigureMetadata:Ll,isChartPanelTableMetadata:br,isGLChartPanelState:kp,isIrisGridPanelMetadata:Kp,isLegacyIrisGridPanelMetadata:zp,setDashboardColumnSelectionValidator:Fp,setDashboardConnection:ND,setDashboardConsoleSettings:Ap,setDashboardFilterSets:Rp,setDashboardIsolatedLinkerPanelId:Ml,setDashboardLinks:ls,setDashboardSessionWrapper:MD,useLoadTablePlugin:am},Symbol.toStringTag,{value:"Module"}));var ym={react:X,"react-dom":Ma,redux:Ym,"react-redux":Xm,"@adobe/react-spectrum":Zm,"@deephaven/auth-plugins":mw,"@deephaven/chart":Uw,"@deephaven/components":Gy,"@deephaven/dashboard":fT,"@deephaven/dashboard-core-plugins":lM,"@deephaven/icons":ib,"@deephaven/iris-grid":eD,"@deephaven/jsapi-bootstrap":Yy,"@deephaven/jsapi-components":$E,"@deephaven/jsapi-utils":lE,"@deephaven/log":B,"@deephaven/plugin":WE,"@deephaven/react-hooks":uS},dM=Qm.createRequires(ym),uM=Jm({requires:dM});const hM=uM;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 Wl(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 gn=B.module("@deephaven/app-utils.PluginUtils");function cM(r){return yo.apply(this,arguments)}function yo(){return yo=Wl(function*(r){var e=yield hM(r);return e}),yo.apply(this,arguments)}function vM(r){return Eo.apply(this,arguments)}function Eo(){return Eo=Wl(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")}}),Eo.apply(this,arguments)}function fM(r){return wo.apply(this,arguments)}function wo(){return wo=Wl(function*(r){gn.debug("Loading plugins...");try{var e=yield vM("".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(cM(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}}),wo.apply(this,arguments)}function pM(r){var e,t;return(e=(t=r.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function mM(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,n=pM(e),i=[...r.entries(),...t.entries()].filter(l=>{var[,d]=l;return rf(d)||ba(d)}).map(l=>{var[d,h]=l;return ba(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 gM=mc.createRequires(()=>ym),bM=mc.createRemoteComponent({requires:gM});const BM=bM;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 CM(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)})}}function SM(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=CM(function*(){var h,c=(h=yield t==null?void 0:t())!==null&&h!==void 0?h:[],f=yield fM(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(Pi.Provider,{value:i,children:n})}function yM(){var r=nl();return v.useEffect(function(){r.postMessage(Qo(Zo))},[r]),null}function ic(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){ic(a,n,i,s,o,"next",l)}function o(l){ic(a,n,i,s,o,"throw",l)}s(void 0)})}}var wM=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:hf}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:pf}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:uf}]]);function PM(r){var{children:e}=r,t=Gn(),n=v.useContext(Pi),[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=EM(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 mM(n,i,wM)}catch(h){o(h)}},[i,n]),d=l==null||i==null;return d||s!=null?u.jsx(tt,{isLoading:d&&s==null,errorMessage:Tr(s)}):u.jsx(l,{authConfigValues:i,children:u.jsxs(u.Fragment,{children:[u.jsx(yM,{}),e]})})}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 sc(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 _M=B.module("@deephaven/app-utils.ConnectionBootstrap");function TM(r){var{children:e}=r,t=He(),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=sc(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;_M.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=sc(function*(h){return G(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(tt,{"data-testid":"connection-bootstrap-loading",isLoading:s==null,errorMessage:i!=null?"".concat(i):void 0}):u.jsx(DC.Provider,{value:s,children:u.jsx(Xo.Provider,{value:l,children:e})})}function WM(r){return new URL(r,"".concat(window.location))}function OM(){var r=new URLSearchParams(window.location.search);return r.get("envoyPrefix")}function DM(){var r=OM();return r!=null?{headers:{"envoy-prefix":r}}:{headers:{}}}function xM(r){var{children:e}=r,t=v.useContext(Jv);return t?u.jsx(u.Fragment,{children:e}):u.jsx(tt,{"data-testid":"fonts-loaded-loading"})}function oc(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){oc(a,n,i,s,o,"next",l)}function o(l){oc(a,n,i,s,o,"throw",l)}s(void 0)})}}var Em=v.createContext(null);function NM(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=IM(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(tt,{isLoading:o&&a==null,errorMessage:Tr(a)}):u.jsx(Em.Provider,{value:n,children:e})}function MM(){return Ar(Em,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function LM(r){var{children:e}=r,t=MM(),n=v.useContext(Vc),i=v.useContext(ja),a=gf(t,n,i);return u.jsx(Hc.Provider,{value:a,children:e})}function FM(r){var{children:e}=r,t=v.useContext(Pi),n=v.useMemo(()=>t==null?null:of(t),[t]);return u.jsx(Nc,{themes:n,children:u.jsx(yf,{children:u.jsx(RT,{children:u.jsx(qc,{children:e})})})})}function GM(r){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:n,serverUrl:i,children:a}=r,s=v.useMemo(()=>DM(),[]),[o,l]=v.useState(0),d=v.useCallback(()=>{},[]),h=v.useCallback(()=>{l(c=>c+1)},[]);return Wa(d,h),u.jsx(UE,{fontClassNames:e,children:u.jsx(SM,{getCorePlugins:n,pluginsUrl:t,children:u.jsx(FM,{children:u.jsx(Dv,{serverUrl:i,options:s,children:u.jsx(qv,{children:u.jsx(PM,{children:u.jsx(NM,{children:u.jsx(LM,{children:u.jsx(TM,{children:u.jsx(xM,{children:a})})})})})})},o)})})})}export{GM as AppBootstrap,PM as AuthBootstrap,TM as ConnectionBootstrap,DC as ConnectionContext,UE as FontBootstrap,xM as FontsLoaded,Jv as FontsLoadedContext,SM as PluginsBootstrap,BM as RemoteComponent,FM as ThemeBootstrap,pM as getAuthHandlers,mM as getAuthPluginComponent,WM as getBaseUrl,DM as getConnectOptions,OM as getEnvoyPrefix,vM as loadJson,cM as loadModulePlugin,fM as loadModulePlugins,qM as useConnection,MM as useServerConfig,YM as useUser};
|
|
29
|
+
//# sourceMappingURL=index-7bc179e3.js.map
|