@deephaven/code-studio 1.8.1-beta.5 → 1.8.1-beta.8
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/{AppRoot-9MgDucUC.css → AppRoot-B3C4soZx.css} +1 -1
- package/build/assets/{AppRoot-CUMe0MgO.js → AppRoot-CA63ZFfP.js} +5 -5
- package/build/assets/{AppRoot-CUMe0MgO.js.map → AppRoot-CA63ZFfP.js.map} +1 -1
- package/build/assets/{Chart-JHkKKPMG.js → Chart-D0E56j0k.js} +2 -2
- package/build/assets/{Chart-JHkKKPMG.js.map → Chart-D0E56j0k.js.map} +1 -1
- package/build/assets/{ControlType-Dv3CuLYR.js → ControlType-AGuZ4-oA.js} +4 -4
- package/build/assets/{ControlType-Dv3CuLYR.js.map → ControlType-AGuZ4-oA.js.map} +1 -1
- package/build/assets/{FormatterUtils-i8ji1C5d.js → FormatterUtils--OdhFaL2.js} +2 -2
- package/build/assets/{FormatterUtils-i8ji1C5d.js.map → FormatterUtils--OdhFaL2.js.map} +1 -1
- package/build/assets/{Grid-DneCwkq6.js → Grid-cJ4xNxaO.js} +2 -2
- package/build/assets/{Grid-DneCwkq6.js.map → Grid-cJ4xNxaO.js.map} +1 -1
- package/build/assets/GridTokenMouseHandler-BTzrRI8R.js +2 -0
- package/build/assets/GridTokenMouseHandler-BTzrRI8R.js.map +1 -0
- package/build/assets/{IrisGrid-BxAu2BPV.js → IrisGrid-CHQXOjYj.js} +2 -2
- package/build/assets/{IrisGrid-BxAu2BPV.js.map → IrisGrid-CHQXOjYj.js.map} +1 -1
- package/build/assets/{IrisGridModel-BGDQQUvO.js → IrisGridModel-CCG0-2Nf.js} +3 -3
- package/build/assets/{IrisGridModel-BGDQQUvO.js.map → IrisGridModel-CCG0-2Nf.js.map} +1 -1
- package/build/assets/{IrisGridShortcuts-BWfWqXoC.js → IrisGridShortcuts-cvoBMymF.js} +2 -2
- package/build/assets/{IrisGridShortcuts-BWfWqXoC.js.map → IrisGridShortcuts-cvoBMymF.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-BUVz26Yu.js → IrisGridThemeProvider-DF9B9gXj.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-BUVz26Yu.js.map → IrisGridThemeProvider-DF9B9gXj.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-C84CXhUy.js → LocalWorkspaceStorage-C_hDs8U_.js} +3 -3
- package/build/assets/LocalWorkspaceStorage-C_hDs8U_.js.map +1 -0
- package/build/assets/{LocalWorkspaceStorage-DsGVRaZc.css → LocalWorkspaceStorage-Czsna8UP.css} +1 -1
- package/build/assets/{MarkdownEditor-aSWelw17.js → MarkdownEditor-Cefgx3F-.js} +2 -2
- package/build/assets/{MarkdownEditor-aSWelw17.js.map → MarkdownEditor-Cefgx3F-.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-ootxm18m.js → MarkdownNotebook-D0WtEaWY.js} +2 -2
- package/build/assets/{MarkdownNotebook-ootxm18m.js.map → MarkdownNotebook-D0WtEaWY.js.map} +1 -1
- package/build/assets/{MissingPartitionError-CPMKFcmL.js → MissingPartitionError-CDoTC_qn.js} +2 -2
- package/build/assets/{MissingPartitionError-CPMKFcmL.js.map → MissingPartitionError-CDoTC_qn.js.map} +1 -1
- package/build/assets/{MockChartModel-NC-TS1K9.js → MockChartModel-BFyr0vQ2.js} +2 -2
- package/build/assets/{MockChartModel-NC-TS1K9.js.map → MockChartModel-BFyr0vQ2.js.map} +1 -1
- package/build/assets/Plot-DJ6ubuGW.js +2 -0
- package/build/assets/{Plot-DCq52K02.js.map → Plot-DJ6ubuGW.js.map} +1 -1
- package/build/assets/{Plotly-CLfP2rXn.js → Plotly-Dz-uEfsS.js} +2 -2
- package/build/assets/{Plotly-CLfP2rXn.js.map → Plotly-Dz-uEfsS.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-Dx78QRHs.js → StyleGuideRoot-ClL2dLgA.js} +2 -2
- package/build/assets/{StyleGuideRoot-Dx78QRHs.js.map → StyleGuideRoot-ClL2dLgA.js.map} +1 -1
- package/build/assets/{index-Dyvkb3Mk.js → index-72_vjhkN.js} +2 -2
- package/build/assets/{index-Dyvkb3Mk.js.map → index-72_vjhkN.js.map} +1 -1
- package/build/assets/{index-BPz8hTEO.js → index-CkxOLTbP.js} +4 -4
- package/build/assets/{index-BPz8hTEO.js.map → index-CkxOLTbP.js.map} +1 -1
- package/build/assets/{index-NemDdb6c.js → index-Dcm_Lukb.js} +3 -3
- package/build/assets/{index-NemDdb6c.js.map → index-Dcm_Lukb.js.map} +1 -1
- package/build/assets/plotly-DVL5POUT.js +7 -0
- package/build/assets/{plotly-DTzVdV-1.js.map → plotly-DVL5POUT.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +31 -31
- package/build/assets/GridTokenMouseHandler-Dry4g9hj.js +0 -2
- package/build/assets/GridTokenMouseHandler-Dry4g9hj.js.map +0 -1
- package/build/assets/LocalWorkspaceStorage-C84CXhUy.js.map +0 -1
- package/build/assets/Plot-DCq52K02.js +0 -2
- package/build/assets/plotly-DTzVdV-1.js +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-
|
|
2
|
-
import{r as m,a0 as dn,bB as kr,U as R,bG as nu,ac as ii,I as d,L as Ya,K as Z,R as Mr,bH as ru,M as ve,H as wt,bI as iu,G as Qa,a1 as yn,bJ as ou,bK as au,bL as su,bE as Kn,bM as lu,bA as Wi,bN as uu,bO as du,ad as Gt,av as Vi,bP as Bn,bQ as k,bR as Ki,bF as be,af as Ja,a3 as Ei,bS as hu,_ as In}from"./vendor-_fAVrg-7.js";import{aC as es,L as U,aZ as ts,W as ns,$ as cu,ai as mu,aj as vu,ah as pu,ar as fu,ad as gu,aw as bu,M as rs,b as is,c as os,aK as yu,a_ as Cu,a$ as as,b0 as ss,b1 as Su,b2 as wu,N as hn,aA as Eu,b3 as Pu,b4 as Tu,b5 as _u,b6 as Ou,b7 as xu,b8 as Iu,b9 as Du,ba as ku,bb as Mu,bc as Nu,E as ls,aY as ju,aV as us,aW as Au,a3 as ds,k as Lu,e as L,d as oi,bd as Ru,au as hs,be as zi,bf as Fu,bg as $u,bh as Hu,bi as Bu,f as cs,aO as ms,bj as Uu,bk as vs,bl as En,aU as Wu,bm as Vu,H as Gi,bn as ps,q as qi,bo as fs,bp as Ku,K as zu,ak as Gu,bq as qu,C as Xu,al as Zu,br as Yu,bs as Qu,bt as Ju,bu as ed,bv as td,bw as nd,bx as rd,aQ as id,by as od,bz as ad}from"./index-NemDdb6c.js";import{e as Ie,M as sd,b as Xi,l as rt,R as gs,K as nt,c as qt,d as Zi,U as ld,_ as bs}from"./monaco-DaE0jI-i.js";var ys=Object.freeze([]),qb=new Map,Cs=()=>{};function Xb(r){return Array.isArray(r)?r:[r]}function zr(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function ud(r,e,t){return(e=dd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dd(r){var e=hd(r,"string");return typeof e=="symbol"?e:e+""}function hd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Yi extends Error{constructor(){super(...arguments),ud(this,"isCanceled",!0)}}function cd(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=md(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function md(r,e){for(var t=new Set,n=r,i=0;n!=null&&n!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(n)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(n,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}n=Object.getPrototypeOf(n),i+=1}return[...t.keys()]}function vd(r,e,t){return(e=pd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pd(r){var e=fd(r,"string");return typeof e=="symbol"?e:e+""}function fd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gd extends Error{constructor(){super(...arguments),vd(this,"isClipboardPermissionsDeniedError",!0)}}function bd(r,e,t){return(e=yd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yd(r){var e=Cd(r,"string");return typeof e=="symbol"?e:e+""}function Cd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Gr extends Error{constructor(){super(...arguments),bd(this,"isClipboardUnavailableError",!0)}}function Sd(r,e,t){return(e=wd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wd(r){var e=Ed(r,"string");return typeof e=="symbol"?e:e+""}function Ed(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ss extends Error{constructor(){super(...arguments),Sd(this,"isPermissionUnsupported",!0)}}function Qi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Pd(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Qi(o,n,i,a,s,"next",l)}function s(l){Qi(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ji(r){return ai.apply(this,arguments)}function ai(){return ai=Pd(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Ss:t}}),ai.apply(this,arguments)}function eo(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function ws(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){eo(o,n,i,a,s,"next",l)}function s(l){eo(o,n,i,a,s,"throw",l)}a(void 0)})}}function Es(r){return si.apply(this,arguments)}function si(){return si=ws(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}Td(r)}),si.apply(this,arguments)}function Td(r){var e=document.activeElement,t=document.createElement("textarea");t.value=r,document.body.appendChild(t),t.focus(),t.select();var n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}function Zb(){return li.apply(this,arguments)}function li(){return li=ws(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Gr;var e=yield Ji("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield Ji("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new gd}catch(i){throw i instanceof Ss?new Gr:i}throw new Gr}),li.apply(this,arguments)}var Dn;function cn(r,e,t){return(e=_d(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _d(r){var e=Od(r,"string");return typeof e=="symbol"?e:e+""}function Od(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xd="table_",Ps="column_",Id=new Set(["in","not","i","ii","k"]),Dd=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),kd=/[^a-zA-Z0-9_$\-+@]/g,Md=/[^A-Za-z0-9_$]/g,Nd=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,jd=/[^a-zA-Z0-9_]/g;function Ad(r){return r.replace(/[ -]/g,"_")}function Ld(r){return r.replace(/\s/g,"_")}class Tt{}Dn=Tt;cn(Tt,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Id.has(a)||Dd.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});cn(Tt,"legalizeTableName",r=>Dn.legalize(r,Ld,xd,kd,!1,0));cn(Tt,"makeVariableName",r=>Dn.legalizeTableName(r).replace(jd,"_"));cn(Tt,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=Dn.legalizeColumnName(t,n);e.includes(i)&&(i=Ps+n),e.push(i)}),e});cn(Tt,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Dn.legalize(r,Ad,Ps,Md,!0,e)});cn(Tt,"isValidTableName",r=>Nd.test(r));cn(Tt,"isValidColumnName",r=>Dn.legalizeColumnName(r)===r);class Ts extends CustomEvent{constructor(e,t){super(e,t)}}class Te{static makeCancelable(e,t){var n=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{n?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{n=!0,o(new Yi),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof Yi}static isTimedOut(e){return e instanceof es}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function to(r,e,t){return(e=Rd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rd(r){var e=Fd(r,"string");return typeof e=="symbol"?e:e+""}function Fd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zn{constructor(){to(this,"pending",[]),to(this,"resolved",[])}add(e,t){var n=Te.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function Yb(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}class mt{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!mt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var n=0;n<e.length;n+=1){var i=e[n],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[n,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(l<=n&&i<=u)return o;n<=u&&l<=i&&(n=Math.min(n,l),i=Math.max(i,u),o.splice(a,1))}return o.push([n,i]),o}static deselectRange(e,t){for(var[n,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(!(i<l||u<n))if(l<n&&i<u){o[a]=[l,n-1],o.splice(a+1,0,[i+1,u]);break}else n<=l&&u<=i?o.splice(a,1):l<n?o[a]=[l,n-1]:o[a]=[i+1,u]}return o}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,i)=>{for(var o=[...n],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*Qb(r,e){for(var t=r;t<=e;++t)yield t}var Jb=" ";class _s{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var n=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(n,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?n?-1:1:e>t?n?1:-1:0}static pluralize(e,t,n){return e===1?t:n??"".concat(t,"s")}}function Os(r,e,t){return(e=$d(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $d(r){var e=Hd(r,"string");return typeof e=="symbol"?e:e+""}function Hd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kn{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(n>0||t>0?"".concat(n,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),i=String(Math.floor(n/60)).padStart(2,"0"),o=n%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(kn.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}Os(kn,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Os(kn,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));function Bd(r,e,t){return(e=Ud(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ud(r){var e=Wd(r,"string");return typeof e=="symbol"?e:e+""}function Wd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Un extends Error{constructor(){super(...arguments),Bd(this,"isInvalid",!0)}}function xs(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function no(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Vd(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){no(o,n,i,a,s,"next",l)}function s(l){no(o,n,i,a,s,"throw",l)}a(void 0)})}}var Kd=U.module("useAsyncInterval");function zd(r,e){var t=xs(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Vd(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(c){Kd.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),h=Math.max(0,e-u);n.current=window.setTimeout(a,h)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function Yn(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(r);if(t==null)throw new Error(e);return t}function Gd(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:n=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>dn(r,e,o!=null?{leading:n,trailing:i,maxWait:o}:{leading:n,trailing:i}),[r,e,n,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function qd(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function Xd(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>kr(function(){return i.current(...arguments)},e,n.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=n.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Is(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var Zd=3500,Yd=U.module("useCopyToClipboard");function Qd(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{Es(i).then(()=>{e(!0)}).catch(o=>Yd.error("Unable to copy ".concat(i),`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-DJ6ubuGW.js","./Plotly-Dz-uEfsS.js","./plotly-DVL5POUT.js","./helpers-BosuxZz1.js","./vendor-_fAVrg-7.js","./vendor-CawHrWiI.css","./MarkdownNotebook-D0WtEaWY.js","./index-Dcm_Lukb.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-WCsQ0aAg.css","./mathjax-BfWWk8yK.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as m,a0 as dn,bB as kr,U as R,bG as nu,ac as ii,I as d,L as Ya,K as Z,R as Mr,bH as ru,M as ve,H as wt,bI as iu,G as Qa,a1 as yn,bJ as ou,bK as au,bL as su,bE as Kn,bM as lu,bA as Wi,bN as uu,bO as du,ad as Gt,av as Vi,bP as Bn,bQ as k,bR as Ki,bF as be,af as Ja,a3 as Ei,bS as hu,_ as In}from"./vendor-_fAVrg-7.js";import{aC as es,L as U,aZ as ts,W as ns,$ as cu,ai as mu,aj as vu,ah as pu,ar as fu,ad as gu,aw as bu,M as rs,b as is,c as os,aK as yu,a_ as Cu,a$ as as,b0 as ss,b1 as Su,b2 as wu,N as hn,aA as Eu,b3 as Pu,b4 as Tu,b5 as _u,b6 as Ou,b7 as xu,b8 as Iu,b9 as Du,ba as ku,bb as Mu,bc as Nu,E as ls,aY as ju,aV as us,aW as Au,a3 as ds,k as Lu,e as L,d as oi,bd as Ru,au as hs,be as zi,bf as Fu,bg as $u,bh as Hu,bi as Bu,f as cs,aO as ms,bj as Uu,bk as vs,bl as En,aU as Wu,bm as Vu,H as Gi,bn as ps,q as qi,bo as fs,bp as Ku,K as zu,ak as Gu,bq as qu,C as Xu,al as Zu,br as Yu,bs as Qu,bt as Ju,bu as ed,bv as td,bw as nd,bx as rd,aQ as id,by as od,bz as ad}from"./index-Dcm_Lukb.js";import{e as Ie,M as sd,b as Xi,l as rt,R as gs,K as nt,c as qt,d as Zi,U as ld,_ as bs}from"./monaco-DaE0jI-i.js";var ys=Object.freeze([]),qb=new Map,Cs=()=>{};function Xb(r){return Array.isArray(r)?r:[r]}function zr(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function ud(r,e,t){return(e=dd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dd(r){var e=hd(r,"string");return typeof e=="symbol"?e:e+""}function hd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Yi extends Error{constructor(){super(...arguments),ud(this,"isCanceled",!0)}}function cd(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=md(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function md(r,e){for(var t=new Set,n=r,i=0;n!=null&&n!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(n)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(n,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}n=Object.getPrototypeOf(n),i+=1}return[...t.keys()]}function vd(r,e,t){return(e=pd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pd(r){var e=fd(r,"string");return typeof e=="symbol"?e:e+""}function fd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gd extends Error{constructor(){super(...arguments),vd(this,"isClipboardPermissionsDeniedError",!0)}}function bd(r,e,t){return(e=yd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yd(r){var e=Cd(r,"string");return typeof e=="symbol"?e:e+""}function Cd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Gr extends Error{constructor(){super(...arguments),bd(this,"isClipboardUnavailableError",!0)}}function Sd(r,e,t){return(e=wd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wd(r){var e=Ed(r,"string");return typeof e=="symbol"?e:e+""}function Ed(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ss extends Error{constructor(){super(...arguments),Sd(this,"isPermissionUnsupported",!0)}}function Qi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Pd(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Qi(o,n,i,a,s,"next",l)}function s(l){Qi(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ji(r){return ai.apply(this,arguments)}function ai(){return ai=Pd(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Ss:t}}),ai.apply(this,arguments)}function eo(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function ws(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){eo(o,n,i,a,s,"next",l)}function s(l){eo(o,n,i,a,s,"throw",l)}a(void 0)})}}function Es(r){return si.apply(this,arguments)}function si(){return si=ws(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}Td(r)}),si.apply(this,arguments)}function Td(r){var e=document.activeElement,t=document.createElement("textarea");t.value=r,document.body.appendChild(t),t.focus(),t.select();var n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}function Zb(){return li.apply(this,arguments)}function li(){return li=ws(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Gr;var e=yield Ji("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield Ji("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new gd}catch(i){throw i instanceof Ss?new Gr:i}throw new Gr}),li.apply(this,arguments)}var Dn;function cn(r,e,t){return(e=_d(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _d(r){var e=Od(r,"string");return typeof e=="symbol"?e:e+""}function Od(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xd="table_",Ps="column_",Id=new Set(["in","not","i","ii","k"]),Dd=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),kd=/[^a-zA-Z0-9_$\-+@]/g,Md=/[^A-Za-z0-9_$]/g,Nd=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,jd=/[^a-zA-Z0-9_]/g;function Ad(r){return r.replace(/[ -]/g,"_")}function Ld(r){return r.replace(/\s/g,"_")}class Tt{}Dn=Tt;cn(Tt,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Id.has(a)||Dd.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});cn(Tt,"legalizeTableName",r=>Dn.legalize(r,Ld,xd,kd,!1,0));cn(Tt,"makeVariableName",r=>Dn.legalizeTableName(r).replace(jd,"_"));cn(Tt,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=Dn.legalizeColumnName(t,n);e.includes(i)&&(i=Ps+n),e.push(i)}),e});cn(Tt,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Dn.legalize(r,Ad,Ps,Md,!0,e)});cn(Tt,"isValidTableName",r=>Nd.test(r));cn(Tt,"isValidColumnName",r=>Dn.legalizeColumnName(r)===r);class Ts extends CustomEvent{constructor(e,t){super(e,t)}}class Te{static makeCancelable(e,t){var n=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{n?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{n=!0,o(new Yi),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof Yi}static isTimedOut(e){return e instanceof es}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function to(r,e,t){return(e=Rd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rd(r){var e=Fd(r,"string");return typeof e=="symbol"?e:e+""}function Fd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zn{constructor(){to(this,"pending",[]),to(this,"resolved",[])}add(e,t){var n=Te.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function Yb(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}class mt{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!mt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var n=0;n<e.length;n+=1){var i=e[n],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[n,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(l<=n&&i<=u)return o;n<=u&&l<=i&&(n=Math.min(n,l),i=Math.max(i,u),o.splice(a,1))}return o.push([n,i]),o}static deselectRange(e,t){for(var[n,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(!(i<l||u<n))if(l<n&&i<u){o[a]=[l,n-1],o.splice(a+1,0,[i+1,u]);break}else n<=l&&u<=i?o.splice(a,1):l<n?o[a]=[l,n-1]:o[a]=[i+1,u]}return o}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,i)=>{for(var o=[...n],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*Qb(r,e){for(var t=r;t<=e;++t)yield t}var Jb=" ";class _s{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var n=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(n,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?n?-1:1:e>t?n?1:-1:0}static pluralize(e,t,n){return e===1?t:n??"".concat(t,"s")}}function Os(r,e,t){return(e=$d(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $d(r){var e=Hd(r,"string");return typeof e=="symbol"?e:e+""}function Hd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kn{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(n>0||t>0?"".concat(n,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),i=String(Math.floor(n/60)).padStart(2,"0"),o=n%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(kn.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}Os(kn,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Os(kn,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));function Bd(r,e,t){return(e=Ud(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ud(r){var e=Wd(r,"string");return typeof e=="symbol"?e:e+""}function Wd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Un extends Error{constructor(){super(...arguments),Bd(this,"isInvalid",!0)}}function xs(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function no(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Vd(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){no(o,n,i,a,s,"next",l)}function s(l){no(o,n,i,a,s,"throw",l)}a(void 0)})}}var Kd=U.module("useAsyncInterval");function zd(r,e){var t=xs(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Vd(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(c){Kd.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),h=Math.max(0,e-u);n.current=window.setTimeout(a,h)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function Yn(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(r);if(t==null)throw new Error(e);return t}function Gd(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:n=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>dn(r,e,o!=null?{leading:n,trailing:i,maxWait:o}:{leading:n,trailing:i}),[r,e,n,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function qd(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function Xd(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>kr(function(){return i.current(...arguments)},e,n.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=n.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Is(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var Zd=3500,Yd=U.module("useCopyToClipboard");function Qd(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{Es(i).then(()=>{e(!0)}).catch(o=>Yd.error("Unable to copy ".concat(i),`
|
|
3
3
|
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),r&&(t.current=setTimeout(()=>{e(!1)},Zd)),()=>{t.current&&clearTimeout(t.current)}),[r]),[r,n]}function ro(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Jd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ro(Object(t),!0).forEach(function(n){Cn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ro(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Cn(r,e,t){return(e=eh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eh(r){var e=th(r,"string");return typeof e=="symbol"?e:e+""}function th(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var io="popper";class Nr extends m.Component{constructor(e){super(e),Cn(this,"element",void 0),Cn(this,"container",void 0),Cn(this,"nodeRef",R.createRef()),Cn(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=R.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:n}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Jd({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current);var a=new nu(n||o,this.element,i);a.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var s=this.element.querySelector(".".concat(io));s instanceof HTMLElement&&!s.contains(document.activeElement)&&s.focus()}}),ii.flushSync(()=>{this.setState({popper:a})})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),ii.flushSync(()=>{this.setState({show:!0})})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:n,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return d.jsx(ts,{isPortal:!0,children:d.jsx(Ya,{in:a,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,nodeRef:this.nodeRef,children:d.jsx("div",{ref:this.nodeRef,onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:Z(io,{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:d.jsxs("div",{className:"popper-content",children:[t,d.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return d.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Mr.createPortal(this.renderContent(),this.element)})}}Cn(Nr,"defaultProps",{options:{},className:"",timeout:ns.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});var ui;function oo(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 nh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oo(Object(t),!0).forEach(function(n){pt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pt(r,e,t){return(e=rh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rh(r){var e=ih(r,"string");return typeof e=="symbol"?e:e+""}function ih(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var oh=U.module("Tooltip");class he extends m.Component{static handleHidden(){he.shownTooltipCount-=1,he.shownTooltipCount===0&&(he.lastHiddenTime=Date.now())}static handleShown(){he.shownTooltipCount+=1}constructor(e){super(e),pt(this,"container",void 0),pt(this,"popper",void 0),pt(this,"parent",void 0),pt(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=R.createRef(),this.popper=R.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:n}=t,{isShown:i}=this.state;i!==n&&(i?he.handleShown():he.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&he.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){oh.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,n=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,n=e;(he.shownTooltipCount>0||Date.now()-he.lastHiddenTime<he.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),ii.flushSync(()=>{this.setState({isShown:!0})});var{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:n,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=nh({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Nr,{className:Z(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:n,children:d.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}ui=he;pt(he,"defaultTimeout",500);pt(he,"defaultReshowTimeout",100);pt(he,"triggerReshowThreshold",300);pt(he,"shownTooltipCount",0);pt(he,"lastHiddenTime",Date.now());pt(he,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:ui.defaultReshowTimeout,timeout:ui.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var ah=U.module("ThemeProvider"),Pi=m.createContext(null);Pi.displayName="ThemeContext";function ey(r){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:n=cu,children:i}=r,o=m.useMemo(()=>mu(),[]),[a,s]=m.useState(null),[l,u]=m.useState(vu),h=m.useMemo(()=>e==null?null:pu(l,{base:o,custom:e??[]}),[o,l,e]),c=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(h==null||e==null)){fu(n);var p=gu(n);ah.debug2("updateThemePreloadData:",{active:h.map(f=>f.themeKey),custom:e.map(f=>f.themeKey),preloadStyleContent:p,selectedThemeKey:l}),bu({themeKey:l,preloadStyleContent:p})}},[h,l,e,n]),m.useEffect(()=>{s({activeThemes:h,selectedThemeKey:l,themes:c,setSelectedThemeKey:u})},[h,l,c]),t&&h==null?null:d.jsxs(d.Fragment,{children:[h==null?null:d.jsx(d.Fragment,{children:h.map(v=>d.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:d.jsx(Pi.Provider,{value:a,children:d.jsx(ts,{children:i})})]})}function Ds(){return Yn(Pi,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function sh(r){var{children:e,className:t,style:n,"data-testid":i}=r;return d.jsx("div",{className:Z("btn-group",t),style:n,role:"group","data-testid":i,children:e})}var lh=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function ao(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 so(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ao(Object(t),!0).forEach(function(n){uh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ao(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function uh(r,e,t){return(e=dh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dh(r){var e=hh(r,"string");return typeof e=="symbol"?e:e+""}function hh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ch(r,e){if(r==null)return{};var t,n,i=mh(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function mh(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function vh(r,e){switch(r){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return Z("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function ph(r){switch(r){case"group-end":return Z("pl-2","pr-3")}}var oe=R.forwardRef((r,e)=>{var{kind:t,variant:n,type:i="button",tooltip:o,icon:a,disabled:s=!1,active:l,onClick:u,onContextMenu:h,onMouseDown:c,onMouseUp:v,onMouseEnter:p,onMouseLeave:f,onKeyDown:g,className:b,style:w,children:T,tabIndex:P,"data-testid":F,"aria-label":G}=r,ee=ch(r,lh),{UNSAFE_className:Y}=ru({},"button"),N;n&&(N=ph(n));var $;a&&($=R.isValidElement(a)?a:d.jsx(ve,{icon:a}));var ne=$!=null&&T==null,q=vh(t,ne),j;o!==void 0&&(j=typeof o=="string"?d.jsx(he,{children:o}):o);var z=G;G===void 0&&ne&&o!=null&&typeof o=="string"&&(z=o);var W=d.jsxs("button",so(so({"data-testid":F,ref:e,type:i,className:Z("btn",q,N,{active:l},b,Y),onClick:u,onContextMenu:h,onMouseUp:v,onMouseDown:c,onMouseEnter:p,onMouseLeave:f,onKeyDown:g,style:w,disabled:s,tabIndex:P,"aria-label":z},ee),{},{children:[a&&$,T,o!=null&&!s&&j]}));return s&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[W,j]}):W});oe.displayName="Button";function ks(r){var{className:e,children:t,"data-testid":n}=r;return d.jsx("div",{className:Z("modal-footer",e),"data-testid":n,children:t})}function zn(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:v,"data-testid":p}=r,f=m.useRef(null),g=m.useRef(null),b=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),w=m.useCallback(()=>{var P;(P=f.current)===null||P===void 0||P.focus()},[]),T="";return e&&(T=typeof n=="function"?n():n),d.jsxs(rs,{isOpen:e,onOpened:w,children:[d.jsx(is,{closeButton:!1,children:t}),d.jsx(os,{children:T}),d.jsxs(ks,{children:[s&&d.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[d.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),d.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&d.jsx(oe,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:h}),i&&d.jsx(oe,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),d.jsxs(sh,{children:[d.jsx(oe,{kind:c?"danger":"primary",onClick:b,ref:f,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:u}),v]})]})]})}function fh(r,e,t){return(e=gh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gh(r){var e=bh(r,"string");return typeof e=="symbol"?e:e+""}function bh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function qr(r){return r.then!==void 0}class Ee{static disableAllActions(){Ee.actionsDisabled=!0}static enableAllActions(){Ee.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var n,i;return((n=e.group)!==null&&n!==void 0?n:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,a;return((o=e.order)!==null&&o!==void 0?o:0)>((a=t.order)!==null&&a!==void 0?a:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(Ee.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ee.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Ee.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var a=i[o],s=void 0;typeof a=="function"?s=a():s=a,s!=null&&(s instanceof Promise?t&&n.push(s):Array.isArray(s)?n=n.concat(s):n.push(s))}return n=n.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),n}static getNextMenuItem(e,t,n){var i=e;i<0&&t<0&&(i=n.length);for(var o=1;o<n.length+1;o+=1){var a=(i+t*o+n.length)%n.length,s=n[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}fh(Ee,"actionsDisabled",!1);var lo=U.module("GlobalContextAction");class yh extends m.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),lo.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Ee.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var n;lo.debug("Global hotkey matched!",e),(n=t.action)===null||n===void 0||n.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class Ch extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,n=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){var s=d.jsx(yh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));n.push(s)}}return n}}function Ms(r,e,t){return(e=Sh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sh(r){var e=wh(r,"string");return typeof e=="symbol"?e:e+""}function wh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ar=U.module("ContextActions");class te extends m.Component{static triggerMenu(e,t,n,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),Ms(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=R.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!qr(i)&&typeof i!="function"&&i.isGlobal),n=e.actions.filter(i=>!qr(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0){for(var n=e.target,i=function(){var{classList:u}=n,h=t.find(c=>u.contains(c));if(h!==void 0)return ar.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};n=n.parentElement},o;n!=null;)if(o=i(),o)return o.v}if(Ee.isContextActionEvent(e)||(e.contextActions=[]),!!Ee.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>qr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}ar.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,n=0;n<t.length;n+=1){var i=t[n];if(!Ee.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;ar.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),ar.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return d.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:d.jsx(Ch,{actions:t})})}}Ms(te,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var Ns=R.forwardRef((r,e)=>{var t,n,{closeMenu:i,children:o,menuItem:a,onMenuItemClick:s,onMenuItemMouseMove:l,onMenuItemContextMenu:u,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":v}=r,p=m.useCallback(q=>{s(a,q)},[a,s]),f=m.useCallback(q=>{l(a,q)},[a,l]),g=m.useCallback(q=>{u(a,q)},[a,u]);function b(q,j,z){if(typeof q.type=="string")return q;var W={menuItem:a,closeMenu:i,isKeyboardSelected:h,isMouseSelected:c,iconElement:j,displayShortcut:z,"data-testid":v};return R.cloneElement(q,{forwardedProps:W})}var w=(t=a.shortcutText)!==null&&t!==void 0?t:(n=a.shortcut)===null||n===void 0?void 0:n.getDisplayText(),T=null;if(a.icon){var P=a.icon;if(R.isValidElement(P))T=P;else{var F;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(F={color:a.iconColor}),T=d.jsx(ve,{icon:P,style:F})}}var G=null,ee=!!o;a.actions&&(G=d.jsx(ve,{icon:yu}));var Y=null;if(a.menuElement)Y=d.jsx("div",{className:"custom-menu-item",onMouseMove:f,children:b(a.menuElement,T,w)});else{var N,$=a.disabled,ne=a.iconOutline;Y=d.jsx("button",{type:"button",className:Z("btn-context-menu",{disabled:$},{active:(ee||c)&&($===void 0||!$)},{"keyboard-active":h&&($===void 0||!$)}),onClick:p,onMouseMove:f,onContextMenu:g,title:(N=a.description)!==null&&N!==void 0?N:"",children:d.jsxs("div",{className:"btn-context-menu-wrapper",children:[d.jsx("span",{className:Z("icon",{outline:ne}),children:T}),d.jsx("span",{className:"title",children:a.title}),w!==void 0&&d.jsx("span",{className:"shortcut",children:w}),G&&d.jsx("span",{className:Z("submenu-indicator",{disabled:$}),children:G})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,Y]})});Ns.displayName="ContextMenuItem";var js=R.forwardRef((r,e)=>{var{checked:t=!1,children:n,className:i,disabled:o=!1,inputClassName:a,isInvalid:s=!1,labelClassName:l,name:u,onChange:h,"data-testid":c}=r,[v]=m.useState(wt()),p=Is(e);m.useEffect(function(){p.current&&(p.current.indeterminate=t===null)},[p,t]);var f=m.useCallback(g=>{p.current&&(p.current.indeterminate=t===null),h&&h(g)},[p,t,h]);return d.jsxs("div",{className:Z("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:p,checked:t??!1,className:Z("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:u,onChange:f,"data-testid":c}),d.jsx("label",{className:Z("custom-control-label",l),htmlFor:v,children:n})]})});js.displayName="Checkbox";function wr(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function As(r){return wr(r)&&As(r.WrappedComponent)?!0:r.prototype!=null&&r.prototype.isReactComponent!=null}function Eh(r){return!wr(r)&&"$$typeof"in r&&r.$$typeof===iu.ForwardRef}function Ls(r){return As(r)||Eh(r)}function ty(r){var{copy:e,kind:t="ghost",tooltip:n="Copy",className:i,style:o,"data-testid":a,children:s}=r,[l,u]=Qd();return d.jsx(oe,{kind:t,className:i,style:o,"data-testid":a,icon:l?Cu:as,tooltip:l?"Copied":n,onClick:()=>{u(typeof e=="function"?e():e)},children:s})}function uo(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 Ph(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uo(Object(t),!0).forEach(function(n){Wn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Wn(r,e,t){return(e=Th(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Th(r){var e=_h(r,"string");return typeof e=="symbol"?e:e+""}function _h(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Rs extends m.PureComponent{constructor(e){var t;super(e),Wn(this,"container",void 0),Wn(this,"oldFocus",void 0),Wn(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=R.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:n}=e,i=(t=n.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Ee.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:Ee.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),i=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=Ee.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Ee.getNextMenuItem(i??0,1,t)),n!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(d.jsx("hr",{},"".concat(a,".separator")));var l=d.jsx(Ns,{isKeyboardSelected:n===a,isMouseSelected:o===a,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(l)}var{menuStyle:u}=this.props;return d.jsx("div",{className:"context-menu-container",style:Ph({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Wn(Rs,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function ho(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 co(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ho(Object(t),!0).forEach(function(n){Sn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ho(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Sn(r,e,t){return(e=Oh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Oh(r){var e=xh(r,"string");return typeof e=="symbol"?e:e+""}function xh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Qn extends m.PureComponent{constructor(e){super(e),Sn(this,"container",void 0),Sn(this,"parent",void 0),Sn(this,"popper",void 0),Sn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=R.createRef(),this.parent=null,this.popper=R.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=co({placement:"bottom"},s),a=co({separateKeyboardMouse:!0},a),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Nr,{ref:this.popper,options:s,className:Z("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(Rs,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}Sn(Qn,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Ht(r,e,t){return(e=Ih(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ih(r){var e=Dh(r,"string");return typeof e=="symbol"?e:e+""}function Dh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var mo=U.module("Shortcut"),D=function(r){return r.CTRL="MODIFIER_CTRL",r.CMD="MODIFIER_CMD",r.ALT="MODIFIER_ALT",r.OPTION="MODIFIER_OPTION",r.SHIFT="MODIFIER_SHIFT",r}({}),O=function(r){return r.A="A",r.B="B",r.C="C",r.D="D",r.E="E",r.F="F",r.G="G",r.H="H",r.I="I",r.J="J",r.K="K",r.L="L",r.M="M",r.N="N",r.O="O",r.P="P",r.Q="Q",r.R="R",r.S="S",r.T="T",r.U="U",r.V="V",r.W="W",r.X="X",r.Y="Y",r.Z="Z",r.ZERO="0",r.ONE="1",r.TWO="2",r.THREE="3",r.FOUR="4",r.FIVE="5",r.SIX="6",r.SEVEN="7",r.EIGHT="8",r.NINE="9",r.BACKSPACE="Backspace",r.ESCAPE="Escape",r.ENTER="Enter",r.DELETE="Delete",r.SLASH="/",r.QUESTION_MARK="?",r.BACKSLASH="\\",r.PIPE="|",r.MINUS="-",r.UNDERSCORE="_",r.EQUALS="=",r.PLUS="+",r.BACKTICK="`",r.TILDE="~",r.COMMA=",",r.LEFT_CHEVRON="<",r.PERIOD=".",r.RIGHT_CHEVRON=">",r.SEMICOLON=";",r.COLON=":",r.SINGLE_QUOTE="'",r.DOUBLE_QUOTE='"',r.LEFT_BRACKET="[",r.RIGHT_BRACKET="]",r.LEFT_CURLY="{",r.RIGHT_CURLY="}",r.F1="F1",r.F2="F2",r.F3="F3",r.F4="F4",r.F5="F5",r.F6="F6",r.F7="F7",r.F8="F8",r.F9="F9",r.F10="F10",r.F11="F11",r.F12="F12",r}({}),kh=new Set([O.ENTER,O.DELETE,O.F1,O.F2,O.F3,O.F4,O.F5,O.F6,O.F7,O.F8,O.F9,O.F10,O.F11,O.F12]);class Ce extends Qa{static isAllowedKey(e){return Object.values(O).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!Ce.isMacPlatform&&e.metaKey||!Ce.isAllowedKey(t))return!1;var n=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!n||kh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case D.CTRL:t.ctrlKey=!0;break;case D.ALT:case D.OPTION:t.altKey=!0;break;case D.CMD:t.metaKey=!0;break;case D.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:n}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!Ce.isAllowedKey(t)&&Ce.isAllowedKey(String.fromCharCode(n))?i=String.fromCharCode(n):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===O.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case O.ENTER:t+="⏎";break;case O.ESCAPE:t+="⎋";break;case O.BACKSPACE:t+="⌫";break;case O.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,i;return((n=e.keyValue)===null||n===void 0?void 0:n.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":Ce.isMacPlatform?Ce.getMacDisplayText(e):Ce.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:n,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),Ht(this,"id",void 0),Ht(this,"name",void 0),Ht(this,"tooltip",void 0),Ht(this,"isEditable",void 0),Ht(this,"defaultKeyState",void 0),Ht(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=Ce.isMacPlatform,u=l?i:n;this.defaultKeyState=Ce.createKeyState(u),this.keyState=this.defaultKeyState}getDisplayText(){return Ce.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Ce.isValidKeyState(e)?(mo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Ts("onUpdate",{detail:this}))):mo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Ce.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Ce.NULL_KEY_STATE)}isNull(){return Ce.doKeyStatesMatch(this.keyState,Ce.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Ce.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Ce.getKeyStateFromEvent(e))}}Ht(Ce,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Ht(Ce,"isMacPlatform",Ee.isMacPlatform());function vo(r,e,t){return(e=Mh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mh(r){var e=Nh(r,"string");return typeof e=="symbol"?e:e+""}function Nh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var po=U.module("ShortcutRegistry");class jh extends Qa{constructor(){super(...arguments),vo(this,"shortcutMap",new Map),vo(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new Ce(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return po.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;po.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new Ts("onUpdate",{detail:a}))});var n=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)){var i;(i=this.shortcutsByCategory.get(n))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(n,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var de=Object.freeze(new jh),Vt={COPY:de.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[D.CTRL,O.C],macShortcut:[D.CMD,O.C],isEditable:!1}),PASTE:de.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[D.CTRL,O.V],macShortcut:[D.CMD,O.V],isEditable:!1}),SAVE:de.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[D.CTRL,O.S],macShortcut:[D.CMD,O.S],isEditable:!1}),SELECT_ALL:de.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[D.CTRL,O.A],macShortcut:[D.CMD,O.A],isEditable:!1}),REOPEN_CLOSED_PANEL:de.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[D.ALT,D.SHIFT,O.T],macShortcut:[D.OPTION,D.SHIFT,O.T],isEditable:!0}),LINKER:de.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[D.CTRL,O.L],macShortcut:[D.CMD,O.L]}),LINKER_CLOSE:de.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[O.ESCAPE],macShortcut:[O.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:de.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[D.CTRL,D.ALT,O.I],macShortcut:[D.CMD,D.SHIFT,O.I],isEditable:!0}),EXPORT_LOGS:de.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[D.CTRL,D.ALT,D.SHIFT,O.L],macShortcut:[D.CMD,D.OPTION,D.SHIFT,O.L],isEditable:!0}),OPEN_DASHBOARD_LIST:de.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[D.CTRL,D.SHIFT,O.D],macShortcut:[D.CMD,D.SHIFT,O.D],isEditable:!0}),NEXT:de.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[O.ENTER],macShortcut:[O.ENTER],isEditable:!1}),PREVIOUS:de.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[D.SHIFT,O.ENTER],macShortcut:[D.SHIFT,O.ENTER],isEditable:!1}),UNDO:de.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[D.CTRL,O.Z],macShortcut:[D.CMD,O.Z],isEditable:!1}),REDO:de.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[D.CTRL,D.SHIFT,O.Z],macShortcut:[D.CMD,D.SHIFT,O.Z],isEditable:!1})};function di(r,e,t){return(e=Ah(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ah(r){var e=Lh(r,"string");return typeof e=="symbol"?e:e+""}function Lh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class jr extends m.PureComponent{constructor(e){super(e),di(this,"inputField",void 0),di(this,"searchChangeSelection",void 0),this.inputField=R.createRef(),this.searchChangeSelection=R.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var n=t.getBoundingClientRect().width;e.style.paddingRight="".concat(n,"px")}}render(){var{value:e,placeholder:t,endPlaceholder:n,onBlur:i,onChange:o,className:a,disabled:s,matchCount:l,id:u,onKeyDown:h,"data-testid":c,cursor:v}=this.props,p,f=[{action:()=>v==null?void 0:v.next("forward"),shortcut:Vt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:Vt.PREVIOUS}];return v&&l>1?p=d.jsxs(d.Fragment,{children:[d.jsx(oe,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:ss,tooltip:"Previous match (".concat(Vt.PREVIOUS.getDisplayText(),")")}),d.jsxs("span",{className:"search-change-text",children:[v.index!==void 0&&"".concat(v.index+1," of "),l]}),d.jsx(oe,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("forward")},icon:Su,tooltip:"Next match (".concat(Vt.NEXT.getDisplayText(),")")})]}):p=l>0&&d.jsx("span",{className:"search-match",children:l}),d.jsxs("div",{className:Z("search-group",a),children:[d.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:h,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:u,"data-testid":c}),l!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:p}),d.jsx(te,{actions:f})]}):d.jsxs("span",{className:"search-end-content",children:[(n??"")!==""&&e===""&&d.jsx("span",{className:"search-end-placeholder",children:n}),d.jsx(ve,{icon:wu})]})]})}}di(jr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function Fs(r,e,t){return(e=Rh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rh(r){var e=Fh(r,"string");return typeof e=="symbol"?e:e+""}function Fh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $s extends m.PureComponent{constructor(e){super(e),Fs(this,"searchInput",void 0),this.searchInput=R.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=dn(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":o}=this.props,{value:a}=this.state;return d.jsx(jr,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":o})}}Fs($s,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function Hs(r,e,t){return(e=$h(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $h(r){var e=Hh(r,"string");return typeof e=="symbol"?e:e+""}function Hh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Bh=U.module("ItemListItem");class Ar extends m.Component{static handleKeyDown(){return Bh.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Hs(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=R.createRef()}handleBlur(e){var{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){var{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){var{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){var{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){var{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:n,style:i,children:o,"data-testid":a}=this.props;return d.jsx("div",{className:Z("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ar.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:o})}}Hs(Ar,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});var yr;function fo(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 go(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fo(Object(t),!0).forEach(function(n){dt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function dt(r,e,t){return(e=Uh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uh(r){var e=Wh(r,"string");return typeof e=="symbol"?e:e+""}function Wh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var bo=U.module("ItemList"),yo=5;class gt extends m.PureComponent{static renderItem(e){var t,n,{item:i}=e;return d.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(n=i.displayValue)!==null&&n!==void 0?n:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),dt(this,"list",void 0),dt(this,"listContainer",void 0),dt(this,"getItemSelected",yn((i,o)=>mt.isSelected(o,i),{max:gt.CACHE_SIZE})),dt(this,"getCachedItem",yn((i,o,a,s,l,u,h,c)=>{var v=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:h});return d.jsx(Ar,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:h,children:v},o)},{max:gt.CACHE_SIZE})),dt(this,"getOuterElement",yn(i=>{var o=R.forwardRef((a,s)=>d.jsx("div",go({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),dt(this,"getInnerElement",yn(()=>{var i=R.forwardRef((o,a)=>d.jsx("div",go({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),dt(this,"getItemData",yn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=R.createRef(),this.listContainer=R.createRef();var{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:n,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:u}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==u)this.setSelectedRanges(n);else if(u!==t.selectedRanges){var{onSelectionChange:h}=this.props;h(u)}if(o!==t.focusIndex){var{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-n;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var n=this.getElement(e);n instanceof HTMLElement&&n.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:n}=this.state,i=mt.isSelected(n,e),o=i||Ee.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:n,onSelect:i}=this.props;n&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:mt.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){bo.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){bo.debug2("item focus",e,t.target),this.setState(n=>{var{focusIndex:i}=n;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:n,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:u}=this.state;if(!(a==null||o)){var h=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(u??0));h>yo&&c>yo&&this.setState({isDragging:!0}),(n||a===e)&&(this.focusItem(e),i?(!n&&!this.getItemSelected(e,s)&&!Ee.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Ee.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:n,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:a,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!s){var l=t.shiftKey,u=Ee.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,n),!i&&!l&&!u&&o(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:n,onSelect:i}=this.props,{focusIndex:o}=this.state,a=o;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&i(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=n-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,n-1):a=0;else return;if(o!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else if(this.deselectAll(),a!==null)this.selectItem(a);else{var u;(u=this.listContainer.current)===null||u===void 0||u.focus()}this.scrollIntoView(a)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:n}=e;this.setState(i=>{if(t)return{scrollOffset:n};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:n,height:a});return{isStuckToBottom:s,scrollOffset:n}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:a}=this.state;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&n?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){mt.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:mt.deselectRange(n,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){mt.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:mt.selectRange(n,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:n,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);n(o,a)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:n,rowHeight:i}=this.props;return e+t>=n*i}renderInnerElement(e){var{index:t,style:n}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:u}=this.state;if(t<o||t>=o+i.length)return null;var h=i[t-o];return this.getCachedItem(t,t,h,t===l&&!s,this.getItemSelected(t,u),a,n,s)}render(){var{items:e,itemCount:t,overscanCount:n,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return d.jsx(ou,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:h,height:c}=u;return d.jsx(au,{className:"item-list-scroll-pane",height:c,width:h,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":a,children:this.renderInnerElement})}})}}yr=gt;dt(gt,"CACHE_SIZE",1e3);dt(gt,"DEFAULT_ROW_HEIGHT",20);dt(gt,"DEFAULT_OVERSCAN",10);dt(gt,"defaultProps",{offset:0,items:[],rowHeight:yr.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:yr.DEFAULT_OVERSCAN,renderItem:yr.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var Vh=U.module("ErrorBoundary");class Kh extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:n}=this.props;Vh.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??d.jsx("div",{className:t,children:d.jsx(hn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function zh(r){var{on:e,id:t,className:n,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=r;return d.jsx("button",{type:"button",className:Z("btn","btn-switch",n,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:d.jsx("div",{className:"handle"})})}var Gh=["classNames","timeout","children","onEnter"];function Co(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 So(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(t),!0).forEach(function(n){qh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Co(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function qh(r,e,t){return(e=Xh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xh(r){var e=Zh(r,"string");return typeof e=="symbol"?e:e+""}function Zh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Yh(r,e){if(r==null)return{};var t,n,i=Qh(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function Qh(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var Jh={display:"contents"};function ny(r){var{classNames:e,timeout:t=ns.transitionMs,children:n,onEnter:i}=r,o=Yh(r,Gh),a=m.useRef(null),s=m.useCallback(u=>{var h=a.current;h&&(i==null||i(h,u))},[i]),l=m.useCallback(u=>{a.current=u==null?void 0:u.firstElementChild},[]);return d.jsx(Ya,So(So({nodeRef:a,timeout:t,classNames:Z("fade",e),onEnter:s},o),{},{children:d.jsx("div",{ref:l,style:Jh,children:n})}))}var ec=["children","className","isInvalid","onChange","data-testid"];function wo(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 Eo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(n){tc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tc(r,e,t){return(e=nc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nc(r){var e=rc(r,"string");return typeof e=="symbol"?e:e+""}function rc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ic(r,e){if(r==null)return{};var t,n,i=oc(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function oc(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var Bs=R.forwardRef((r,e)=>{var{children:t,className:n,isInvalid:i,onChange:o,"data-testid":a}=r,s=ic(r,ec),l=Is(e),u=m.useCallback(h=>{o(h.target.value)},[o]);return d.jsx("select",Eo(Eo({ref:l,className:Z("custom-select",n,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});Bs.displayName="Select";var Ti=R.createContext(new Map);Ti.displayName="XComponentMapContext";var ry=Ti.Provider;function ac(r){var e,t=m.useContext(Ti);return(e=t.get(r))!==null&&e!==void 0?e:r.Original}function Po(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?Po(Object(t),!0).forEach(function(n){sc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Po(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sc(r,e,t){return(e=lc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lc(r){var e=uc(r,"string");return typeof e=="symbol"?e:e+""}function uc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Us(r){var e,t;function n(i,o){var a=ac(t);return Ls(r)?d.jsx(a,Xr(Xr({},i),{},{ref:o})):d.jsx(a,Xr({},i))}return n.displayName="XComponent(".concat((e=r.displayName)!==null&&e!==void 0?e:r.name,")"),t=m.forwardRef(n),t.Original=r,t.isXComponent=!0,t}function dc(){return Yn(Eu,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Ws(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function Vs(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function iy(r){return Ws(r)||Vs(r)}var Ks=m.createContext(null);Ks.displayName="ObjectFetcherContext";function oy(r){if(Vs(r))return{id:r.id,type:r.type};if(Ws(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function hc(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 ay(){return Yn(Ks,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function To(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 cc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?To(Object(t),!0).forEach(function(n){mc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):To(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function mc(r,e,t){return(e=vc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vc(r){var e=pc(r,"string");return typeof e=="symbol"?e:e+""}function pc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var _i=Object.freeze({}),fc=new Map,sy=r=>r.api,ly=r=>r.user,zs=r=>r.storage,Gs=r=>zs(r).commandHistoryStorage,qs=r=>zs(r).fileStorage,gc=r=>r.defaultWorkspaceSettings,Xs=r=>{var{workspace:e}=r;return e},Re=su(r=>{for(var e,t,n=(e=(t=Xs(r))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=cc({},gc(r)),o=Object.keys(n),a=0;a<o.length;a+=1){var s=o[a];n[s]!==void 0&&(i[s]=n[s])}return i}),uy=r=>r.defaultWorkspaceSettings,dy=r=>Re(r).defaultDateTimeFormat,hy=r=>{var e;return(e=Re(r).defaultDecimalFormatOptions)!==null&&e!==void 0?e:_i},cy=r=>{var e;return(e=Re(r).defaultIntegerFormatOptions)!==null&&e!==void 0?e:_i},my=r=>{var e;return(e=Re(r).formatter)!==null&&e!==void 0?e:[]},bc=r=>Re(r).timeZone,vy=r=>Re(r).showTimeZone,py=r=>Re(r).showTSeparator,fy=r=>Re(r).truncateNumbersWithPound,gy=r=>Re(r).showEmptyStrings,by=r=>Re(r).showNullStrings,yy=r=>Re(r).showExtraGroupColumn,Cy=r=>Re(r).shortcutOverrides,Sy=r=>Re(r).webgl,wy=r=>Re(r).webglEditable,Zs=r=>{var e;return(e=Re(r).notebookSettings)!==null&&e!==void 0?e:_i},Ey=r=>r.activeTool,yc=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:fc};function _o(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 kt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_o(Object(t),!0).forEach(function(n){Cc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_o(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Cc(r,e,t){return(e=Sc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sc(r){var e=wc(r,"string");return typeof e=="symbol"?e:e+""}function wc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Py=r=>({type:Du,payload:r}),Ty=r=>({type:_u,payload:r}),Ys=r=>({type:Mu,payload:r}),_y=r=>({type:Nu,payload:r}),Oy=r=>({type:ku,payload:r}),xy=r=>({type:xu,payload:r}),Iy=r=>({type:Iu,payload:r}),Ec=r=>(e,t)=>{e(Ys(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i==null?void 0:i.save(r)},Pc=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n??{},o=kt(kt({},n),{},{data:kt(kt(kt({},i),r),{},{settings:kt(kt({},i==null?void 0:i.settings),r.settings)})});return e(Ec(o))},Tc=r=>(e,t)=>{var{notebookSettings:n}=Re(t()),i=kt(kt({},n),r);return e(_c({notebookSettings:i}))},_c=r=>e=>e(Pc({settings:r})),Dy=r=>({type:Pu,payload:r}),ky=r=>({type:Tu,payload:r}),My=r=>({type:Ou,payload:r});function Oo(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 xo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oo(Object(t),!0).forEach(function(n){Oc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Oo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Oc(r,e,t){return(e=xc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xc(r){var e=Ic(r,"string");return typeof e=="symbol"?e:e+""}function Ic(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Dc(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==null?void 0:i.type){case r:{var{id:o,payload:a}=i;return t&&Kn({payload:a},{payload:n[o]})?n:xo(xo({},n),{},{[o]:a})}default:return n}}}function Qs(r){var{type:e}=r,t=dc();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return d.jsx(ve,{icon:Au});case t.VariableType.FIGURE:return d.jsx(ve,{icon:us});case t.VariableType.PANDAS:return d.jsx(ve,{icon:ju});default:return d.jsx(ve,{icon:ls})}}function Io(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function kc(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Io(o,n,i,a,s,"next",l)}function s(l){Io(o,n,i,a,s,"throw",l)}a(void 0)})}}function Js(r){var{children:e,language:t}=r,[n,i]=m.useState(null),{activeThemes:o}=Ds();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=kc(function*(){if(e!=null&&o!=null){var u=yield Ie.colorize(e.toString(),t,{});a||i(u)}}),l.apply(this,arguments)}return s(),()=>{a=!0}},[o,e,t]),d.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class el{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Er{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)?[]:lu.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"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(i,".").concat(o)}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 Er.isTableType(e,t)||Er.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function Mc(r){var{children:e}=r;return d.jsxs("div",{className:"console-history-item-result",children:[d.jsx("div",{className:"console-history-gutter",children:"-"}),d.jsx("div",{className:"console-history-content",children:e})]})}function hi(r,e,t){return(e=Nc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nc(r){var e=jc(r,"string");return typeof e=="symbol"?e:e+""}function jc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class tl extends m.Component{constructor(e){super(e),hi(this,"timer",void 0),hi(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=window.setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer!=null&&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 d.jsx("div",{className:Z("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(ds,{className:"ml-2"}),"Running... ",kn.formatElapsedTime(n)," ",d.jsx(oe,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Lu,tooltip:"Cancel",onClick:t,disabled:e})]})})}}hi(tl,"defaultProps",{disabled:!1});function Vn(r,e,t){return(e=Ac(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ac(r){var e=Lc(r,"string");return typeof e=="symbol"?e:e+""}function Lc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Pn extends m.PureComponent{constructor(e){super(e),Vn(this,"mouseX",void 0),Vn(this,"mouseY",void 0),Vn(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)>=Pn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Pn.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;L(n);var i=n.trimEnd(),o=i.indexOf(`
|
|
4
4
|
`),a=o>-1,s=i;a&&(s=i.slice(0,o));var l=i.slice(o),u=t?"error-btn-link error-btn-link--active":"error-btn-link";return d.jsxs("div",{className:Z("error-message",{expanded:e}),children:[a&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"error-gutter",children:d.jsx("button",{type:"button",onClick:this.handleToggleError,className:u,tabIndex:-1,children:d.jsx(ve,{icon:e?oi:Ru,transform:"left-3"})})}),d.jsxs("div",{className:"error-content",children:[d.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?l:""]})]}),!a&&d.jsx("div",{className:"error-content",children:d.jsx("div",{className:"console-error-text",children:s})})]},"error")}}Vn(Pn,"defaultProps",{message:""});Vn(Pn,"mouseDragThreshold",5);function Rc(r,e,t){return(e=Fc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fc(r){var e=$c(r,"string");return typeof e=="symbol"?e:e+""}function $c(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Do=U.module("ConsoleHistoryItem");class nl extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Do.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Do.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,iconForType:i}=this.props,{disabledObjects:o,result:a}=t,s=t.command!=null&&t.command!=="",l=null;s&&(l=d.jsxs("div",{className:"console-history-item-command",children:[d.jsx("div",{className:"console-history-gutter",children:">"}),d.jsx("div",{className:"console-history-content",children:d.jsx(Js,{language:n,children:t.command})})]}));var u=[],h=!1;if(a){var{error:c,message:v,changes:p}=a;if(p){var{created:f,updated:g}=p;[...f,...g].forEach(ee=>{h=!0;var{title:Y}=ee,N="".concat(Y),$=e===void 0||e||(o??[]).indexOf(N)>=0,ne=d.jsx(oe,{kind:"primary",onClick:()=>this.handleObjectClick(ee),className:"btn-console-object",disabled:$,icon:i(ee.type),children:Y},N);u.push(ne)})}if(c!=null&&!s){var b,w="".concat((b=c.message)!==null&&b!==void 0?b:c);w||(w=c);var T=d.jsx(Pn,{message:w},"result-error");u.push(T)}if(v!==void 0&&v!==""){var P=d.jsx("div",{className:"log-message",children:v},"log-message");u.push(P)}}else{h=!0;var F=d.jsx(tl,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");u.push(F)}var G=null;return u.length>0&&(G=d.jsx(Mc,{children:u})),d.jsxs("div",{className:Z("console-command-result",{"console-result-buttons":h}),children:[l,G]})}}Rc(nl,"defaultProps",{disabled:!1});function Hc(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var Bc=R.forwardRef(function(e,t){for(var{disabled:n=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l}=e,u=[],h=0;h<i.length;h+=1){var c=i[h],v=d.jsx(nl,{disabled:n,item:c,openObject:a,language:o,supportsType:s,iconForType:l},Hc(h,c));u.push(v)}return d.jsx("div",{ref:t,className:"container-fluid console-history",children:u})}),Uc={name:"Console",CLEAR:de.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[D.CTRL,O.L],macShortcut:[D.CTRL,O.C]}),FOCUS_HISTORY:de.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[D.CTRL,O.H],macShortcut:[D.CTRL,D.OPTION,O.H]})},Wc={name:"Command History",FOCUS_HISTORY:de.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[D.CTRL,O.H],macShortcut:[D.CTRL,D.OPTION,O.H]}),SEND_TO_CONSOLE:de.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[O.ENTER],macShortcut:[O.ENTER]}),SEND_TO_NOTEBOOK:de.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[D.CTRL,O.ENTER],macShortcut:[D.CMD,O.ENTER]}),RUN:de.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[D.ALT,O.R],macShortcut:[D.OPTION,O.R]})},Vc={name:"Notebook",RUN:de.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[D.ALT,O.R],macShortcut:[D.OPTION,O.R]}),RUN_SELECTED:de.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[D.ALT,D.SHIFT,O.R],macShortcut:[D.OPTION,D.SHIFT,O.R]}),FIND:de.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[D.CTRL,O.F],macShortcut:[D.CMD,O.F],isEditable:!1}),MINIMAP:de.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[D.ALT,O.M],macShortcut:[D.OPTION,O.M]}),WORDWRAP:de.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[D.ALT,O.Z],macShortcut:[D.OPTION,O.Z]})},We={CONSOLE:Uc,COMMAND_HISTORY:Wc,NOTEBOOK:Vc};const xe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Kc="var(--dh-color-editor-bg)",zc="var(--dh-color-editor-fg)",Gc="var(--dh-color-editor-string)",qc="var(--dh-color-editor-delimiter)",Xc="var(--dh-color-editor-predefined)",Zc="var(--dh-color-editor-keyword)",Yc="var(--dh-color-editor-storage)",Qc="var(--dh-color-editor-number)",Jc="var(--dh-color-editor-operator)",em="var(--dh-color-editor-identifier)",tm="var(--dh-color-editor-comment)",ci={"error-foreground":"var(--dh-color-editor-error-fg)",background:Kc,foreground:zc,"line-height":"19px",string:Gc,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:qc,predefined:Xc,keyword:Zc,storage:Yc,number:Qc,operator:Jc,identifier:em,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:tm,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)"};var nm="python",rm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},im={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},om={id:nm,conf:rm,language:im},am="groovy",sm={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},lm={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},um={id:am,conf:sm,language:lm},dm="scala",hm={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},cm={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},mm={id:dm,conf:hm,language:cm},vm="deephavenDb",pm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},fm={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},gm={id:vm,conf:pm,language:fm},bm="log",ym={},Cm={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},Sm={id:bm,conf:ym,language:Cm},wm={preview:!0,"target-version":"py38","line-length":88,"indent-width":4,format:{"indent-style":"space","quote-style":"double"},lint:{"flake8-implicit-str-concat":{"allow-multiline":!1},ignore:["ISC003"],select:["F","E1","E9","E711","W291","W293","W605","B","A","COM818","ISC","PLE","RUF001","RUF021","RUF027","PLR1704","LOG","ASYNC","RET501","RET502","RET503","PLC2401","PLC2403","NPY","PERF","C4"]}};function ko(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.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 o=r.apply(e,t);function a(l){ko(o,n,i,a,s,"next",l)}function s(l){ko(o,n,i,a,s,"throw",l)}a(void 0)})}}function Xt(r,e,t){return(e=Pm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pm(r){var e=Tm(r,"string");return typeof e=="symbol"?e:e+""}function Tm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var at=U.module("MonacoCompletionProvider");class H extends m.PureComponent{static initRuff(){return Em(function*(){if(H.isRuffEnabled)return H.initRuffPromise||(H.initRuffPromise=uu({}).then(()=>{at.debug("Initialized Ruff",Wi.version()),H.isRuffInitialized=!0,H.updateRuffWorkspace()})),H.initRuffPromise})()}static updateRuffWorkspace(){if(H.isRuffInitialized){var e=console.log;try{console.log=()=>{},H.ruffWorkspace=new Wi(H.ruffSettings)}finally{console.log=e}H.lintAllPython()}}static setRuffSettings(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:H.ruffSettings;if(H.ruffSettings=e,!H.isRuffInitialized){H.initRuff();return}H.updateRuffWorkspace()}static getDiagnostics(e){if(!H.ruffWorkspace)return[];var t=H.ruffWorkspace.check(e.getValue());return me.isConsoleModel(e)?t.filter(n=>n.code==null):t}static lintAllPython(){if(!H.isRuffEnabled){Ie.removeAllMarkers("ruff");return}Ie.getModels().filter(e=>e.getLanguageId()==="python").forEach(H.lintPython)}static lintPython(e){if(H.isRuffEnabled&&H.ruffWorkspace){var t=H.getDiagnostics(e);at.debug("Linting Python document: ".concat(e.uri.toString()),t),Ie.setModelMarkers(e,"ruff",t.map(n=>{var i=n.code==="F401"||n.code==="F841",o=n.code==null;return{startLineNumber:n.location.row,startColumn:n.location.column,endLineNumber:n.end_location.row,endColumn:n.end_location.column,message:o?n.message:"".concat(n.code,": ").concat(n.message),severity:o?Xi.Error:Xi.Warning,tags:i?[sd.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=rt.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}}static handlePythonCodeActionRequest(e,t){if(!H.isRuffEnabled||!H.ruffWorkspace)return{actions:[],dispose:()=>{}};var n=H.getDiagnostics(e).filter(u=>{var h=new gs(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&h.intersectRanges(t)}),i=n.filter(u=>{var{fix:h}=u;return h!=null}).map(u=>{var h="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?h="".concat(u.code,": ").concat(u.fix.message):h="Fix ".concat(u.code)),{title:h,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(c=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:c.location.row,startColumn:c.location.column,endLineNumber:c.end_location.row,endColumn:c.end_location.column},text:(v=c.content)!==null&&v!==void 0?v:""}}})}:void 0}}),o=new Set,a=new Set;n.forEach(u=>{u.code!=null&&(o.has(u.code)&&a.add(u.code),o.add(u.code))});var s=n.map(u=>{if(u.code==null)return[];var h=e.getLineContent(u.location.row),c=Ie.tokenize(h,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:u.location.row,startColumn:h.length+1,endLineNumber:u.location.row,endColumn:h.length+1},text:" # noqa: ".concat(u.code)};return c!=null&&c.type.startsWith("comment")&&(v.text="# noqa: ".concat(u.code," "),h.startsWith("# noqa:",c.offset)?(v.range.startColumn=c.offset+1,v.range.endColumn=c.offset+9):(v.range.startColumn=c.offset+1,v.range.endColumn=h.startsWith("# ",c.offset)?c.offset+3:c.offset+2)),[{title:"Disable ".concat(u.code," for ").concat(a.has(u.code)?"line ".concat(u.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:v}]}}]}).flat().filter((u,h,c)=>c.find(v=>v.title===u.title)===u),l=[...o].map(u=>({title:"Disable ".concat(u," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(u,`
|
|
5
5
|
`)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,n){if(H.ruffWorkspace)return at.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:H.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),Xt(this,"registeredCompletionProvider",void 0),Xt(this,"registeredSignatureProvider",void 0),Xt(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=rt.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=rt.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=rt.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:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:n},s=o.getCompletionItems(a);at.debug("Requested completion items",a);var l=s.then(u=>{at.debug("Completion items received: ",a,u);var h=u.map(c=>{var{label:v,kind:p,detail:f,documentation:g,sortText:b,filterText:w,textEdit:T,insertTextFormat:P}=c;return{label:v,kind:H.lspToMonacoKind(p),detail:f,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:w,insertText:T.text,insertTextRules:P===2?4:P,range:H.lspToMonacoRange(T.range)}});return{incomplete:!0,suggestions:h}}).catch(u=>(at.error("There was an error retrieving completion items",u),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:i},u=s.getSignatureHelp(l);at.debug("Requested signature help",l);var h=u.then(c=>{at.debug("Signatures received: ",l,u);var v=c.map(f=>{var{label:g,documentation:b,parameters:w}=f;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:w??[]}});if(v.length===0)return o;var p=0;return{value:{signatures:v,activeSignature:p,activeParameter:c[p].activeParameter},dispose:()=>{}}}).catch(c=>(at.error("There was an error retrieving completion items",c),o));return h}handleHoverRequest(e,t){var{model:n,session:i}=this.props;if(e!==n||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t)},a=i.getHover(o);at.debug("Requested hover",o);var s=a.then(l=>{at.debug("Hover received: ",o,l);var{contents:u}=l;return{contents:u!=null?[u]:[]}}).catch(l=>(at.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}Xt(H,"ruffWorkspace",void 0);Xt(H,"initRuffPromise",void 0);Xt(H,"isRuffInitialized",!1);Xt(H,"isRuffEnabled",!0);Xt(H,"ruffSettings",wm);function Mo(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function _m(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Mo(o,n,i,a,s,"next",l)}function s(l){Mo(o,n,i,a,s,"throw",l)}a(void 0)})}}function No(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 jo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?No(Object(t),!0).forEach(function(n){Om(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):No(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Om(r,e,t){return(e=xm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xm(r){var e=Im(r,"string");return typeof e=="symbol"?e:e+""}function Im(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ot=U.module("MonacoUtils"),Ao="inmemory://dh-console/";class me{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ot.debug("Initializing Monaco..."),e!==void 0&&me.registerGetWorker(e);var{initTheme:t,registerLanguages:n}=me;t(),n([gm,om,um,Sm,mm]),rt.onLanguage("python",()=>{rt.registerCodeActionProvider("python",{provideCodeActions:H.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),rt.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:H.handlePythonFormatRequest})}),Ie.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){H.ruffWorkspace!=null&&H.lintPython(i);var o=kr(a=>H.lintPython(a),250);i.onDidChangeContent(()=>{o(i)})}}),me.removeConflictingKeybindings(),Ot.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:n}=me,i=hs(ci);Ot.debug2("Monaco theme:",ci),Ot.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:n(i.foreground)},{token:"string",foreground:n(i.string)},{token:"string.delim",foreground:n(i["string-delim"])},{token:"keyword",foreground:n(i.keyword)},{token:"identifier.js",foreground:n(i["identifier-js"])},{token:"delimiter",foreground:n(i.delimiter)},{token:"comment",foreground:n(i.comment)},{token:"number",foreground:n(i.number)},{token:"storage",foreground:n(i.storage)},{token:"identifier",foreground:n(i.identifier)},{token:"namespace.identifier",foreground:n(i["namespace-identifier"])},{token:"operator",foreground:n(i.operator)},{token:"predefined",foreground:n(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:n(i["log-warn"])},{token:"info.log",foreground:n(i["log-info"])},{token:"stdout.log",foreground:n(i["log-stdout"])},{token:"trace.log",foreground:n(i["log-trace"])},{token:"debug.log",foreground:n(i["log-debug"])},{token:"date.log",foreground:n(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"]};Ie.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{Ie.setTheme("dh-dark")}catch(s){Ot.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),Ie.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=jo(jo({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(n=>{var{id:i}=n;return i});rt.getLanguages().filter(n=>{var{id:i}=n;return t.includes(i)}).forEach(n=>{var i=n;Ot.debug2("Overriding default language loader:",i.id)}),e.forEach(n=>{me.registerLanguage(n)})}static registerLanguage(e){Ot.debug2("Registering language: ",e.id),rt.register(e),rt.onLanguage(e.id,()=>{rt.setLanguageConfiguration(e.id,e.conf),rt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ie.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(n)}static openDocument(e,t){var n=e.getModel();L(n);var i={textDocument:{uri:"".concat(n.uri),languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};Ot.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,u=[],h=0;h<s.length;h+=1){var c=s[h],{range:v,rangeLength:p,text:f}=c,g={range:{start:{line:v.startLineNumber-1,character:v.startColumn-1},end:{line:v.endLineNumber-1,character:v.endColumn-1}},rangeLength:p,text:f};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(n.uri)},contentChanges:u};Ot.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var n=e.getModel();L(n);var i={textDocument:{uri:"".concat(n.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var n=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();L(a);var s=a.getValueInRange(t.range);(n.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(n,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){Ie.addKeybindingRule({keybinding:nt.CtrlCmd|qt.KeyD,command:null}),me.isMacPlatform()||Ie.addKeybindingRule({keybinding:nt.CtrlCmd|qt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(wt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:n}=t;if(n===null)return 0;var i=me.isMacPlatform();return i?(t.metaKey?nt.CtrlCmd:0)|(t.shiftKey?nt.Shift:0)|(t.altKey?nt.Alt:0)|(t.ctrlKey?nt.WinCtrl:0)|Zi.fromString(n):(t.ctrlKey?nt.CtrlCmd:0)|(t.shiftKey?nt.Shift:0)|(t.altKey?nt.Alt:0)|(t.metaKey?nt.WinCtrl:0)|Zi.fromString(n)}static provideLinks(e){for(var t=[],n=function(a){var s=e.getLineContent(a),l=du(s),u=l.filter(h=>h.type==="url"?/^https?:\/\//.test(h.value):!0);u.forEach(h=>{t.push({url:h.href,range:new gs(a,h.start+1,a,h.end+1)})})},i=1;i<=e.getLineCount();i+=1)n(i);return{links:t}}static generateConsoleUri(){return ld.parse("".concat(Ao).concat(wt()))}static isConsoleModel(e){return e.uri.toString().startsWith(Ao)}static canFormat(e){var t;return((t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.isSupported())===!0}static formatDocument(e){return _m(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function Lo(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 Dm(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lo(Object(t),!0).forEach(function(n){Pr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Lo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pr(r,e,t){return(e=km(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function km(r){var e=Mm(r,"string");return typeof e=="symbol"?e:e+""}function Mm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class rl extends m.Component{constructor(e){super(e),Pr(this,"container",void 0),Pr(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();L(t),Ie.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=Dm({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),L(this.container),this.editor=Ie.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[nt.CtrlCmd|qt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),rt.registerLinkProvider("plaintext",{provideLinks:me.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;L(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return d.jsx("div",{className:Z("editor-container",e),ref:t=>{this.container=t}})}}Pr(rl,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});function Ro(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Nm(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ro(o,n,i,a,s,"next",l)}function s(l){Ro(o,n,i,a,s,"throw",l)}a(void 0)})}}function tt(r,e,t){return(e=jm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jm(r){var e=Am(r,"string");return typeof e=="symbol"?e:e+""}function Am(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Zr=U.module("ConsoleInput"),Tr=parseInt(ci["line-height"],10),il=6,ol=6,Lm=Tr+il+ol,Yr=100;class Tn extends m.PureComponent{constructor(e){super(e),tt(this,"cancelListener",void 0),tt(this,"resizeObserver",void 0),tt(this,"commandContainer",void 0),tt(this,"commandEditor",void 0),tt(this,"commandHistoryIndex",void 0),tt(this,"commandSuggestionContainer",void 0),tt(this,"loadingPromise",void 0),tt(this,"timestamp",void 0),tt(this,"bufferIndex",void 0),tt(this,"history",void 0),tt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=R.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:Tr,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(Zr.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=Ie.createModel("",e,me.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Tr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:il,bottom:ol},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:n},o=this.commandContainer.current;L(o),this.commandEditor=Ie.create(o,i),me.setEOL(this.commandEditor),me.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:l}=this,u=s==null?void 0:s.getPosition();L(u);var{lineNumber:h}=u;if(!a.altKey&&!a.shiftKey&&!a.metaKey){if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&h===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&h===(n==null?void 0:n.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(a.keyCode===qt.Enter&&!this.isSuggestionMenuPopulated()){var c;a.stopPropagation(),a.preventDefault();var v=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(v!==void 0){var p;this.processCommand(v),(p=this.commandEditor)===null||p===void 0||p.setValue("")}}}}),me.disableKeyBindings(this.commandEditor,[nt.CtrlCmd|qt.KeyF]),me.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(o),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(me.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.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,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();L(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);L(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,n,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();L(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);L(u),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var n=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(n??i),e!==null&&e>this.history.length-Yr&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Nm(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:i}=e.props;e.loadingPromise=Te.makeCancelable(t.getTable(n,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+Yr-1}),e.loadingPromise=Te.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=Yr,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,u)=>{var{name:h}=s;return l===0||h!==u[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,Te.isCanceled(s)){Zr.debug2("Promise canceled, not loading history");return}Zr.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),L(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;L(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),Lm),i=t>n,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:n},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return d.jsx("div",{className:Z("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:Z("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:Tn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&d.jsx(H,{model:a,language:t,session:n})]})})}}tt(Tn,"defaultProps",{maxHeight:Tr*10,scope:null,disabled:!1});tt(Tn,"INPUT_CLASS_NAME","console-input");function Ut(r,e,t){return(e=Rm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rm(r){var e=Fm(r,"string");return typeof e=="symbol"?e:e+""}function Fm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fo="pasted values",$m=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Qr=[".csv",".tsv",".tab",".psv",".dsv",".txt"],$o=[".zip"];class Ve extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!$m.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Qr.some(n=>e.endsWith(n))||t&&$o.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Fo?zi:e.endsWith(".csv")?Fu:e.endsWith(".zip")?$u:Hu}constructor(e){super(e),Ut(this,"fileElem",void 0),Ut(this,"divElem",void 0),Ut(this,"getValidExtensions",Gt(t=>t?[...Qr,...$o]:[...Qr])),Ut(this,"getAcceptString",Gt(t=>this.getValidExtensions(t).join(", "))),Ut(this,"getFileTypeErrorString",Gt(t=>_s.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=R.createRef(),this.divElem=R.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 o=e.dataTransfer.items[0].getAsFile();L(o),Ve.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Ve.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:Fo,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:zi,action:this.handleMenuPaste,shortcut:Vt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ve.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(te,{actions:s}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:Bu})}),d.jsx("label",{children:"Drop file (or paste values) here to import"}),d.jsx("div",{className:"message-small",children:d.jsx("label",{children:"or"})}),d.jsx(oe,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(ve,{icon:Ve.getIcon(i)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[i,!n&&d.jsx(oe,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:cs,tooltip:"Remove"})]})]})]}),!!a&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:ms})}),d.jsx("label",{children:a}),a===Ve.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Ut(Ve,"defaultProps",{allowZip:!1,dragError:null});Ut(Ve,"MULTIPLE_FILE_ERROR","Please select only one file");Ut(Ve,"FILE_TYPE_ERROR","Filetype not supported.");function Oi(r,e,t){return(e=Hm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hm(r){var e=Bm(r,"string");return typeof e=="symbol"?e:e+""}function Bm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ke{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}Oi(ke,"TYPE_GLOBAL","type-global");Oi(ke,"TYPE_CONTEXT_PRESET","type-context-preset");Oi(ke,"TYPE_CONTEXT_CUSTOM","type-context-custom");class Um extends ke{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Wm extends ke{format(e){return String.fromCharCode(e)}}function Bt(r,e,t){return(e=Vm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vm(r){var e=Km(r,"string");return typeof e=="symbol"?e:e+""}function Km(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ho=U.module("DateTimeColumnFormatter");class vt extends ke{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ke.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var n=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var n=vt.makeGlobalFormatStringMap(e,t);return[...n.keys()]}static makeFormatStringMap(e,t){var n=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var n=vt.makeFormatStringMap(e,t);return[...n.keys()]}constructor(e){var{timeZone:t="",showTimeZone:n=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=vt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Bt(this,"dh",void 0),Bt(this,"dhTimeZone",void 0),Bt(this,"defaultDateTimeFormatString",void 0),Bt(this,"showTimeZone",void 0),Bt(this,"showTSeparator",void 0),Bt(this,"formatStringMap",void 0);var a=t||vt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{Ho.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(vt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=n,this.showTSeparator=i,this.formatStringMap=vt.makeFormatStringMap(n,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(n);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{Ho.error("Invalid format arguments")}return""}}Bt(vt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Bt(vt,"DEFAULT_TIME_ZONE_ID","America/New_York");var jt;function bt(r,e,t){return(e=zm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zm(r){var e=Gm(r,"string");return typeof e=="symbol"?e:e+""}function Gm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qm=U.module("DecimalColumnFormatter");class Ke extends ke{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ke.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return Ke.makeFormat(e,t,ke.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ke.makeFormat("Custom Format",e,ke.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ke.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),bt(this,"defaultFormatString",void 0),bt(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,i)}catch{qm.error("Invalid format arguments")}return""}}jt=Ke;bt(Ke,"DEFAULT_FORMAT_STRING","###,##0.0000");bt(Ke,"FORMAT_PERCENT",jt.makePresetFormat("Percent","##0.00%"));bt(Ke,"FORMAT_BASIS_POINTS",jt.makePresetFormat("Basis Points","###,##0 bp",1e4));bt(Ke,"FORMAT_THOUSANDS",jt.makePresetFormat("Thousands","##0.000 k",.001));bt(Ke,"FORMAT_MILLIONS",jt.makePresetFormat("Millions","###,##0.000 mm",1e-6));bt(Ke,"FORMAT_SCIENTIFIC_NOTATION",jt.makePresetFormat("Scientific Notation","0.0000E0"));bt(Ke,"FORMAT_ROUND",jt.makePresetFormat("Round","###,##0"));bt(Ke,"FORMAT_ROUND_TWO_DECIMALS",jt.makePresetFormat("0.00","###,##0.00"));bt(Ke,"FORMAT_ROUND_FOUR_DECIMALS",jt.makePresetFormat("0.0000","###,##0.0000"));class Xm extends ke{format(e){return"".concat(e)}}var Lr;function _n(r,e,t){return(e=Zm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zm(r){var e=Ym(r,"string");return typeof e=="symbol"?e:e+""}function Ym(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qm=U.module("IntegerColumnFormatter");class Et extends ke{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ke.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return Et.makeFormat(e,t,ke.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Et.makeFormat("Custom Format",e,ke.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Et.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),_n(this,"dh",void 0),_n(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,i)}catch{Qm.error("Invalid format arguments")}return""}}Lr=Et;_n(Et,"DEFAULT_FORMAT_STRING","###,##0");_n(Et,"FORMAT_THOUSANDS",Lr.makePresetFormat("Thousands","##0.000 k",.001));_n(Et,"FORMAT_MILLIONS",Lr.makePresetFormat("Millions","###,##0.000 mm",1e-6));_n(Et,"FORMAT_SCIENTIFIC_NOTATION",Lr.makePresetFormat("Scientific Notation","0.0000E0"));class Jm extends ke{format(e){return e}}function Bo(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 Uo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bo(Object(t),!0).forEach(function(n){xi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xi(r,e,t){return(e=ev(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ev(r){var e=tv(r,"string");return typeof e=="symbol"?e:e+""}function tv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nv=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class we{static makeDateWrapper(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var h="".concat(n).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),v="".concat(o).padStart(2,"0"),p="".concat(a).padStart(2,"0"),f="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),b="".concat(u).padStart(9,"0"),w="".concat(h,"-").concat(c,"-").concat(v," ").concat(p,":").concat(f,":").concat(g,".").concat(b);return e.i18n.DateTimeFormat.parse(we.FULL_DATE_FORMAT,w,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),n="0".repeat(9-e.length),i="".concat(t+1).concat(n);return parseInt(i,10)}static getNextDate(e,t,n,i){var{year:o,month:a,date:s,hours:l,minutes:u,seconds:h,nanos:c}=n;if(t.nanos!=null){if(t.nanos.length===9)return null;c=we.getNextNanos(t.nanos),c>999999999&&(h+=1,c=0)}else t.seconds!=null?h+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var v=new Date(o,a,s,l,u,h);return we.makeDateWrapper(e,i,v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var n=e.trim().toLowerCase();if(n.length>=3){for(var i=0;i<we.months.length;i+=1)if(we.months[i].startsWith(n))return i}return NaN}static parseDateValues(e,t,n,i,o,a,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,h=n!=null?parseInt(n,10):1,c=i!=null?parseInt(i,10):0,v=o!=null?parseInt(o,10):0,p=a!=null?parseInt(a,10):0,f=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(h)||Number.isNaN(c)||Number.isNaN(v)||Number.isNaN(p)||Number.isNaN(f)?null:{year:l,month:u,date:h,hours:c,minutes:v,seconds:p,nanos:f}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=nv.exec(e);if(n==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,u,,h,c]=n;if(!t&&c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));var v={year:i,month:o,date:a,hours:s,minutes:l,seconds:u,nanos:h};return t?Uo(Uo({},v),{},{overflow:c}):v}static parseDateRange(e,t,n){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=we.makeDateWrapper(e,n,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=we.makeDateWrapper(e,n,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var u=new Date(Date.now()),h=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),c=we.makeDateWrapper(e,n,h.getFullYear(),h.getMonth(),h.getDate()),v=we.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate());return[c,v]}if(i==="now"){var p=new Date(Date.now()),f=e.DateWrapper.ofJsDate(p);return[f,null]}var g=we.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var b=we.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(b==null)throw new Error("Unable to extract date values from ".concat(g));var w=we.makeDateWrapper(e,n,b.year,b.month,b.date,b.hours,b.minutes,b.seconds,b.nanos),T=we.getNextDate(e,g,b,n);return[w,T]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=we.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}xi(we,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");xi(we,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function Ny(r,e){return r===e?{operator:"notEq",value:""}:{operator:"eq",value:r}}function jy(r,e,t,n){return function(o){var a=t.trim();if(a==="")return null;var s=al(e,l=>r.makeSearchTextFilter(l,a,n),"or");return s(o)}}function al(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i==null?void 0:i.findColumns(typeof r=="string"?[r]:r);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function rv(r,e,t,n){return al(e,i=>i.filter()[n](r.makeFilterValue(i.type,t)),"or")}function Ay(r,e,t,n,i){return function(a){var s=a==null?void 0:a.findColumn(e),l=t==="all"||n&&t.size===0;return s==null||l?null:r.makeSelectValueFilter(s,[...t.keys()],i)}}function Ly(r){return function(t){return t.filter().isNull().not().and(t.filter().notEq(r.makeFilterValue(t.type,"")))}}function Ry(r,e){return function(n){var i=n.filter(),o=r.makeFilterValue(n.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Ii(r,e,t){return(e=iv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iv(r){var e=ov(r,"string");return typeof e=="symbol"?e:e+""}function ov(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Gn{}Ii(Gn,"not","not");Ii(Gn,"and","and");Ii(Gn,"or","or");function Fy(r){if(!(r==="not"||r==="and"||r==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function ye(r,e,t){return(e=av(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function av(r){var e=sv(r,"string");return typeof e=="symbol"?e:e+""}function sv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class E{}ye(E,"eq","eq");ye(E,"eqIgnoreCase","eqIgnoreCase");ye(E,"notEq","notEq");ye(E,"notEqIgnoreCase","notEqIgnoreCase");ye(E,"greaterThan","greaterThan");ye(E,"greaterThanOrEqualTo","greaterThanOrEqualTo");ye(E,"lessThan","lessThan");ye(E,"lessThanOrEqualTo","lessThanOrEqualTo");ye(E,"in","in");ye(E,"inIgnoreCase","inIgnoreCase");ye(E,"notIn","notIn");ye(E,"notInIgnoreCase","notInIgnoreCase");ye(E,"isTrue","isTrue");ye(E,"isFalse","isFalse");ye(E,"isNull","isNull");ye(E,"invoke","invoke");ye(E,"contains","contains");ye(E,"notContains","notContains");ye(E,"containsIgnoreCase","containsIgnoreCase");ye(E,"startsWith","startsWith");ye(E,"endsWith","endsWith");ye(E,"containsAny","containsAny");var lv="DH_ITEM_KEY",Wo=U.module("ViewportDataUtils");function sl(r){return"".concat(lv,"_").concat(r)}function $y(r,e){var{bulkUpdate:t}=r;return function(i){var{columns:o,offset:a,rows:s}=i.detail;Wo.debug("table updated",i.detail);var l=new Map;s.forEach((u,h)=>{var c=e(u,o),v=sl(a+h);l.set(v,{key:v,item:c})}),Wo.debug("update keys",l),t(l)}}function Hy(r,e){return e.reduce((t,n)=>(t[n.name]=r.get(n),t),{})}function*By(r,e){for(var t=r;t<=e;++t)yield{key:sl(t)}}function uv(r){return r==null||dv(r)?0:r.size}function dv(r){return r!=null&&typeof r=="object"&&"isClosed"in r&&typeof r.isClosed=="boolean"?r.isClosed:!1}function Uy(r,e,t,n){var i=r+e-1,[o,a]=[0,n-1],s=Vi(r-t,o,a),l=Vi(i+t,o,a);return[s,l]}var mi;function Vo(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function $t(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Vo(o,n,i,a,s,"next",l)}function s(l){Vo(o,n,i,a,s,"throw",l)}a(void 0)})}}function mn(r,e,t){return(e=hv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hv(r){var e=cv(r,"string");return typeof e=="symbol"?e:e+""}function cv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xt=U.module("TableUtils");function Wy(r){return r===C.sortDirection.ascending||r===C.sortDirection.descending||r===C.sortDirection.reverse||r===C.sortDirection.none}class C{static copyTableAndApplyFilters(e){var t=arguments;return $t(function*(){if(e==null)return null;for(var n=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return n.applyFilter(zr(...o.map(s=>s(n)))),n})()}static getSortIndex(e,t){for(var n=0;n<e.length;n+=1){var i,o=e[n];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return n}return null}static getSortForColumn(e,t){var n=C.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return C.isBooleanType(e)?[E.isTrue,E.isFalse,E.isNull]:C.isCharType(e)||C.isNumberType(e)||C.isDateType(e)?[E.eq,E.notEq,E.greaterThan,E.greaterThanOrEqualTo,E.lessThan,E.lessThanOrEqualTo]:C.isTextType(e)?[E.eq,E.eqIgnoreCase,E.notEq,E.notEqIgnoreCase,E.contains,E.notContains,E.startsWith,E.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;var i=C.getSortForColumn(t,e[n].name);return i===null?e[n].sort().asc():i.direction===C.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,n,i){if(t<0||t>=e.length||n===C.sortDirection.none)return null;var o=e[t].sort();switch(n){case C.sortDirection.ascending:o=o.asc();break;case C.sortDirection.descending:o=o.desc();break}return i&&(o=o.abs()),o}static toggleSortForColumn(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n<0||n>=t.length)return[];var o=C.getNextSort(t,e,n);return C.setSortForColumn(e,t[n].name,o,i)}static sortColumn(e,t,n,i,o,a){if(n<0||n>=t.length)return[];var s=C.makeColumnSort(t,n,i,o);return C.setSortForColumn(e,t[n].name,s,a)}static setSortForColumn(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=C.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==C.sortDirection.reverse})),o!==null&&a.splice(o,1)),n!==null&&a.push(n),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case C.dataType.BOOLEAN:return C.dataType.BOOLEAN;case"char":case"java.lang.Character":case C.dataType.CHAR:return C.dataType.CHAR;case"java.lang.String":case C.dataType.STRING:return C.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case C.dataType.DATETIME:return C.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case C.dataType.DECIMAL:return C.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case C.dataType.INT:return C.dataType.INT;default:return C.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return C.isIntegerType(e)||C.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return C.getNormalizedType(e)===C.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Te.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return C.makeCancelableEventPromise(e,t,{timeout:n,matcher:i??void 0})}static makeCancelableEventPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{timeout:i=0,matcher:o}=n,a,s,l=!0,u=new Promise((h,c)=>{s=setTimeout(()=>{a(),l=!1,c(new es('Event "'.concat(t,'" timed out.')))},i),a=e.addEventListener(t,v=>{if(o!=null&&!o(v)){xt.debug2("Event triggered, but matcher returned false.");return}xt.debug2("Event triggered, resolving."),a(),clearTimeout(s),l=!1,h(v)})});return u.cancel=()=>{if(l){xt.debug2("Pending promise cleanup."),a(),clearTimeout(s),l=!1;return}xt.debug2("Ignoring non-pending promise cancel.")},u}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var n=C.removeCommas(t);if(C.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case E.eq:return"=";case E.notEq:return"!=";case E.greaterThan:return">";case E.greaterThanOrEqualTo:return">=";case E.lessThan:return"<";case E.lessThanOrEqualTo:return"<=";case E.contains:return"~";case E.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((n,i)=>{var o=n.name.toUpperCase(),a=i.name.toUpperCase();return _s.sort(o,a,t)})}constructor(e){mn(this,"dh",void 0),this.dh=e,cd(this)}createDistinctSortedColumnTable(e,t,n){var i=arguments,o=this;return $t(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(a=yield e.copy(),yield a.applyFilter(zr(...l.map(p=>p(a)))));var h=a.findColumn(t),c=yield a.selectDistinct([h]);a!==e&&a.close();var v=c.findColumn(t).sort()[n]();return o.applySort(c,[v])})()}doesColumnValueExist(e,t,n,i){var o=this;return $t(function*(){if(e==null)return null;var a=rv(o,t,n,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,zr(a(s)));var l=uv(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=C.getNormalizedType(e);switch(t){case C.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case C.dataType.CHAR:case C.dataType.STRING:return this.dh.ValueType.STRING;case C.dataType.DATETIME:return this.dh.ValueType.DATETIME;case C.dataType.DECIMAL:case C.dataType.INT:return C.isBigDecimalType(e)||C.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,n){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),u=null,h=0;h<l.length;h+=1){var c=l[h].trim();if(c.length>0){var v=this.makeQuickFilterFromComponent(e,c,n);if(v)u?u=u.and(v):u=v;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&u?o=o.or(u):o=u}return o}makeQuickFilterFromComponent(e,t,n){var{type:i}=e;return C.isNumberType(i)?this.makeQuickNumberFilter(e,t):C.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):n!=null&&C.isDateType(i)?this.makeQuickDateFilter(e,t,n):C.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var n=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,u=null,h=null,c=null,v=null;if(s!==null&&s.length>3&&([,l,u,h,c,v]=s),v!=null&&v.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":o=n.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":u!=null?o=i.FilterCondition.invoke("isInf",n).and(n.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",n).and(n.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(h==null)return null;if(h=C.removeCommas(h),C.isLongType(e.type))try{h=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(h)))}catch(p){return xt.warn("Unable to create long filter",p),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=i.FilterValue.ofNumber(u!=null?0-h:h)}return o=e.filter(),C.makeRangeFilterWithOperation(o,l,h)}static escapeQuickTextFilter(e){if(e==null)return null;var t=/^(!~|!=|~|=|!)?(.*)/,n=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null?"\\".concat(o).concat(a??""):a!=null&&n.test(a.toLowerCase())||a!=null&&a.startsWith("*")?"\\".concat(a):a!=null&&a.endsWith("*")&&!a.endsWith("\\*")?(a=a.substring(0,a.length-1),"".concat(a,"\\*")):"".concat(o??"").concat(a??"")}static unescapeQuickTextFilter(e){var t=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,n=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null&&(o=o.replace("\\","")),a!=null&&n.test(a.toLowerCase())&&(a=a.replace("\\","")),o==null&&a!=null&&a.startsWith("\\*")&&(a=a.substring(1)),o==null&&a!=null&&a.endsWith("\\*")?(a=a.substring(0,a.length-2),"".concat(a,"*")):"".concat(o??"").concat(a??"")}makeQuickTextFilter(e,t){var{dh:n}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var h=null,c=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=C.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return h==="*"?u.isNull().or(u.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?u.isNull().or(u.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?u.isNull().not().and(u.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var n=/^(!=|=|!)?(.*)/,i=n.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),u=e.filter();try{var h=C.makeBooleanValue(l);return h!=null&&h?u=u.isTrue():h===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,n){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var u=E.eq;switch(s){case"<":u=E.lessThan;break;case"<=":case"=<":u=E.lessThanOrEqualTo;break;case">":u=E.greaterThan;break;case">=":case"=>":u=E.greaterThanOrEqualTo;break;case"!=":case"!":u=E.notEq;break;case"=":case"==":default:u=E.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,n)}makeQuickDateFilterWithOperation(e,t,n,i){var{dh:o}=this,[a,s]=we.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,u=s!=null?o.FilterValue.ofNumber(s):null,h=e.filter();if(l==null)return n===E.notEq?h.isNull().not():h.isNull();switch(n){case E.eq:{if(u!=null){var c=h.greaterThanOrEqualTo(l),v=h.lessThan(u);return c.and(v)}return h.eq(l)}case E.lessThan:return h.lessThan(l);case E.lessThanOrEqualTo:return u!=null?h.lessThan(u):h.lessThanOrEqualTo(l);case E.greaterThan:return u!=null?h.greaterThanOrEqualTo(u):h.greaterThan(l);case E.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case E.notEq:{if(u!=null){var p=h.lessThan(l),f=h.greaterThanOrEqualTo(u);return p.or(f)}return h.notEq(l)}default:throw new Error("Invalid operator: ".concat(n))}}makeQuickCharFilter(e,t){var{dh:n}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,u=null;if(a!==null&&a.length>3&&([,s,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var h=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}var c=n.FilterValue.ofString(C.isRangeOperation(s)?C.quoteValue(l):l);return C.makeRangeFilterWithOperation(h,s,c)}makeAdvancedFilter(e,t,n){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var h=i[u],{selectedType:c,value:v}=h;if(c!=null&&c.length>0&&v!=null&&v.length>0)try{var p=this.makeAdvancedValueFilter(e,c,v,n);if(p!=null){if(u===0)l=p;else if(l!==null&&u-1<o.length){var f=o[u-1];if(f===Gn.and)l=l.and(p);else if(f===Gn.or)l=l.or(p);else{xt.error("Unexpected filter operator",f,p),l=null;break}}}else xt.debug2("Empty filter ignored for",c,v)}catch(b){xt.error("Unable to create filter",b),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,n,i){var{dh:o}=this;if(C.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,n,t,i);if(C.isNumberType(e.type)||C.isCharType(e.type))return this.makeQuickFilter(e,"".concat(C.getFilterOperatorString(t)).concat(n));var a=this.makeFilterValue(e.type,n),s=e.filter();switch(t){case E.eq:return s.eq(a);case E.eqIgnoreCase:return s.eqIgnoreCase(a);case E.notEq:return s.notEq(a);case E.notEqIgnoreCase:return s.notEqIgnoreCase(a);case E.greaterThan:return s.greaterThan(a);case E.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case E.lessThan:return s.lessThan(a);case E.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case E.isTrue:return s.isTrue();case E.isFalse:return s.isFalse();case E.isNull:return s.isNull();case E.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))));case E.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))).not());case E.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(n,"\\E.*"))));case E.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E$"))));case E.in:case E.inIgnoreCase:case E.notIn:case E.notInIgnoreCase:case E.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,n){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return L(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,we.trimDateTimeStringTimeZone(t),"eq",n);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return L(a),a}return C.isBigDecimalType(e.type)||C.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,n=null;C.isTextType(e.type)?n=t.FilterValue.ofString("a"):C.isBooleanType(e.type)?n=t.FilterValue.ofBoolean(!0):C.isDateType(e.type)?n=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):n=t.FilterValue.ofNumber(0);var i=e.filter().eq(n),o=e.filter().notEq(n);return i.and(o)}makeFilterValue(e,t){var{dh:n}=this,i=C.getBaseType(e);return C.isTextType(i)?n.FilterValue.ofString(t):C.isLongType(i)?n.FilterValue.ofNumber(n.LongWrapper.ofString(C.removeCommas(t))):n.FilterValue.ofNumber(C.removeCommas(t))}makeFilterRawValue(e,t){var{dh:n}=this;return C.isCharType(e)?n.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):C.isTextType(e)?n.FilterValue.ofString(t):C.isBooleanType(e)?n.FilterValue.ofBoolean(t):n.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,n){var{dh:i}=this;if(t==="null")return null;if(C.isTextType(e))return t;if(C.isLongType(e))return i.LongWrapper.ofString(C.removeCommas(t));if(C.isBooleanType(e))return C.makeBooleanValue(t,!0);if(C.isDateType(e)){var[o]=we.parseDateRange(i,t,n);return o}return C.isNumberType(e)?C.makeNumberValue(t):(xt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,n){var{dh:i}=this;if(t.length===0)return n?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:C.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):C.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?n?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(o):e.filter().in(o)}}mi=C;mn(C,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});mn(C,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});mn(C,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);mn(C,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));mn(C,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);mn(C,"executeAndWaitForEvent",function(){var r=$t(function*(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:mi.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=mi.makeCancelableTableEventPromise(t,n,i);return e(t),yield o,t});return function(e,t,n){return r.apply(this,arguments)}}());function fn(r,e,t){return(e=mv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mv(r){var e=vv(r,"string");return typeof e=="symbol"?e:e+""}function vv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ll{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{var i=C.getNormalizedType(n.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o==null||o.set(n.columnName,n.format),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ys,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;fn(this,"defaultColumnFormatter",void 0),fn(this,"typeFormatterMap",void 0),fn(this,"columnFormatMap",void 0),fn(this,"truncateNumbersWithPound",void 0),fn(this,"showEmptyStrings",void 0),fn(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Xm,this.typeFormatterMap=new Map([[C.dataType.BOOLEAN,new Um],[C.dataType.CHAR,new Wm],[C.dataType.DATETIME,new vt(e,n)],[C.dataType.DECIMAL,new Ke(e,i)],[C.dataType.INT,new Et(e,o)],[C.dataType.STRING,new Jm]]),this.columnFormatMap=ll.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=C.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){var n,i=this.getColumnFormatMapForType(e);return(n=i==null?void 0:i.get(t))!==null&&n!==void 0?n:null}getColumnTypeFormatter(e){var t=C.getNormalizedType(e),n=this.defaultColumnFormatter;if(t){var i;n=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:n}return n}getFormattedString(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,n);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(C.dataType.DATETIME);return Uu(e,vt),e.dhTimeZone.id}}function vn(r,e,t){return(e=pv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pv(r){var e=fv(r,"string");return typeof e=="symbol"?e:e+""}function fv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Q{}vn(Q,"INTEGER","int");vn(Q,"LONG","long");vn(Q,"DOUBLE","double");vn(Q,"BOOLEAN","bool");vn(Q,"STRING","string");vn(Q,"DATE_TIME","datetime");vn(Q,"LOCAL_TIME","localtime");function ul(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 Ko(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 zo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ko(Object(t),!0).forEach(function(n){Be(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ko(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Be(r,e,t){return(e=gv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gv(r){var e=bv(r,"string");return typeof e=="symbol"?e:e+""}function bv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Go="unknown",yv=2147483647,Cv=-2147483648,qo=/^[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]+)?$/,Xo=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class je{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Q.STRING:return Q.STRING;case Q.INTEGER:return je.checkInteger(e);case Q.LONG:return je.checkLong(e);case Q.DOUBLE:return je.checkDouble(e);case Q.BOOLEAN:return je.checkBoolean(e);case Q.DATE_TIME:return je.checkDateTime(e);case Q.LOCAL_TIME:return je.checkLocalTime(e);default:return je.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?Q.STRING:je.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?Q.STRING:t.includes(".")?Q.DOUBLE:Q.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?Q.STRING:Q.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?Q.BOOLEAN:Q.STRING}static checkDateTime(e){return qo.test(e)?Q.DATE_TIME:Q.STRING}static checkLocalTime(e){return Xo.test(e)?Q.LOCAL_TIME:Q.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(je.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?Q.BOOLEAN:qo.test(e)&&e.includes(":")?Q.DATE_TIME:Xo.test(e)?Q.LOCAL_TIME:Q.STRING}return je.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Q.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return Q.LONG;var n=parseInt(e,10);return n>yv||n<Cv?Q.LONG:Q.INTEGER}constructor(e,t,n,i,o,a,s,l,u,h){Be(this,"onFileCompleted",void 0),Be(this,"file",void 0),Be(this,"readHeaders",void 0),Be(this,"nullString",void 0),Be(this,"onProgress",void 0),Be(this,"onError",void 0),Be(this,"types",void 0),Be(this,"chunks",void 0),Be(this,"totalChunks",void 0),Be(this,"rowCount",void 0),Be(this,"isZip",void 0),Be(this,"shouldTrim",void 0),Be(this,"zipProgress",void 0),Be(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,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=zo(zo({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Bn.parse(this.file,this.config);else{var e=ul(this.file,this.handleNodeUpdate);Bn.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(Go),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,L(this.types);var i=[...this.types];n.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=je.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
@@ -20,5 +20,5 @@ Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(thi
|
|
|
20
20
|
`&&(n+=`
|
|
21
21
|
`))}}if(n=n.trimRight(),this.editor.setValue(n),t){var s,l=(s=this.editor.getModel())===null||s===void 0?void 0:s.getLineCount();L(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>Se.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-Se.truncateSize))}scrollToBottom(){var e,t;if(this.editor){var n=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(t=t.call(e))===null||t===void 0?void 0:t.getLineCount();L(n),this.editor.revealLine(n,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return L(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 o=n[i];if(o.startLineNumber<=e&&e<=o.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=Se.getLogText(n);e+=i,i.charAt(i.length-1)!==`
|
|
22
22
|
`&&(e+=`
|
|
23
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Se.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 d.jsxs("div",{className:"log-pane h-100 w-100",children:[d.jsxs("div",{className:"log-pane-menu",children:[d.jsx(oe,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Ku,tooltip:"Clear log"}),d.jsx(oe,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:zu,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(Qn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}it(Se,"DefaultLogLevels",[xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN]);it(Se,"AllLogLevels",[xe.INFO,xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN,xe.DEBUG,xe.TRACE]);it(Se,"bufferTimeout",16);it(Se,"maxLogSize",131072);it(Se,"truncateSize",65536);const ep="var(--dh-color-chart-colorway)",tp="var(--dh-color-chart-grid)",np="var(--dh-color-chart-axis-line)",rp="var(--dh-color-chart-axis-line-zero)",aa={"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:ep,gridcolor:tp,linecolor:np,zerolinecolor:rp,"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)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)"};var sa=U.module("ChartTheme");function ip(){var r,e=hs(aa);return e.colorway=Gu((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return qu.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),sa.debug2("Chart theme:",aa),sa.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"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"]})}function la(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 op(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(n){ap(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ap(r,e,t){return(e=sp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sp(r){var e=lp(r,"string");return typeof e=="symbol"?e:e+""}function lp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var up=m.lazy(()=>bs(()=>import("./Plot-DCq52K02.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function dp(r){return d.jsx(m.Suspense,{fallback:d.jsx(hn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(up,op({},r))})}var ki=m.createContext(null);ki.displayName="ChartThemeContext";function Vy(r){var{children:e}=r,{activeThemes:t}=Ds(),n=m.useMemo(ip,[t]);return d.jsx(ki.Provider,{value:n,children:e})}function hp(){return Yn(ki,"No ChartThemeContext value found.")}function ua(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function cp(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ua(o,n,i,a,s,"next",l)}function s(l){ua(o,n,i,a,s,"throw",l)}a(void 0)})}}var mp=U.module("HeapUsage");function vp(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=hp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),p=xs(),f=m.useCallback(cp(function*(){try{var A=yield t.getWorkerHeapInfo();if(!p.current)return;if(u(A),o||h){for(var B=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:pe,usages:Ge}=v.current;pe.length!==0&&V-pe[0]>a*1.5;)pe.shift(),Ge.shift();pe.push(V),Ge.push(B)}else v.current={timestamps:[],usages:[]}}catch(Ne){mp.warn("Unable to get heap usage",Ne)}}),[t,p,o,h,a]);zd(f,h?i:n);var g=(A,B)=>Math.round(A*10**B)/10**B,b=2,w=1024**3,{freeMemory:T,totalHeapSize:P,maximumHeapSize:F}=l,G=g(T/w,b),ee=g(P/w,b),Y=g(F/w,b),N=ee-G,$=function(B,V){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:Z("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:B}),d.jsx("div",{children:V})]})},{timestamps:ne,usages:q}=v.current,j=(e=ne[ne.length-1])!==null&&e!==void 0?e:0,z=P/F,W=(P-T)/F;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(z*100,"% - ").concat(z*2,"px")}}),d.jsx("div",{className:Z("used-memory",{"heap-overflow":(P-T)/F>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[$("In use:","".concat(N.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),$("Free:","".concat(G.toFixed(b)," GB")),$("Total:","".concat(ee.toFixed(b)," GB")),$("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(dp,{data:[{x:[...ne],y:[...q],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(a/6),gridcolor:s.linecolor,range:[j-a,j],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}var vl=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 pl(r){return r.componentName!==void 0}function pp(r){return r.component!==void 0}var fl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const fp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:vl,isGLComponentConfig:pl,isReactComponentConfig:pp,itemDefaultConfig:fl},Symbol.toStringTag,{value:"Module"}));function Cr(r,e,t){return(e=gp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gp(r){var e=bp(r,"string");return typeof e=="symbol"?e:e+""}function bp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ze{constructor(){Cr(this,"_mSubscriptions",void 0),Cr(this,"off",this.unbind),Cr(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[ze.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),o=1;o<n;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[ze.ALL_EVENT],u=0;u<l.length;u++){var h=l[u].ctx||{};try{l[u].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,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Cr(ze,"ALL_EVENT","__all");function ct(r,e,t){return(e=yp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yp(r){var e=Cp(r,"string");return typeof e=="symbol"?e:e+""}function Cp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class pi extends ze{constructor(e,t,n){super(),ct(this,"width",void 0),ct(this,"height",void 0),ct(this,"title",void 0),ct(this,"parent",void 0),ct(this,"layoutManager",void 0),ct(this,"tab",void 0),ct(this,"_config",void 0),ct(this,"isHidden",!1),ct(this,"beforeCloseHandler",void 0),ct(this,"_element",k(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ct(this,"_contentElement",void 0),this.title=pl(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,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",h=u==="height"?t:e,c=((n=this[u])!==null&&n!==void 0?n:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=h/c*100,p=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),f=0;f<a.contentItems.length;f++)if(a.contentItems[f]===s)a.contentItems[f].config[u]=v;else{var g;a.contentItems[f].config[u]=((g=a.contentItems[f].config[u])!==null&&g!==void 0?g:0)+p}return a.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}getConfig(){return this._config}extendState(e){this.setState(k.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,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Sp=Object.freeze(Object.defineProperty({__proto__:null,Container:pi,ItemContainer:pi},Symbol.toStringTag,{value:"Module"}));function gl(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function bl(r){if(window.location.hash)return gl(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 Mi(r){return window.requestAnimationFrame(r)}function wp(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 Or(){return wt()}function Ep(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 Ni(r){return k.trim(r.replace(/(<([^>]+)>)/gi,""))}function Xe(r,e,t){return(e=Pp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pp(r){var e=Tp(r,"string");return typeof e=="symbol"?e:e+""}function Tp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Jn extends ze{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Xe(this,"_eElement",void 0),Xe(this,"_oDocument",void 0),Xe(this,"_eBody",void 0),Xe(this,"_root",void 0),Xe(this,"_destroyAfterMouseUp",void 0),Xe(this,"_nDelay",400),Xe(this,"_timeout",void 0),Xe(this,"timeout",void 0),Xe(this,"_nDistance",10),Xe(this,"_nX",0),Xe(this,"_nY",0),Xe(this,"_nOriginalX",0),Xe(this,"_nOriginalY",0),Xe(this,"_bDragging",!1),this._eElement=e,this._oDocument=k(document),this._eBody=k(document.body),this._root=t,this._destroyAfterMouseUp=i,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(n=this._eElement)===null||n===void 0||n.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,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=a.y)!==null&&n!==void 0?n:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.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,o,a;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||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),(a=this._root)===null||a===void 0||a.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,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._root)===null||n===void 0||n.childElementContainer.addClass("lm_dragging"),(i=this._oDocument)===null||i===void 0||(i=i.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}}}function gn(r,e,t){return(e=_p(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _p(r){var e=Op(r,"string");return typeof e=="symbol"?e:e+""}function Op(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yl{constructor(e,t){gn(this,"_container",void 0),gn(this,"_reactComponent",null),gn(this,"_portalComponent",null),gn(this,"_originalComponentWillUpdate",null),gn(this,"_initialState",void 0),gn(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=Mr.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=k.extend(e,this._container._config.props);return R.createElement(this._reactClass,t)}}var xr=["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"],xp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ji(r){if(xr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Ai(r,e,"_min"),e}function fi(r){if(xr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Ai(r,e,"_max"),e}function Ai(r,e,t){var n=t==="_min"?Ip:Dp;for(var i in r)if(r.hasOwnProperty(i)){var o=Array.isArray(r)?r[Number.parseInt(i,10)]:r[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=n(i,xr);e[s]=a}Ai(o,a,t)}else{var l=n(o,xp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=n(i,xr);e[u]=l}}}}function Ip(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function Dp(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function Jr(r,e,t){return(e=kp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kp(r){var e=Mp(r,"string");return typeof e=="symbol"?e:e+""}function Mp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gi{constructor(e,t){Jr(this,"name",void 0),Jr(this,"origin",void 0),Jr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function lr(r,e,t){return(e=Np(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Np(r){var e=jp(r,"string");return typeof e=="symbol"?e:e+""}function jp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let Cl=class extends ze{constructor(e){super(),lr(this,"_layoutManager",void 0),lr(this,"_dontPropagateToParent",void 0),lr(this,"_childEventSource",void 0),lr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(ze.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),k(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(){k(window).off("gl_child_event",this._boundOnEventFromChild)}};function Sl(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function wl(r){return(e,t)=>Sl(e,r,t)}function El(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e.emit(r,...n)}}function Pl(r){return(e,t)=>{var n=m.useRef(null),i=m.useRef(()=>!1);if(n.current!=e||i.current!=t){var o;(o=n.current)===null||o===void 0||o.off(r,i.current),e==null||e.on(r,t)}n.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=n.current)===null||a===void 0?void 0:a.off(r,i.current)},[])}}function Zt(r){return{listen:wl(r),emit:El(r),useListener:Pl(r)}}const Ap=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:gi,DragListener:Jn,EventEmitter:ze,EventHub:Cl,ReactComponentHandler:yl,animFrame:Mi,filterXss:Ep,getHashValue:gl,getQueryStringParam:bl,getUniqueId:Or,listenForEvent:Sl,makeEmitFunction:El,makeEventFunctions:Zt,makeListenFunction:wl,makeUseListenerFunction:Pl,minifyConfig:ji,removeFromArray:wp,stripTags:Ni,unminifyConfig:fi},Symbol.toStringTag,{value:"Module"}));function Rt(r,e,t){return(e=Lp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lp(r){var e=Rp(r,"string");return typeof e=="symbol"?e:e+""}function Rp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Tl extends ze{constructor(e,t,n,i,o){super(),Rt(this,"isInitialised",!1),Rt(this,"_config",void 0),Rt(this,"_dimensions",void 0),Rt(this,"_parentId",void 0),Rt(this,"_indexInParent",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_popoutWindow",null),Rt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,i,o,a,s,l,u,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=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&n!==void 0?n:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s: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=k.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 o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o: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;k(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},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-"+Or();e=ji(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 _e(r,e,t){return(e=Fp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fp(r){var e=$p(r,"string");return typeof e=="symbol"?e:e+""}function $p(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class pn extends ze{constructor(e,t,n,i,o,a){var s,l,u,h,c,v,p,f;if(super(),_e(this,"_dragListener",void 0),_e(this,"_layoutManager",void 0),_e(this,"_contentItem",void 0),_e(this,"_originalParent",void 0),_e(this,"_area",null),_e(this,"_lastValidArea",null),_e(this,"_minX",void 0),_e(this,"_maxX",void 0),_e(this,"_minY",void 0),_e(this,"_maxY",void 0),_e(this,"_width",void 0),_e(this,"_height",void 0),_e(this,"_sided",void 0),_e(this,"element",void 0),_e(this,"childElementContainer",void 0),_e(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=k(pn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._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",Ni((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").text((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),k(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,T;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(h=P==null?void 0:P.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(f=this.element.height())!==null&&f!==void 0?f:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,o,a=(i=n.pageX)!==null&&i!==void 0?i:0,s=(o=n.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,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")}}_e(pn,"_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 ur(r,e,t){return(e=Hp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hp(r){var e=Bp(r,"string");return typeof e=="symbol"?e:e+""}function Bp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _l{constructor(e,t,n){ur(this,"_element",void 0),ur(this,"_itemConfig",void 0),ur(this,"_layoutManager",void 0),ur(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Jn(this._element,this._layoutManager.root,!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(k.extend(!0,{},n));new pn(e,t,this._dragListener,this._layoutManager,i,null)}}function dr(r,e,t){return(e=Up(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Up(r){var e=Wp(r,"string");return typeof e=="symbol"?e:e+""}function Wp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ol{constructor(e,t,n){dr(this,"_element",k(window)),dr(this,"_itemConfig",void 0),dr(this,"_layoutManager",void 0),dr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&this._layoutManager&&(this._dragListener=new Jn(this._element,this._layoutManager.root,!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(k.extend(!0,{},n));new pn(e,t,this._dragListener,this._layoutManager,i,null)}}}function xl(r,e,t){return(e=Vp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vp(r){var e=Kp(r,"string");return typeof e=="symbol"?e:e+""}function Kp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class er{constructor(){xl(this,"element",k(er._template)),k(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()}}xl(er,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ei(r,e,t){return(e=zp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zp(r){var e=Gp(r,"string");return typeof e=="symbol"?e:e+""}function Gp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hn{constructor(e,t,n,i){ei(this,"element",void 0),ei(this,"_header",void 0),ei(this,"_action",void 0),this._header=e,this.element=k('<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 qp(r,e,t){return(e=Xp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xp(r){var e=Zp(r,"string");return typeof e=="symbol"?e:e+""}function Zp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class an extends Error{constructor(e,t){super(),qp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Yp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:an},Symbol.toStringTag,{value:"Module"}));function Pe(r,e,t){return(e=Qp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qp(r){var e=Jp(r,"string");return typeof e=="symbol"?e:e+""}function Jp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function sn(r){return r.isStack}function Je(r){return r.isComponent}function Il(r){return r.isRoot}class De extends ze{constructor(e,t,n,i){super(),Pe(this,"config",void 0),Pe(this,"type",void 0),Pe(this,"contentItems",void 0),Pe(this,"parent",void 0),Pe(this,"layoutManager",void 0),Pe(this,"element",void 0),Pe(this,"childElementContainer",void 0),Pe(this,"componentName",void 0),Pe(this,"isInitialised",!1),Pe(this,"isMaximised",!1),Pe(this,"isRoot",!1),Pe(this,"isRow",!1),Pe(this,"isColumn",!1),Pe(this,"isStack",!1),Pe(this,"isComponent",!1),Pe(this,"tab",void 0),Pe(this,"_pendingEventPropagations",void 0),Pe(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(ze.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 o=0;o<this.contentItems.length;o++)this.contentItems[o].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 o;(o=this.parent)===null||o===void 0||o.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),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,sn(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(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),n(o.contentItems[a])};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&&Je(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 o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(n=e.width())!==null&&n!==void 0?n:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new gi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new an("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(fl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof gi&&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,Mi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function jn(r,e,t){return(e=ef(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ef(r){var e=tf(r,"string");return typeof e=="symbol"?e:e+""}function tf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dl extends De{constructor(e,t,n){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,u]=s;t[l]===void 0&&(t[l]=u)}),super(e,t,n,k()),jn(this,"config",void 0),jn(this,"componentName",void 0),jn(this,"container",void 0),jn(this,"parent",void 0),jn(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=k.extend(!0,{},this.config.componentState||{});if(o==null)throw new an('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 pi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){De.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),De.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),De.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),De.prototype._$destroy.call(this)}_$getArea(){return null}}function lt(r,e,t){return(e=nf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nf(r){var e=rf(r,"string");return typeof e=="symbol"?e:e+""}function rf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qn extends De{constructor(e,t,n,i){super(t,n,i,k('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),lt(this,"isRow",void 0),lt(this,"isColumn",void 0),lt(this,"childElementContainer",void 0),lt(this,"parent",void 0),lt(this,"_splitter",[]),lt(this,"_splitterSize",void 0),lt(this,"_splitterGrabSize",void 0),lt(this,"_isColumn",void 0),lt(this,"_dimension",void 0),lt(this,"_splitterPosition",null),lt(this,"_splitterMinPosition",null),lt(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,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),De.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}if(De.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,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(De.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,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var u,h,c=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[n];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[n]=((u=this.contentItems[l].config[n])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=u.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var p=0;p<n.length;p++){l=n[p];var f=Math.round((l.width-t)*v);a-=f,l.width-=f}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new kl(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 o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((n=a.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_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,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),c=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Mi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function da(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 ha(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?da(Object(t),!0).forEach(function(n){bi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):da(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bi(r,e,t){return(e=of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function of(r){var e=af(r,"string");return typeof e=="symbol"?e:e+""}function af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yi extends De{constructor(e,t,n){super(e,ha(ha({},t),{},{type:"root"}),null,k('<div class="lm_goldenlayout lm_item lm_root"></div>')),bi(this,"childElementContainer",void 0),bi(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(Je(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,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof qn)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}function ca(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 bn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(n){et(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function et(r,e,t){return(e=sf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sf(r){var e=lf(r,"string");return typeof e=="symbol"?e:e+""}function lf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ci extends De{constructor(e,t,n){var i,o,a,s,l,u,h,c,v;super(e,t,n,k('<div class="lm_item lm_stack"></div>')),et(this,"_activeContentItem",null),et(this,"_header",void 0),et(this,"childElementContainer",k('<div class="lm_items"></div>')),et(this,"header",void 0),et(this,"parent",void 0),et(this,"isStack",!0),et(this,"_dropSegment",null),et(this,"_contentAreaDimensions",null),et(this,"_dropIndex",void 0),et(this,"_side",void 0),et(this,"_sided",!1),et(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:(o=p.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=p.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=p.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=p.settings)!==null&&u!==void 0&&u.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(v=p.labels)===null||v===void 0?void 0:v.minimise)!==null&&c!==void 0?c:void 0},p.header&&(this._header=bn(bn({},this._header),p.header)),t.header&&(this._header=bn(bn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=bn(bn({},this._header),t.content[0].header)),this.header=new Nt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){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),Je(e)?e._$show(t):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(){De.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",o=this.parent instanceof qn&&(t&&this.parent.isColumn||n&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Je(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c,v=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.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,o,a,s,l,u,h,c,v,p,f,g,b,w,T=this.header.tabs.length;if(T===0){var P,F,G,ee,Y,N,$,ne,q=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(F=q==null?void 0:q.left)!==null&&F!==void 0?F:0,x2:((G=q==null?void 0:q.left)!==null&&G!==void 0?G:0)+100,y1:(ee=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&ee!==void 0?ee:0,y2:((N=($=this.header.element.offset())===null||$===void 0?void 0:$.top)!==null&&N!==void 0?N:0)+((ne=this.header.element.innerHeight())!==null&&ne!==void 0?ne:0)});return}var j=this.header.tabsContainer,z=(t=j.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),W=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!z||!W)){e<z.left?e=z.left+1:e>z.right&&(e=z.right-1);var A,B;if(!(W.left<e&&e<W.right)){for(var V=0;V<T;V++){var pe;if(A=this.header.tabs[V].element,B=(pe=A.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),B&&B.left<e&&e<B.right){this._dropIndex=V;break}}if(A&&B&&e<B.left+B.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var Ge;this._dropIndex=Math.min(((Ge=this._dropIndex)!==null&&Ge!==void 0?Ge:0)+1,T),A.after(this.layoutManager.tabDropPlaceholder)}}var Ne=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;Ne=Math.max(Ne,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var y=Ne+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((u=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&u!==void 0?u:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:Ne,x2:y,y1:(p=(f=this.header.element.offset())===null||f===void 0?void 0:f.top)!==null&&p!==void 0?p:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(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=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}this._dropSegment=e}}const uf=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:De,Component:Dl,ContentItem:De,Root:yi,RowOrColumn:qn,Stack:Ci,isComponent:Je,isRoot:Il,isStack:sn},Symbol.toStringTag,{value:"Module"}));function Dt(r,e,t){return(e=df(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function df(r){var e=hf(r,"string");return typeof e=="symbol"?e:e+""}function hf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class tr{constructor(e,t){var n;Dt(this,"header",void 0),Dt(this,"contentItem",void 0),Dt(this,"element",k(tr._template)),Dt(this,"titleElement",void 0),Dt(this,"closeElement",void 0),Dt(this,"isActive",!1),Dt(this,"_layoutManager",void 0),Dt(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 Jn(this.element,this._layoutManager.root),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.element.on("mouseup",this._onMouseUp),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),Je(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.text(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.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Je(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 pn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){k(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Je(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&&Je(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Je(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Je(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(),Je(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}}Dt(tr,"_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 se(r,e,t){return(e=cf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cf(r){var e=mf(r,"string");return typeof e=="symbol"?e:e+""}function mf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nt extends ze{constructor(e,t){var n,i;super(),se(this,"layoutManager",void 0),se(this,"element",k(Nt._template)),se(this,"tabsContainer",void 0),se(this,"tabDropdownContainer",void 0),se(this,"tabDropdownSearch",void 0),se(this,"tabDropdownList",null),se(this,"controlsContainer",void 0),se(this,"parent",void 0),se(this,"tabs",[]),se(this,"activeContentItem",null),se(this,"closeButton",null),se(this,"tabDropdownButton",null),se(this,"tabNextButton",k(Nt._nextButtonTemplate)),se(this,"tabPreviousButton",k(Nt._previousButtonTemplate)),se(this,"holdTimer",null),se(this,"rAF",null),se(this,"CLICK_TIMEOUT",500),se(this,"START_SPEED",.01),se(this,"ACCELERATION",5e-4),se(this,"PADDING",10),se(this,"SCROLL_LEFT","left"),se(this,"SCROLL_RIGHT","right"),se(this,"isDraggingTab",!1),se(this,"isOverflowing",!1),se(this,"isDropdownShown",!1),se(this,"dropdownKeyIndex",0),se(this,"_lastVisibleTabIndex",-1),se(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 tr(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,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(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,o,a,s;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,h;l.scrollLeft=(u=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.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,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,v,p=o||h,f=h-p,g=this.START_SPEED*f+.5*this.ACCELERATION*(f*f);g=Math.min(g,(c=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,p)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),k(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,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Hn(this,o,"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 Hn(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Hn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Hn(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"),k(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"),k(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var h=(s+l+u.length)%u.length;h!==s;){if(u.eq(h).css("display")!=="none")return h;h=(h+l+u.length)%u.length}return s}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 o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.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(),k(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(n=k(window).height())!==null&&n!==void 0?n:0,l=(i=k(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<s-u.bottom,c=!h&&u.bottom>s*.6,v=Math.min(u.left+(c?u.width:0),l-a.width-this.PADDING),p=c?Math.max(u.top-o,this.PADDING):u.bottom,f=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":f,top:p,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}se(Nt,"_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(""));se(Nt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));se(Nt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function An(r,e,t){return(e=vf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vf(r){var e=pf(r,"string");return typeof e=="symbol"?e:e+""}function pf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kl{constructor(e,t,n){An(this,"_isVertical",void 0),An(this,"_size",void 0),An(this,"_grabSize",void 0),An(this,"_dragListener",void 0),An(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new Jn(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=k('<div class="lm_drag_handle"></div>'),t=k('<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 ff=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Tl,DragProxy:pn,DragSource:_l,DragSourceFromEvent:Ol,DropTargetIndicator:er,Header:Nt,HeaderButton:Hn,Splitter:kl,Tab:tr},Symbol.toStringTag,{value:"Module"}));var gf={config:fp,container:Sp,controls:ff,errors:Yp,items:uf,utils:Ap};function ma(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 Ze(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(n){le(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function le(r,e,t){return(e=bf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bf(r){var e=yf(r,"string");return typeof e=="symbol"?e:e+""}function yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var va=["column","row","stack","component"];class Fr extends ze{static isLayoutItemConfig(e){return va.includes(e.type)}static minifyConfig(e){return ji(e)}static unminifyConfig(e){return fi(e)}constructor(e,t){super(),le(this,"isInitialised",!1),le(this,"_isFullPage",!1),le(this,"_resizeTimeoutId",void 0),le(this,"_components",{"lm-react-component":yl}),le(this,"_fallbackComponent",void 0),le(this,"_itemAreas",[]),le(this,"_maximisedItem",null),le(this,"_maximisePlaceholder",k('<div class="lm_maximise_place"></div>')),le(this,"_creationTimeoutPassed",!1),le(this,"_subWindowsCreated",!1),le(this,"_dragSources",[]),le(this,"_updatingColumnsResponsive",!1),le(this,"_firstLoad",!0),le(this,"_reactChildMap",new Map),le(this,"_reactChildren",null),le(this,"_initialHeaderHeight",void 0),le(this,"width",null),le(this,"height",null),le(this,"root",void 0),le(this,"openPopouts",[]),le(this,"selectedItem",null),le(this,"isSubWindow",!1),le(this,"eventHub",new Cl(this)),le(this,"config",void 0),le(this,"container",void 0),le(this,"_originalContainer",void 0),le(this,"dropTargetIndicator",null),le(this,"tabDropPlaceholder",k('<div class="lm_drop_tab_placeholder"></div>')),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._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&k("body").css("visibility","hidden")}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 De))throw new Error("Root must be a ContentItem");var t={settings:Ze({},this.config.settings),dimensions:Ze({},this.config.dimensions),labels:Ze({},this.config.labels),content:[]},n=function(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var u=0;u<s.contentItems.length;u++)a.content[u]={},n(a.content[u],s.contentItems[u])}};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){k(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 er,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}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}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 o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),k(window).off("resize",this._onResize),k(window).off("unload beforeunload",this._onUnload),k(window).off("blur.lm").off("focus.lm"),k(window).off("keydown",this._windowKeydown),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 an("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Fr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+va.join(","),new an(i);return e.type==="component"&&!(t instanceof Ci)&&t&&!(this.isSubWindow===!0&&t instanceof yi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Or(),e.type==="stack"?new Ci(this,e,t):e.type==="row"?new qn(!1,this,e,t):e.type==="column"?new qn(!0,this,e,t):new Dl(this,e,t)}createPopout(e,t,n,i){var o=[],a=e instanceof De,s=this;if(a){var l;o=this.toConfig(e).content,n=Or();for(var u=e.parent,h=e;((c=u)===null||c===void 0?void 0:c.contentItems.length)===1&&!u.isRoot;){var c;h=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var p,f,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,T=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:b+T.left,top:w+T.top,width:(f=e.element.width())!==null&&f!==void 0?f:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!n||i===void 0)){var P=new Tl(o,t,n,i,this);return P.on("initialised",function(){s.emit("windowOpened",P)}),P.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new _l(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Ol(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,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&n>a.surface&&(n=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Ze({},this.root._$getArea()),n=[Ze(Ze({},t),{},{side:"left",x2:t.x1+e}),Ze(Ze({},t),{},{side:"right",x1:t.x2-e}),Ze(Ze({},t),{},{side:"top",y2:t.y1+e}),Ze(Ze({},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(sn(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Ze(Ze({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof De)return e;if(k.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t??null);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&&k(window).resize(this._onResize),k(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=bl("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=fi(e),localStorage.removeItem(n)),e=k.extend(!0,{},vl,e);var i=function(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?i(l):s==="type"&&l==="react-component"&&(a.type="component",a.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=k('<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=Ni((e=this.config.content[0].title)!==null&&e!==void 0?e:""),k("head").append(k("body link, body style, template, .gl_keep")),this.container=k("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?k(this._originalContainer):k("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,k("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 an(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new an(t,e);this.root=new yi(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),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var u=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(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=>{sn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}le(Fr,"__lm",gf);const pa={"tab-height":"28px","drag-border-width":"5px"},fa=Object.freeze({tabHeight:parseInt(pa["tab-height"],10),dragBorderWidth:parseInt(pa["drag-border-width"],10)});function ga(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 It(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(n){Ml(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ml(r,e,t){return(e=Cf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cf(r){var e=Sf(r,"string");return typeof e=="symbol"?e:e+""}function Sf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ft=U.module("LayoutUtils");function Nl(r){return r.componentName!==void 0}function Wt(r){var e=r;return(Nl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function hr(r){return r.focus!==void 0}function ba(r){return r.type==="stack"}class x{static activateTab(e,t){var n=x.getStackForRoot(e,t,!1);if(!n){Ft.error("Could not find stack for config",t);return}var i=x.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=x.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),!1;var i=x.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(Il(e)){var n={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(n);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(n);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,h,c=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(h=s.config)===null||h===void 0?void 0:h.width},e);e.replaceChild(s,c),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(n=>n.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=x.getAllStackContainers(e),n=x.getFocusedStackIndex(t);return t[n]}static getStackById(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&sn(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(sn(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var n;if(((n=e.config)===null||n===void 0?void 0:n.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}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&&sn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&Ki(o.config,t))return e;var a=this.getStackForConfig(o,t,n);if(a)return a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&n&&(a=this.addStack(e)),a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,u=x.getStackForRoot(e,{component:s},n&&l,i,o);if(u)return u}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&&Ki(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 o=e[i],{content:a}=o;if(Wt(o)){var s=t(o.component,o);s!=null?n.push(s):Ft.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=It(It({},o),{},{content:x.dehydrateLayoutConfig(a,t)});n.push(l)}else n.push(o)}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?(ba(n)&&delete n.activeItemIndex,x.dropLayoutMinorChange(i)):Wt(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=x.cloneLayout(e),o=x.cloneLayout(t);return n?(x.dropLayoutMinorChange(i),x.dropLayoutMinorChange(o),Kn(i,o)):Kn(i,o)}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 o=e[i];if(Wt(o)){var a,{component:s,props:l={}}=o;n.push(It(It({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:wt(),props:t(s,l)}))}else if(o.content!==void 0){var u=x.hydrateLayoutConfig(o.content,t);ba(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ft.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(It(It({},o),{},{content:u}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,stack:n=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,h=It({},t);if(h.id==null&&(h.id=wt()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};L(e);var v=n??(a?x.addStack(e):x.getStackForRoot(e,c));L(v);var p=x.getContentItemInStack(v,c);if(s!=null){var f=b=>{Ft.debug("Component created, focusing element",s),v.off("componentCreated",f);var{element:w}=b.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",f)}if(i&&p){var g=v.contentItems.indexOf(p);v.addChild(h,g+1),v.removeChild(p),v.setActiveContentItem(v.contentItems[g])}else v.addChild(h);s==null&&u&&hr(u)&&u.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=x.getContentItemInStack(e,o);if(n&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&hr(i)&&i.focus()}static closeComponent(e,t,n){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){Ft.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(Je(o)?o.container.close(n):i.removeChild(o)),a&&document.contains(a)&&hr(a)&&a.focus()}static renameComponent(e,t,n){var i=x.getStackForRoot(e,t,!1);if(!i){Ft.error("Could not find stack for config",t);return}var o=x.getContentItemInStack(i,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=x.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),null;var{props:i={}}=t,o=x.getPanelComponentState(t),a={type:"react-component",component:t.component,props:It(It({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:wt()};return x.openComponentInStack(n,a),a}static getPanelComponentState(e){if(Nl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Wt(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:fa.tabHeight,borderWidth:fa.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=x.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return x.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=x.getComponentConfigFromContainer(t);if(n&&Wt(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]:x.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(hr(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)})}}Ml(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var wf=R.forwardRef((r,e)=>{var t=x.getComponentNameFromPanel({props:r});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});wf.displayName="PanelPlaceholder";var ie=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"}),{listen:zy,emit:Ef,useListener:Gy}=Zt(ie.OPEN),$r=Object.freeze({CYCLE_TO_NEXT_STACK:"NavigationEvent.CYCLE_TO_NEXT_STACK",CYCLE_TO_PREVIOUS_STACK:"NavigationEvent.CYCLE_TO_PREVIOUS_STACK",CYCLE_TO_NEXT_TAB:"NavigationEvent.CYCLE_TO_NEXT_TAB",CYCLE_TO_PREVIOUS_TAB:"NavigationEvent.CYCLE_TO_PREVIOUS_TAB"}),{listen:Pf,emit:qy,useListener:Xy}=Zt($r.CYCLE_TO_NEXT_STACK),{listen:Tf,emit:Zy,useListener:Yy}=Zt($r.CYCLE_TO_PREVIOUS_STACK),{listen:_f,emit:Qy,useListener:Jy}=Zt($r.CYCLE_TO_NEXT_TAB),{listen:Of,emit:eC,useListener:tC}=Zt($r.CYCLE_TO_PREVIOUS_TAB);function xf(r){return typeof r.id=="string"&&r.layout instanceof Fr&&r.panelManager instanceof Li&&typeof r.registerComponent=="function"}function If(r){if(!xf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function ya(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ca(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ya(Object(t),!0).forEach(function(n){Mt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ya(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e,t){return(e=Df(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Df(r){var e=kf(r,"string");return typeof e=="symbol"?e:e+""}function kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ut=U.module("PanelManager"),nn=function(r){return r[r.Next=0]="Next",r[r.Previous=1]="Previous",r}(nn||{});class Li{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Mt(this,"layout",void 0),Mt(this,"hydrateComponent",void 0),Mt(this,"dehydrateComponent",void 0),Mt(this,"onPanelsUpdated",void 0),Mt(this,"closed",void 0),Mt(this,"openedMap",void 0),Mt(this,"navigationEventListenerRemovers",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.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.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=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ie.FOCUS,this.handleFocus),e.on(ie.MOUNT,this.handleMount),e.on(ie.UNMOUNT,this.handleUnmount),e.on(ie.REOPEN,this.handleReopen),e.on(ie.REOPEN_LAST,this.handleReopenLast),e.on(ie.DELETE,this.handleDeleted),e.on(ie.CLOSED,this.handleClosed),e.on(ie.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(Pf(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Tf(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(_f(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Of(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(ie.FOCUS,this.handleFocus),e.off(ie.MOUNT,this.handleMount),e.off(ie.UNMOUNT,this.handleUnmount),e.off(ie.REOPEN,this.handleReopen),e.off(ie.REOPEN_LAST,this.handleReopenLast),e.off(ie.DELETE,this.handleDeleted),e.off(ie.CLOSED,this.handleClosed),e.off(ie.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}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 x.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Wt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=x.getStackForConfig(this.layout.root,{id:e});return(t=n&&x.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=>wr(n)&&t instanceof n.WrappedComponent||!wr(n)&&t instanceof n))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){ut.error("updatePanel Panel did not have an ID",e);return}ut.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=x.getIdFromPanel(e);if(t==null){ut.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ut.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ut.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ut.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){ut.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ut.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ut.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=x.getAllStackContainers(this.layout);if(!(t.length<=1)){var n=x.getFocusedStackIndex(t);if(n===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===nn.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,h=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(h,!0)}}handleCycleToNextStack(){this.cycleStack(nn.Next)}handleCycleToPreviousStack(){this.cycleStack(nn.Previous)}cycleTab(e){var t,n=x.getFocusedStack(this.layout);if(n!==void 0){var{contentItems:i}=n;if(!(i.length<=1)){var o=(t=n.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===nn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(nn.Next)}handleCycleToPreviousTab(){this.cycleTab(nn.Previous)}handleReopen(e,t){ut.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var o=Ca(Ca({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:x.getStackById(a,e.parentStackId);x.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var n=(t=x.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===n){this.handleReopen(o);return}}}}handleDeleted(e){ut.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ut.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;x.closeComponent(n,t)}addClosedPanel(e){var t=x.getComponentConfigFromContainer(e);if(t&&Wt(t)){var n=this.dehydrateComponent(t.component,t);if(n!=null){var i;n.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(n)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Mt(Li,"MAX_CLOSED_PANEL_COUNT",100);var Mf=U.module("PanelErrorBoundary");class Nf extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=x.getIdFromContainer(e);Mf.debug("componentWillUnmount",n),t.emit(ie.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(hn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Sa(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 Ir(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(t),!0).forEach(function(n){jf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function jf(r,e,t){return(e=Af(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Af(r){var e=Lf(r,"string");return typeof e=="symbol"?e:e+""}function Lf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function jl(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return n!=null&&(o.metadata=n),i!=null&&(o.panelState=i),Ir(Ir({},r),{},{componentState:null,props:o,type:"react-component"})}function Al(r,e){return Ir(Ir({},r),{},{localDashboardId:e})}const Rf={dehydrate:jl,hydrate:Al};var Ll=R.createContext(void 0);Ll.displayName="LayoutManagerContext";var Ff=be.shape({on:be.func,off:be.func,isHidden:be.bool,tab:be.shape({header:be.shape({tabs:be.arrayOf(be.shape({contentItem:be.shape({})}))})}),title:be.string,setTitle:be.func,close:be.func}),Rl=be.shape({on:be.func,off:be.func,emit:be.func}),$f=be.shape({registerComponent:be.func,root:be.shape({addChild:be.func}),on:be.func,off:be.func,eventHub:Rl}),nC=Object.freeze({Container:Ff,EventHub:Rl,Layout:$f});function Ln(r,e,t,n){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");R.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Ae(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var Fl="SET_DASHBOARD_DATA";const Hf=Dc(Fl,{},!1),Bf={dashboardData:Hf};var Uf=new Map,$l=Object.freeze({}),Wf=Object.freeze([]),rC=Ei,Vf=Ja,iC=hu,Kf=r=>r.dashboardData,Fe=(r,e)=>{var t;return(t=Kf(r)[e])!==null&&t!==void 0?t:$l},oC=(r,e)=>{var t;return(t=Fe(r,e).closed)!==null&&t!==void 0?t:Wf},aC=(r,e)=>{var t;return(t=Fe(r,e).openedMap)!==null&&t!==void 0?t:Uf},Hl=(r,e)=>{var t;return(t=Fe(r,e).pluginDataMap)!==null&&t!==void 0?t:$l},sC=(r,e,t)=>Hl(r,e)[t];function wa(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 wn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(n){zf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function zf(r,e,t){return(e=Gf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gf(r){var e=qf(r,"string");return typeof e=="symbol"?e:e+""}function qf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Bl=(r,e)=>({type:Fl,id:r,payload:e}),Yt=(r,e)=>(t,n)=>t(Bl(r,wn(wn({},Fe(n(),r)),e))),lC=(r,e,t)=>(n,i)=>n(Bl(r,wn(wn({},Fe(i(),r)),{},{pluginDataMap:wn(wn({},Hl(i(),r)),{},{[e]:t})})));Object.entries(Bf).map(r=>{var[e,t]=r;return Xu.register(e,t)});function Xf(r){var{children:e}=r;return d.jsx(d.Fragment,{children:e})}var Ri=m.createContext(null);Ri.displayName="PanelIdContext";function Zf(){return m.useContext(Ri)}function Ea(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 Rn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(n){Yf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Yf(r,e,t){return(e=Qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qf(r){var e=Jf(r,"string");return typeof e=="symbol"?e:e+""}function Jf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var cr=U.module("DashboardLayout"),eg=Object.freeze({}),tg=[],Pa=()=>{},ng=1e3,Ta=r=>r;function uC(r){var e,t,{id:n,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=tg,onLayoutChange:l=Pa,onLayoutInitialized:u=Pa,hydrate:h=Al,dehydrate:c=jl,panelWrapper:v=Xf}=r,p=Ei(),f=(e=Ja(y=>Fe(y,n)))!==null&&e!==void 0?e:eg,[g,b]=m.useState(!1),[w,T]=m.useState(!1),[P,F]=m.useState(),[G]=m.useState((t=f==null?void 0:f.closed)!==null&&t!==void 0?t:[]),[ee,Y]=m.useState(a.getReactChildren()),N=m.useMemo(()=>new Map,[]),$=m.useMemo(()=>new Map,[]),ne=m.useCallback(function(y,S){var _,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;cr.debug2("registerComponent",y,S,K,re);function ot(X,ae){var ce=S,$e=v,_t=Ls(ce),{glContainer:yt,glEventHub:Kr}=X,Nn=x.getIdFromContainer(yt);return d.jsx(Nf,{glContainer:yt,glEventHub:Kr,children:d.jsx(Ri.Provider,{value:Nn,children:d.jsx($e,Rn(Rn({},X),{},{children:_t?d.jsx(ce,Rn(Rn({},X),{},{ref:ae})):d.jsx(ce,Rn({},X))}))})})}ot.displayName="DashboardWrapper(".concat((_=S.displayName)!==null&&_!==void 0?_:y,")");var I=a.registerComponent(y,R.forwardRef(ot));return N.set(y,K),$.set(y,re),I},[h,c,N,$,a,v]),q=m.useCallback((y,S)=>{var _;return((_=N.get(y))!==null&&_!==void 0?_:Ta)(S,n)},[N,n]),j=m.useCallback((y,S)=>{var _;return((_=$.get(y))!==null&&_!==void 0?_:Ta)(S,n)},[$,n]),z=m.useMemo(()=>new Li(a,q,j,new Map,G,y=>{var{closed:S,openedMap:_}=y;p(Yt(n,{closed:S,openedMap:_}))}),[j,p,q,n,G,a]),W=Xd(y=>{var S=P==null||!x.isEqual(P,y);cr.debug("handleLayoutStateChanged",S,y),S&&(b(a.root.contentItems.length===0),F(y),l(y),Y(a.getReactChildren()))},ng,{flushOnUnmount:!0});m.useEffect(()=>()=>W.flush(),[W]);var A=m.useCallback(()=>{if(!w){var y=a.toConfig(),S=y.content,_=x.dehydrateLayoutConfig(S,j);W(_)}},[j,w,a,W]),B=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DRAGGING,S),T(!0)},[a.eventHub]),V=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DROPPED,S),T(!1)},[a.eventHub]),pe=m.useCallback(y=>{if(cr.debug2("handleComponentCreated",y),!(y==null||y.config==null||!Wt(y.config)||y.config.component==null||y.element==null)){var S=y.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),_="".concat(S,"-component");y.element.addClass(_)}},[]),Ge=m.useCallback(()=>{Y(a.getReactChildren())},[a]);Ae(a,"stateChanged",A),Ae(a,"itemPickedUp",B),Ae(a,"itemDropped",V),Ae(a,"componentCreated",pe),Ae(a.eventHub,ie.TITLE_CHANGED,A),Ae(a,"reactChildrenChanged",Ge);var Ne=qd(s);return m.useEffect(function(){if(Ne!==s&&s!==P){cr.debug("Setting new layout content...");for(var S=x.hydrateLayoutConfig(s,q);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var _=0;_<S.length;_+=1)a.root.addChild(S[_]);b(a.root.contentItems.length===0)}},[q,a,s,P,z,Ne]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,ee,R.Children.map(i,y=>y!=null?d.jsx(Kh,{fallback:[],children:R.cloneElement(y,{id:n,layout:a,panelManager:z,registerComponent:ne})}):null)]})}var Ul=m.createContext(null);Ul.displayName="DashboardIdContext";function dC(){var r=m.useContext(Ul);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function rg(r,e,t){return(e=ig(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ig(r){var e=og(r,"string");return typeof e=="symbol"?e:e+""}function og(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Wl(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=Wl(n,e,t);if(i)return i;n=n.sibling}}}function ag(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}var Fi=ag(m.createContext(null));Fi.displayName="FiberContext";class hC extends m.Component{constructor(){super(...arguments),rg(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Fi.Provider,{value:this._reactInternals,children:e})}}function sg(){var r=m.useContext(Fi);if(r===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>wt()),t=m.useMemo(()=>{for(var n of[r,r==null?void 0:r.alternate].filter(o=>o!=null)){var i=Wl(n,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e]);return t}var cC="default",lg="CREATE_DASHBOARD",ug="CLOSE_DASHBOARD",{listen:mC,emit:vC,useListener:pC}=Zt(lg),{listen:fC,emit:dg,useListener:gC}=Zt(ug);function hg(r,e,t){return(e=cg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cg(r){var e=mg(r,"string");return typeof e=="symbol"?e:e+""}function mg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vl extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,{glContainer:n}=this.props;return[...(e=n==null||(t=n.tab)===null||t===void 0||(t=t.header)===null||t===void 0?void 0:t.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,o,a,s;if(((i=t[n].contentItem)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.id)===((o=e.tab)===null||o===void 0||(o=o.contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id))break;(a=((s=t[n])===null||s===void 0?void 0:s.contentItem).container)===null||a===void 0||a.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(ie.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var o,a,s;if(((o=t[i].contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(a=a.contentItem)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.id))break;var l=!!(!((s=t[i])===null||s===void 0||(s=s.contentItem)===null||s===void 0||(s=s.config)===null||s===void 0)&&s.isClosable);if(l){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,o=!!(!((i=e[n])===null||i===void 0||(i=i.contentItem)===null||i===void 0||(i=i.config)===null||i===void 0)&&i.isClosable);if(o){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:n,glContainer:i}=this.props,o=(e=x.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=n.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:n}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:te.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var o=(e=n.tab)===null||e===void 0||(e=e.contentItem)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.isClosable;return i.push({title:"Close",order:10,group:te.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:te.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:te.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(te,{actions:i})}}hg(Vl,"defaultProps",{additionalActions:[]});var vg=r=>({workspace:Xs(r)}),pg=In(vg,{setWorkspace:Ys})(Vl);function Kl(r,e,t){return(e=fg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fg(r){var e=gg(r,"string");return typeof e=="symbol"?e:e+""}function gg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zl extends m.PureComponent{constructor(e){super(e),Kl(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=R.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;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.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:o}=this.state;return d.jsxs("form",{className:Z("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[d.jsxs("div",{className:"form-group",children:[d.jsxs("label",{htmlFor:"rename-dialog-".concat(n,"-input"),children:["Rename ",n]}),d.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}),d.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(oe,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(oe,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Nr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Kl(zl,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var mr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function _a(r,e,t){return(e=bg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bg(r){var e=yg(r,"string");return typeof e=="symbol"?e:e+""}function yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Cg=U.module("Panel");class Sg extends m.PureComponent{constructor(e){super(e),_a(this,"ref",void 0),_a(this,"getAdditionalActions",Gt((n,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...n]})),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.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=R.createRef();var{glContainer:t}=this.props;this.state={title:x.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,{componentPanel:t,glContainer:n,glEventHub:i}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),i.on(mr.focus,this.handleTabFocus),i.on(mr.blur,this.handleTabBlur),i.emit(ie.MOUNT,t??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(e=e.parentElement)===null||e===void 0?void 0:e.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(mr.focus,this.handleTabFocus),n.off(mr.blur,this.handleTabBlur),n.emit(ie.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:x.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(ie.FOCUS,t??this);var{onFocus:i}=this.props;i==null||i(e)}handleBlur(e){var{onBlur:t}=this.props;t==null||t(e)}handleHide(){for(var{onHide:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleResize(){for(var{onResize:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}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=x.getRootFromContainer(t),i=x.getComponentConfigFromContainer(t);L(i),x.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=x.getRootFromContainer(e),i=x.getComponentConfigFromContainer(e);if(i==null){Cg.error("Could not get component config from container",e);return}var o=x.cloneComponent(n,i);o!==null&&t.emit(ie.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:te.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:te.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,glEventHub:o,additionalActions:a=ys,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:v}=i,{showRenameDialog:p,title:f,isWithinPanel:g}=this.state;return d.jsxs("div",{className:Z("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(hn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Mr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(pg,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,h,c)}),c&&d.jsx(zl,{isShown:p,value:f,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var wg=Us(Sg),Eg=U.module("useDhId"),ti="__dhId";function bC(){var r,e,t=(r=(e=sg())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[ti],i=Zf();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(ti," to be a string, but got ").concat(typeof n));return n}return i??(Eg.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ti," prop. Defaulting to null.")),null)}function nr(r,e,t){return(e=Pg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pg(r){var e=Tg(r,"string");return typeof e=="symbol"?e:e+""}function Tg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Me{}nr(Me,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");nr(Me,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");nr(Me,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");nr(Me,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");nr(Me,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function Qt(r,e,t){return(e=_g(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _g(r){var e=Og(r,"string");return typeof e=="symbol"?e:e+""}function Og(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Pt{}Qt(Pt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Qt(Pt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Qt(Pt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Qt(Pt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Qt(Pt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Qt(Pt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Qt(Pt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Qt(Pt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const yC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function At(r,e,t){return(e=xg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xg(r){var e=Ig(r,"string");return typeof e=="symbol"?e:e+""}function Ig(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class J{}At(J,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");At(J,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");At(J,"CLOSE_FILE","NotebookEvent.closeFile");At(J,"RENAME","NotebookEvent.rename");At(J,"RENAME_FILE","NotebookEvent.renameFile");At(J,"REGISTER_FILE","NotebookEvent.registerFile");At(J,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");At(J,"UNREGISTER_FILE","NotebookEvent.unregisterFile");At(J,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Dg=["children"];function Oa(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 xa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(n){kg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kg(r,e,t){return(e=Mg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mg(r){var e=Ng(r,"string");return typeof e=="symbol"?e:e+""}function Ng(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function jg(r,e){if(r==null)return{};var t,n,i=Ag(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function Ag(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}class Lg extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(Me.SESSION_CLOSED,this.handleSessionClosed),e.on(Me.SESSION_OPENED,this.handleSessionOpened),e.on(Pt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.SESSION_CLOSED,this.handleSessionClosed),e.off(Me.SESSION_OPENED,this.handleSessionOpened),e.off(Pt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var{onClearAllFilters:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n==null||n(e,t)}render(){var e=this.props,{children:t}=e,n=jg(e,Dg);return d.jsx(wg,xa(xa({},n),{},{children:t}))}}var rr=Us(Lg);const CC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Rg=Object.freeze({}),Fg=new Map,Hr=Object.freeze([]),SC=(r,e)=>{var t;return(t=Fe(r,e).columns)!==null&&t!==void 0?t:Hr},wC=(r,e)=>{var t;return(t=Fe(r,e).filterSets)!==null&&t!==void 0?t:Hr},EC=(r,e)=>{var t;return(t=Fe(r,e).filters)!==null&&t!==void 0?t:Hr},PC=(r,e)=>{var t;return(t=Fe(r,e).tableMap)!==null&&t!==void 0?t:Fg},TC=(r,e)=>Fe(r,e).isolatedLinkerPanelId,Gl=(r,e)=>{var t;return(t=Fe(r,e).links)!==null&&t!==void 0?t:Hr},_C=(r,e)=>Fe(r,e).columnSelectionValidator,OC=(r,e)=>{var t;return(t=Fe(r,e).consoleSettings)!==null&&t!==void 0?t:Rg},xC=(r,e)=>Fe(r,e).connection,ir=(r,e)=>Fe(r,e).sessionWrapper,IC=(r,e)=>t=>t(Yt(r,{connection:e})),DC=(r,e)=>t=>t(Yt(r,{sessionWrapper:e})),ql=(r,e)=>t=>t(Yt(r,{links:e})),kC=(r,e)=>(t,n)=>{var i=Gl(n(),r),o=e.filter(a=>i.findIndex(s=>Kn(s.start,a.start)&&Kn(s.end,a.end))<0);return t(ql(r,i.concat(o)))},MC=(r,e)=>(t,n)=>{var i=Gl(n(),r),o=i.filter(a=>!e.includes(a.id));return t(ql(r,o))},NC=(r,e)=>t=>t(Yt(r,{isolatedLinkerPanelId:e})),jC=(r,e)=>t=>t(Yt(r,{columnSelectionValidator:e})),$g=(r,e)=>t=>t(Yt(r,{consoleSettings:e})),AC=(r,e)=>t=>t(Yt(r,{filterSets:e}));function Dr(r,e,t){return(e=Hg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hg(r){var e=Bg(r,"string");return typeof e=="symbol"?e:e+""}function Bg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var vr=U.module("CommandHistoryPanel");class or extends m.Component{static handleError(e){vr.error(e)}constructor(e){super(e),Dr(this,"container",void 0),Dr(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=R.createRef(),this.pending=new Zn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:We.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Me.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.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(vr.debug("handleSendToNotebook",n,e),!n){vr.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?J.CREATE_NOTEBOOK:J.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;vr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Me.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;L(t),L(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(or.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(rr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&d.jsxs(d.Fragment,{children:[d.jsx(Ue,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:n}),d.jsx(te,{actions:o})]})]})}}Dr(or,"COMPONENT","CommandHistoryPanel");Dr(or,"TITLE","Command History");var Ug=(r,e)=>{var t=Gs(r),n=ir(r,e.localDashboardId),{session:i,config:o}=n??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Wg=In(Ug,null,null,{forwardRef:!0})(or),Xl=m.createContext(null);Xl.displayName="PluginsContext";var Mn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function Vg(r){return"DashboardPlugin"in r}function Kg(r){return"AuthPlugin"in r}function zg(r){return"TablePlugin"in r}function LC(r){return Vg(r)||Kg(r)||zg(r)}function Gg(r){return"type"in r&&r.type===Mn.DASHBOARD_PLUGIN}function $i(r){return"type"in r&&r.type===Mn.WIDGET_PLUGIN}function qg(r){return"type"in r&&r.type===Mn.TABLE_PLUGIN}function Xg(r){return"type"in r&&r.type===Mn.AUTH_PLUGIN}function Zl(r){return"type"in r&&r.type===Mn.THEME_PLUGIN}function Yl(r){return"type"in r&&r.type===Mn.ELEMENT_PLUGIN}function RC(r){return Gg(r)||Xg(r)||qg(r)||Zl(r)||$i(r)||Yl(r)}var Ql=U.module("@deephaven/plugin.PluginUtils");function Ia(r,e){return r==null||!$i(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function Zg(r){var e=d.jsx(ve,{icon:ls});if(!$i(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function FC(r){var e=[...r.entries()].filter(t=>Zl(t[1]));return Ql.debug("Getting theme data from plugins",e),e.map(t=>{var[n,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:u}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Zu(n,s),name:s,styleContent:u}})}).flat()}function $C(r){var e=[...r.entries()].filter(t=>Yl(t[1])&&t[1].mapping!=null);return Ql.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function HC(){return Yn(Xl,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Jl=m.createContext(null);Jl.displayName="PersistentStateContext";function BC(r){var{initialState:e,onChange:t,children:n}=r,[i,o]=R.useState(0),a=m.useRef({initial:e,initialStateMap:new Map,state:new Map,isTracking:!0}),s=m.useCallback((v,p)=>{a.current.isTracking&&a.current.state.set(v,p)},[]),l=m.useCallback(()=>{a.current.isTracking||(a.current.isTracking=!0,a.current.state=new Map,o(v=>v+1))},[]),u=m.useRef(a.current.initial[Symbol.iterator]()),h=m.useCallback(function(p){var f=a.current.initialStateMap.get(p);if(f)return f;var{value:g,done:b}=u.current.next(),w={value:g,done:b??!1};return a.current.initialStateMap.set(p,w),w},[]);m.useEffect(function(){a.current.isTracking&&(t([...a.current.state.values()]),a.current.isTracking=!1)},[i,t]);var c=m.useMemo(()=>({addState:s,scheduleStateUpdate:l,getInitialState:h,updateId:i}),[s,h,l,i]);return d.jsx(Jl.Provider,{value:c,children:n})}function Da(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 pr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Da(Object(t),!0).forEach(function(n){ln(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Da(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ln(r,e,t){return(e=Yg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yg(r){var e=Qg(r,"string");return typeof e=="symbol"?e:e+""}function Qg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fr=U.module("ConsolePanel"),Jg=500,eb=Object.freeze({consoleSettings:{},itemIds:[]});class Br extends m.PureComponent{constructor(e){super(e),ln(this,"consoleRef",void 0),ln(this,"objectSubscriptionCleanup",void 0),ln(this,"savePanelState",dn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};fr.debug("Saving panel state",l),this.setState({panelState:l})},Jg)),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=R.createRef();var{panelState:t}=e,n=pr(pr({},eb),t||{}),{consoleSettings:i,itemIds:o}=n;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(ie.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(ie.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=>{fr.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,u=[...a,...l],h=new Map(o);u.forEach(v=>{var{title:p}=v;p!==void 0&&h.delete(p)});var c=[...a,...s];return c.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,o=new Map(i);return o.set(e,t),{itemIds:o}})}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=wt(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,{itemIds:i}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(n=e.props)===null||n===void 0||(n=n.metadata)===null||n===void 0?void 0:n.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Me.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;L(this.context);var{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.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(ie.CLOSE,n),dg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;fr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Me.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;L(n);var{config:i,session:o}=n,{title:a=e.name}=e;L(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:pr(pr({},hc(e)),{},{sessionId:i.id})};fr.debug("openWidget",l),Ef(t,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 o=[...n.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(ie.CLOSE,s)}),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=>Ia(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Ia(i,e));return n!=null?Zg(n):d.jsx(Qs,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(hn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:h,session:c,connection:v,details:p={},dh:f}=i,{workerName:g,processInfoId:b}=p,{id:w,type:T}=h;return d.jsx(rr,{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&&d.jsx(zt,{dh:f,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:T,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:el.LANGUAGE_MAP.get(T)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),b,d.jsx("div",{children:"•"})]}),d.jsx(vp,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:w,timeZone:o,objectMap:u,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}ln(Br,"COMPONENT","ConsolePanel");ln(Br,"TITLE","Console");ln(Br,"contextType",Ll);var tb=(r,e)=>({commandHistoryStorage:Gs(r),sessionWrapper:ir(r,e.localDashboardId),timeZone:bc(r),plugins:yc(r)}),ni=In(tb,null,null,{forwardRef:!0})(Br);function UC(r){return r==="file"||r==="directory"}function ft(r){return r.type==="directory"}function nb(r,e,t){return(e=rb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rb(r){var e=ib(r,"string");return typeof e=="symbol"?e:e+""}function ib(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hi extends Error{constructor(){super("No file exists at the path specified"),nb(this,"isFileNotFound",!0)}}function ka(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Ma(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ka(o,n,i,a,s,"next",l)}function s(l){ka(o,n,i,a,s,"throw",l)}a(void 0)})}}var rn=function(r){return 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="",r}({});class M{static fileExists(e,t){return Ma(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Hi))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(!M.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 o=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getUniqueCopyFileName(e,t){return Ma(function*(){for(var n=M.getCopyFileName(t);yield M.fileExists(e,n);)n=M.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return rn.GROOVY;case"py":return rn.PYTHON;case"pyc":return rn.PYTHON_COMPILED;case"scala":return rn.SCALA;case"txt":return rn.PLAIN_TEXT;default:return rn.UNKNOWN}}static getParent(e){if(!M.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(!M.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,o=M.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Un("Name cannot be empty");if(t.includes(e))throw new Un('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,a;throw new Un('Invalid characters in name: "'.concat((o=(a=e.match(n))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(n=>M.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)}}var Bi=26;function Si(r){return ft(r)?M.makePath(r.filename):M.getPath(r.filename)}function Na(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=Si(e);if(r.some(n=>{var{filename:i}=n;return M.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>ft(n)&&t.startsWith(M.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function ob(r){if(ft(r))return r.isExpanded?Yu:Qu;var e=M.getMimeType(r.basename);switch(e){case rn.PYTHON:return ed;default:return Ju}}function wi(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:h,onDragOver:c,onDragEnd:v,onDragExit:p,onDrop:f}=r,g=(e=n==null?void 0:n.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,b=Si(s),w=i&&u?Si(u):null,T=i&&o&&ft(s)&&w===b,P=i&&o&&w===b,F=i&&!o&&w===b,G=ob(s),ee=M.getDepth(s.filename),Y=Array(ee).fill(null).map((N,$)=>d.jsx("span",{className:"file-list-depth-line"},$));return d.jsxs("div",{className:Z("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":T,"is-in-drop-target":P,"is-invalid-drop-target":F,"is-selected":a}),onDragStart:N=>h(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>v(l,N),onDragExit:p,onDrop:N=>f(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:G,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function ja(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 gr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(n){ab(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ab(r,e,t){return(e=sb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sb(r){var e=lb(r,"string");return typeof e=="symbol"?e:e+""}function lb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var He=U.module("FileList"),ub=500,Aa="item-list-scroll-pane";function db(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=wi,rowHeight:l=Bi,overscanCount:u=gt.DEFAULT_OVERSCAN}=r,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,p]=m.useState({top:0,bottom:0}),[f,g]=m.useState(),[b,w]=m.useState(),[T,P]=m.useState(),[F,G]=m.useState([]),ee=m.useRef(),Y=m.useRef(null),N=m.useRef(null),$=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var X=[],ae=0;ae<I.length;ae+=1)for(var ce=I[ae],$e=ce[0];$e<=ce[1];$e+=1)$e>=h.offset&&$e<h.offset+h.items.length&&X.push(h.items[$e-h.offset]);return X},[h]),ne=m.useCallback(I=>{var X=$([[I,I]]);if(X.length>0)return X[0]},[$]),q=m.useCallback(()=>{var I=mt.count(F);if(I===0)return null;if(I===1){var X=F[0][0],ae=ne(X);if(ae!=null)return ae.filename}return"".concat(I," items")},[ne,F]),j=m.useCallback(I=>{if(!(!b||!f)){He.debug("dropItems",b,"to",I);try{var{files:X,targetPath:ae}=Na(b,f);if(i==null||i(X,ae),I!=null){var ce;G([[I,I]]),(ce=Y.current)===null||ce===void 0||ce.focusItem(I)}}catch($e){He.error("Unable to complete move",$e)}}},[b,f,i]),z=m.useCallback((I,X)=>{var ae=h.items[I-h.offset];ae!==void 0&&(He.debug("handleItemClick",ae),o(ae,X),ft(ae)&&(t==null||t.setExpanded(ae.filename,!ae.isExpanded)))},[h,o,t]),W=m.useCallback((I,X)=>{var ae,ce;He.debug2("handleItemDragStart",I,F);var $e=F;mt.isSelected(F,I)||($e=[[I,I]],G($e)),w($($e)),(ae=Y.current)===null||ae===void 0||ae.resetMouseState();var _t=document.createElement("div"),yt=document.createElement("div");yt.className="dnd-placeholder-content",yt.innerText=(ce=q())!==null&&ce!==void 0?ce:"",_t.appendChild(yt),_t.className="file-list-dnd-placeholder",document.body.appendChild(_t),X.dataTransfer.setDragImage(_t,0,0),X.dataTransfer.effectAllowed="move",P(_t)},[q,$,F]),A=m.useCallback((I,X)=>{X.preventDefault(),He.debug2("handleItemDragOver",X),g(ne(I))},[ne]),B=m.useCallback((I,X)=>{He.debug("handleItemDragEnd",I),T==null||T.remove(),w(void 0),g(void 0),P(void 0)},[T]),V=m.useCallback((I,X)=>{j(I)},[j]),pe=m.useCallback(()=>{He.debug2("handleItemDragExit"),g(void 0)},[]),Ge=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Aa)&&(I.preventDefault(),He.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Ne=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Aa)&&(He.debug("handleListDrop"),j())},[j]),y=m.useCallback(function(I){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(He.debug2("handleSelectionChange",I),X===!0||I!==F){G(I);var ae=$(I);a(ae)}},[$,a,F]),S=m.useCallback(I=>{if(He.debug2("handleFocusChange",I),I!=null){var[X]=$([[I,I]]);n(X)}else n();ee.current=I},[$,n]),_=m.useCallback((I,X)=>{He.debug("handleViewportChange",I,X),(I!==v.top||X!==v.bottom)&&p({top:I,bottom:X})},[v]),K=m.useMemo(()=>{if(!b||!f)return!1;try{return Na(b,f),He.debug("handleValidateDropTarget true"),!0}catch{return He.debug("handleValidateDropTarget false"),!1}},[b,f]),{focusedPath:re}=r;m.useEffect(()=>{re!==void 0&&(re==="/"?t.collapseAll():(t.setExpanded(re,!1),t.setExpanded(re,!0)))},[t,re]),m.useEffect(function(){He.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-u),bottom:v.bottom+u})},[u,t,v]),m.useEffect(function(){var X=t.onUpdate(ae=>{c({items:ae.items.map(ce=>gr(gr({},ce),{},{itemName:ce.basename})),offset:ae.offset,itemCount:t.size})});return()=>{X()}},[t]),m.useEffect(function(){ee.current!=null&&S(ee.current),F.length>0&&y(F,!0)},[h,S,y,F]),m.useEffect(function(){if(f!=null&&ft(f)&&f.filename!=="/"){var X=setTimeout(()=>{f.isExpanded||t==null||t.setExpanded(f.filename,!0)},ub);return()=>clearTimeout(X)}},[f,t]);var ot=m.useCallback(I=>s(gr(gr({},I),{},{isDragInProgress:b!=null,dropTargetItem:f,draggedItems:b,isDropTargetValid:K,onDragStart:W,onDragEnd:B,onDragOver:A,onDragExit:pe,onDrop:V})),[B,pe,A,W,V,b,f,K,s]);return d.jsx("div",{ref:N,className:Z("file-list",{"is-dragging":b!=null}),onDragOver:Ge,onDrop:Ne,children:d.jsx(gt,{ref:Y,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:S,onSelect:z,onSelectionChange:y,onViewportChange:_,selectedRanges:F,renderItem:ot,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var hb={DELETE:de.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[O.DELETE],macShortcut:[D.CMD,O.BACKSPACE]}),RENAME:de.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[O.ENTER],macShortcut:[O.ENTER]})};const La={FILE_EXPLORER:hb};var Ra=U.module("FileListItemEditor"),cb=()=>Promise.resolve();function mb(r){var{item:e,onCancel:t,onSubmit:n,validate:i=cb}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[h,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var T;(T=o.current)===null||T===void 0||T.focus()},[o]),p=m.useCallback(T=>T.stopPropagation(),[]),f=m.useCallback(()=>{h.then(()=>{n(a)}).catch(T=>Ra.info("Unable to validate name",T))},[n,a,h]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>u(void 0)).catch(F=>{Te.isCanceled(F)||u(F)}),c(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{Ra.debug2("handleBlur"),f()},[f]),b=m.useCallback(T=>{var{value:P}=T.target;s(P)},[]),w=m.useCallback(T=>{T.stopPropagation();var{key:P}=T;switch(P){case"Enter":{f();break}case"Escape":{t();break}}},[t,f]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:Z("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Fa(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 ri(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(n){vb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function vb(r,e,t){return(e=pb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pb(r){var e=fb(r,"string");return typeof e=="symbol"?e:e+""}function fb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function eu(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:h,onSelectionChange:c,table:v,rowHeight:p=Bi,validateRename:f=()=>Promise.resolve()}=r,[g,b]=m.useState(),[w,T]=m.useState([]),[P,F]=m.useState(),G=m.useCallback(V=>{T(V),c==null||c(V)},[c]),ee=m.useCallback(V=>{F(V)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),N=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),$=m.useCallback(()=>{i==null||i()},[i]),ne=m.useCallback(()=>{P&&(o==null||o(M.getPath(P.filename)))},[P,o]),q=m.useCallback(()=>{P&&b(P)},[P]),j=m.useCallback(()=>{b(void 0)},[]),z=m.useCallback(V=>{g&&(u==null||u(g,V),b(void 0))},[u,g]),W=m.useMemo(()=>{if(g)return[];var V=[];return i&&V.push({title:"New File",description:"Create new file",action:$,group:te.groups.medium}),o&&V.push({title:"New Folder",description:"Create new folder",action:ne,group:te.groups.medium}),a&&V.push({title:"Copy File",description:"Copy the selected file",action:Y,group:te.groups.low,disabled:P==null||ft(P)}),s&&w.length>0&&V.push({title:"Delete",description:"Delete",shortcut:La.FILE_EXPLORER.DELETE,action:N,group:te.groups.low}),u&&V.push({title:"Rename",description:"Rename",shortcut:La.FILE_EXPLORER.RENAME,action:q,group:te.groups.low,disabled:P==null}),V},[Y,N,$,ne,q,P,a,i,o,s,u,w,g]),A=m.useCallback(V=>(L(g),f(g,V)),[g,f]),B=m.useCallback(V=>{var{item:pe}=V;return g&&g.filename===pe.filename?d.jsx(wi,ri(ri({},V),{},{children:d.jsx(mb,{item:pe,validate:A,onSubmit:z,onCancel:j})})):d.jsx(wi,ri({},V))},[j,z,g,A]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(db,{onMove:l,onSelect:h,onSelectionChange:G,onFocusChange:ee,renderItem:B,rowHeight:p,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(te,{actions:W})]})}eu.displayName="FileListContainer";function $a(r,e,t){return(e=gb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gb(r){var e=bb(r,"string");return typeof e=="symbol"?e:e+""}function bb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Sr extends Un{constructor(e){super("Name already exists"),$a(this,"isExistingFile",!0),$a(this,"info",void 0),this.info=e}}function Ha(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.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 o=r.apply(e,t);function a(l){Ha(o,n,i,a,s,"next",l)}function s(l){Ha(o,n,i,a,s,"throw",l)}a(void 0)})}}var Ct=U.module("FileExplorer");function Ui(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:h,rowHeight:c=Bi}=r,[v,p]=m.useState([]),[f,g]=m.useState();m.useEffect(function(){var z;function W(){return A.apply(this,arguments)}function A(){return A=Ba(function*(){Ct.debug("initTable"),z=Te.makeCancelable(e.getTable(),B=>B.close());try{g(yield z)}catch(B){Te.isCanceled(B)||Ct.error("Unable to initialize table",B)}}),A.apply(this,arguments)}return W(),()=>{z.cancel()}},[e]);var b=m.useCallback(j=>{Te.isCanceled(j)||Ct.error(j)},[]),w=m.useCallback(()=>{Ct.debug("handleCreateFile"),s()},[s]),T=m.useCallback(()=>{Ct.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(j=>{Ct.debug("handleCopyFile",j.filename),i(j)},[i]),F=m.useCallback(j=>{Ct.debug("handleDelete, pending confirmation",j),p(j)},[]),G=m.useCallback(()=>{Ct.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(ft(j)?M.makePath(j.filename):j.filename)),o(v),p([])},[v,o,e]),ee=m.useCallback(()=>{Ct.debug("handleDeleteCancel"),p([])},[]),Y=m.useCallback((j,z)=>{var W=M.reducePaths(j.map(A=>ft(A)?M.makePath(A.filename):A.filename));W.forEach(A=>{var B=M.isPath(A)?"".concat(z).concat(M.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(z).concat(M.getBaseName(A));e.moveFile(A,B).then(()=>{a(A,B)}).catch(b)})},[b,a,e]),N=m.useCallback((j,z)=>{var W=j.filename,A=ft(j);A&&!W.endsWith("/")&&(W="".concat(W,"/"));var B="".concat(M.getParent(W)).concat(z);A&&!B.endsWith("/")&&(B="".concat(B,"/")),Ct.debug2("handleRename",W,B),e.moveFile(W,B).catch(b),a(W,B)},[b,a,e]),$=m.useCallback(function(){var j=Ba(function*(z,W){if(W!==z.basename){M.validateName(W);var A="".concat(M.getPath(z.filename)).concat(W);try{var B=yield e.info(A);throw new Sr(B)}catch(V){if(!(V instanceof Hi))throw V}}});return function(z,W){return j.apply(this,arguments)}}(),[e]),ne=v.length>0,q=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return d.jsxs("div",{className:"file-explorer",children:[f&&d.jsx(eu,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:T,onCreateFile:w,onMove:Y,onDelete:F,onRename:N,onSelect:u,onSelectionChange:h,rowHeight:c,table:f,validateRename:$}),d.jsx(zn,{isOpen:ne,headerText:q,bodyText:"You cannot undo this action.",onCancel:ee,onConfirm:G,confirmButtonText:"Delete"})]})}Ui.displayName="FileExplorer";function Ua(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function yb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ua(o,n,i,a,s,"next",l)}function s(l){Ua(o,n,i,a,s,"throw",l)}a(void 0)})}}function on(r,e,t){return(e=Cb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cb(r){var e=Sb(r,"string");return typeof e=="symbol"?e:e+""}function Sb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Jt=U.module("NewItemModal");class un extends m.PureComponent{static getValidationMessage(e){return e instanceof Sr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||Jt.error(e)}constructor(e){super(e),on(this,"inputRef",R.createRef()),on(this,"cancelableValidatePromise",void 0),on(this,"cancelableExistingItemPromise",void 0),on(this,"pending",new Zn),on(this,"pathMap",new Map),on(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=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.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=Te.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return yb(function*(){M.validateName(t);var{defaultValue:o,storage:a}=i.props;if(n){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Sr(l)}catch(u){if(!(u instanceof Hi))throw u}}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(Jt.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,n=M.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 Un))throw e;Jt.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;Jt.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){Jt.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=M.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Jt.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:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;Jt.debug("submitModal",n,i);var l=M.getExtension(i);return a&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(u=>{if(u instanceof Sr&&s!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw Te.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).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 o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(n,"/"),d.jsxs(R.Fragment,{children:[d.jsx(oe,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:td,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:h,validationError:c,value:v,prevExtension:p,newExtension:f}=this.state,g=a==="directory",b=M.fileExtensionToString(p),w=M.fileExtensionToString(f),T=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(rs,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(is,{toggle:n,children:o}),d.jsx(os,{children:d.jsx("form",{children:d.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[d.jsxs("div",{className:"flex-grow-0 mb-4",children:[d.jsx("label",{htmlFor:"file-name-input",children:P}),d.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Z("form-control",{"is-invalid":c}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:un.getValidationMessage(c)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(Ui,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(ks,{children:[d.jsx(oe,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(oe,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:T})]})]}),d.jsx(zn,{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"}),d.jsx(zn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}on(un,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function wb(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(oe,{kind:"ghost",icon:fs,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(oe,{kind:"ghost",icon:nd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx($s,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Wa(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Eb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Wa(o,n,i,a,s,"next",l)}function s(l){Wa(o,n,i,a,s,"throw",l)}a(void 0)})}}function tu(r,e,t){return(e=Pb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pb(r){var e=Tb(r,"string");return typeof e=="symbol"?e:e+""}function Tb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var en=U.module("FileExplorerPanel"),_b=(r,e)=>{var t=qs(r),n=ir(r,e.localDashboardId),{session:i,config:o}=n??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},Ob=In(_b,null,null,{forwardRef:!0});function xb(r){var e=r;return e!=null&&typeof e.button=="number"}class xn extends R.Component{static handleError(e){en.error(e)}static isFocusEvent(e){return xb(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:""};en.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){en.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){en.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(xn.handleError)}handleCopyFile(e){var t=this;return Eb(function*(){var{fileStorage:n}=t.props;if(ft(e)){en.error("Invalid item in handleCopyItem",e);return}var i=yield M.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(J.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(en.debug("fileSelect",e),e.type!=="directory"){var n=xn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(J.SELECT_NOTEBOOK,a,s,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;en.debug("handleRename",e,t),n.emit(J.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:o,focusedFilePath:a}=this.state;return d.jsxs(rr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(wb,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Ui,{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}),d.jsx(un,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}tu(xn,"COMPONENT","FileExplorerPanel");tu(xn,"TITLE","File Explorer");var Ib=Ob(xn);function Xn(r,e,t){return(e=Db(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Db(r){var e=kb(r,"string");return typeof e=="symbol"?e:e+""}function kb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Va=U.module("LogPanel");class Ur extends m.PureComponent{constructor(e){super(e),Xn(this,"isBottomVisible",void 0),Xn(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){Va.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Va.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return d.jsxs(rr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&d.jsx(Se,{session:n,ref:i=>{this.logView=i}})]})}}Xn(Ur,"defaultProps",{session:null});Xn(Ur,"COMPONENT","LogPanel");Xn(Ur,"TITLE","Log");var Mb=(r,e)=>{var t;return{session:(t=ir(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},Nb=In(Mb,null,null,{forwardRef:!0})(Ur);function Ka(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function br(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ka(o,n,i,a,s,"next",l)}function s(l){Ka(o,n,i,a,s,"throw",l)}a(void 0)})}}function za(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 Ye(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?za(Object(t),!0).forEach(function(n){Le(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):za(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Le(r,e,t){return(e=jb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jb(r){var e=Ab(r,"string");return typeof e=="symbol"?e:e+""}function Ab(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Lb=m.lazy(()=>bs(()=>import("./MarkdownNotebook-ootxm18m.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=U.module("NotebookPanel"),Ga=400;class Oe extends m.Component{static handleError(e){Te.isCanceled(e)||ue.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Oe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Oe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.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),Le(this,"pending",void 0),Le(this,"debouncedSavePanelState",void 0),Le(this,"debouncedLoad",void 0),Le(this,"notebook",void 0),Le(this,"tabTitleElement",void 0),Le(this,"tabInitOnce",void 0),Le(this,"editor",void 0),Le(this,"getSettings",Gt((v,p)=>Ye(Ye({},v),{},{minimap:{enabled:p}}))),Le(this,"getOverflowActions",Gt((v,p,f)=>{var g=[{title:"Find",icon:od,action:this.handleFind,group:te.groups.high,shortcut:We.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:as,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:ad,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:cs,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?En:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:We.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?En:void 0,action:this.handleWordWrapChange,group:te.groups.low,shortcut:We.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:te.groups.low,order:10}),g.push({title:"Format on Save",icon:f?En:void 0,action:this.handleFormatOnSaveChange,group:te.groups.low,order:15})),g})),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.handleFormatOnSaveChange=this.handleFormatOnSaveChange.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.handleFormat=this.handleFormat.bind(this),this.canFormat=this.canFormat.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Zn,this.debouncedSavePanelState=dn(this.savePanelState.bind(this),Ga),this.debouncedLoad=dn(this.load.bind(this),Ga),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var u=s!=null&&M.hasPath(s.itemName),h=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},ue.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(J.RENAME_FILE,this.handleRenameFile),t.on(ie.DROPPED,this.handlePanelDropped),e.on(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;n!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.notebookSettings.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(J.RENAME_FILE,this.handleRenameFile),e.off(ie.DROPPED,this.handlePanelDropped),t.off(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(J.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);L(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 o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){ue.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){ue.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(J.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:o}=i;n.emit(J.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(J.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;L(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(o=>{var a;ue.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:h}=u;this.renameTab(h,M.getBaseName(s))}var c=Ye(Ye({},t),{},{language:(a=Oe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.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){ue.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;ue.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:o,settings:a}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,u=Ye(Ye({},a),{},{value:s}),h=Ye(Ye({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return ue.debug("Saving panel state",c),{settings:u,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(J.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return br(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;L(o);var{language:s}=a,{itemName:l}=o,u=yield M.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var h={id:u,itemName:u},c={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return br(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:o}=e.state;ue.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(M.hasPath(o.itemName)&&(yield M.fileExists(t,o.itemName))?(i.emit(J.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){ue.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:n-1,savedChangeCount:i}:!a&&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{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={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:Ye(Ye({},t),{},{wordWrap:n})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};n(i)}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){ue.debug("Ignoring invalid notebook link",a);return}ue.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},u={id:a,itemName:a};s.emit(J.SELECT_NOTEBOOK,n,i,l,u)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Te.isCanceled(t)||(Te.isTimedOut(t)&&(t=new Error("File not found.")),ue.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return br(function*(){ue.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:n=!1}=t;n&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},o=(t=Oe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=Ye(Ye({},a.settings),{},{language:o});return ue.debug("handleSaveSuccess",i,s,l),s&&M.hasPath(s.itemName)&&s.itemName!==i.itemName&&(ue.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(Oe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Te.isCanceled(e)||(this.setState({savedChangeCount:0}),ue.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),ue.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(o)!==M.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?me.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return br(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield me.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(o)!==JSON.stringify(n)){a.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){ue.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){ue.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;ue.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){ue.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];ue.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){ue.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){ue.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 o=new URL(i,t);return new URL(e,o).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:o,sessionLanguage:a,settings:s}=this.state,l=Ye(Ye({},s),{},{language:t,value:n}),u={id:null,itemName:e};ue.debug("handleCreateNotebook",o,a,l,u),i.emit(J.CREATE_NOTEBOOK,o,a,l,u)}runCommand(e){if(e===void 0||e===""){ue.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Me.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{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:n}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",n??!1)}render(){var e,t,n,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:h,error:c,isDashboardActive:v,isLoaded:p,isLoading:f,isPreview:g,fileMetadata:b,session:w,sessionLanguage:T,settings:P,showCloseModal:F,showDeleteModal:G,showSaveAsModal:ee}=this.state,Y=v&&!o.isHidden&&!g,N=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:Oe.DEFAULT_NAME,$=N.endsWith(".md"),ne=(b==null?void 0:b.id)!=null,q=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),j=w!=null,z=T===q.language,W=!p||!j||!z,A=!p,B=[{action:this.handleSave,shortcut:Vt.SAVE},{action:this.handleMinimapChange,shortcut:We.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:We.NOTEBOOK.WORDWRAP}],V=vi.getDisabledRunTooltip(j,z,"Notebook extension","Run"),pe=vi.getDisabledRunTooltip(j,z,"Notebook extension","Run Selected"),Ge=[{title:ne?"Rename":"Save As…",order:10,group:te.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:te.groups.high,order:20}],Ne=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[Ne!=null&&Mr.createPortal(d.jsx("span",{className:Z(Oe.UNSAVED_INDICATOR_CLASS_NAME,{[Oe.UNSAVED_STATUS_CLASS_NAME]:u!==h})}),Ne),d.jsxs(rr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:Ge,renderTabTooltip:()=>N,children:[!$&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(oe,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:W,icon:d.jsx(ve,{icon:ps,transform:"grow-4"}),tooltip:"Run ".concat(We.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&d.jsx(he,{children:V})]}),d.jsxs("span",{children:[d.jsx(oe,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:W,icon:d.jsx(ve,{icon:rd,transform:"grow-4"}),tooltip:"Run Selected ".concat(We.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(oe,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:id,tooltip:"Save ".concat(Vt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(oe,{kind:"ghost",className:"btn-overflow",disabled:A,icon:vs,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(Qn,{actions:this.getDropdownOverflowActions,popperOptions:Oe.POPPER_OPTIONS})})]}),d.jsx(ml,{isLoaded:p,isLoading:f,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:T,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:q,focusOnMount:Y,ref:y=>{this.notebook=y}})]}),$&&d.jsx(m.Suspense,{fallback:d.jsx(hn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(Lb,{content:(n=q.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(un,{isOpen:ee,type:"file",defaultValue:N,title:ne?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(zn,{isOpen:G,headerText:'Are you sure you want to delete "'.concat(N,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(zn,{isOpen:F,headerText:"Do you want to save the changes you made to ".concat(N,"?"),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"}),d.jsx(te,{actions:B})]})]})}}Le(Oe,"COMPONENT","NotebookPanel");Le(Oe,"POPPER_OPTIONS",{placement:"bottom-end"});Le(Oe,"DEFAULT_NAME","Untitled");Le(Oe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Le(Oe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Le(Oe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var Rb=(r,e)=>{var t=qs(r),n=Zs(r),i=ir(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},tn=In(Rb,{updateNotebookSettings:Tc},null,{forwardRef:!0})(Oe);function Fb(){var{python:{linter:r={}}={}}=Vf(Zs),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function qa(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 Xa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qa(Object(t),!0).forEach(function(n){$b(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function $b(r,e,t){return(e=Hb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hb(r){var e=Bb(r,"string");return typeof e=="symbol"?e:e+""}function Bb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ge=U.module("ConsolePlugin");function Za(r){return r.notebook!==void 0}function Ub(r){If(r)}function WC(r){Ub(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:o,notebooksUrl:a}=r,s=m.useRef(0),[l,u]=m.useState(new Map),[h,c]=m.useState(new Map);Fb();var v=Ei(),p=m.useCallback(()=>i.getLastUsedPanelOfType(ni),[i]),f=m.useCallback((y,S)=>{u(_=>new Map(_.set(y,S)))},[u]),g=m.useCallback(y=>{u(S=>(S.delete(y),new Map(S)))},[u]),b=m.useCallback((y,S)=>{c(_=>new Map(_.set(y,S)))},[c]),w=m.useCallback(y=>{c(S=>(S.delete(y),new Map(S)))},[c]),T=m.useCallback(function(y){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,K=y&&y.trim();if(!K)ge.info("Ignoring empty code");else{var re=p();if(!re||!(re instanceof ni.WrappedComponent)){ge.error("Console panel not found");return}ge.debug("Send command: ",y,S,_),re.addCommand(y,S,_)}},[p]),P=m.useCallback(y=>{v($g(e,y))},[v,e]),F=m.useCallback(y=>{var{language:S}=y,_=S==="python"?"py":S,K=null;return _==null?(ge.debug("No extension for language",S),K="Untitled-".concat(s.current)):K="Untitled-".concat(s.current,".").concat(_),s.current+=1,K},[]),G=m.useCallback(function(y){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:_}=y;if(_!=null&&l.has(_))return l.get(_);if(_!=null&&h.has(_))return h.get(_);if(S)return wt()},[l,h]),ee=m.useCallback((y,S)=>{x.renameComponent(n.root,{id:y},S)},[n.root]),Y=m.useCallback((y,S)=>{ge.debug("Rename file panel",y,S);var _;if(l.has(y)&&(_=l.get(y),g(y),_!=null&&f(S,_)),h.has(y)&&(_=h.get(y),w(y),_!=null&&b(S,_)),_===void 0){ge.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}ee(_,M.getBaseName(S))},[l,h,ee,f,b,g,w]),N=m.useCallback(y=>{var S=G(y,!1);if(S==null){ge.error("Could not find panel id for file metadata",y);return}x.activateTab(n.root,{id:S})},[G,n.root]),$=m.useCallback((y,S,_)=>{if(ge.debug("registerFilePanel",y,S,_),S==null||S.id==null){ge.debug("Ignore empty file id",S);return}var{id:K}=S;if(_){b(K,y);return}if(l.has(K)){var re=l.get(K);if(y===re){ge.debug("Update tab title for file ".concat(K));var{itemName:ot}=S;Y(K,ot)}else ge.error("File ".concat(K," already associated with a different tab ").concat(re));return}f(K,y),h.has(K)&&w(K)},[l,h,Y,f,b,w]),ne=m.useCallback((y,S)=>{if(ge.debug("unregisterFileTab",y,S),y==null||y.id==null){ge.debug("Ignore empty file id",y);return}var{id:_}=y;if(S){w(_);return}g(_)},[g,w]),q=m.useCallback((y,S)=>{ge.debug("closeFilePanel",y);var{id:_}=y;if(_==null){ge.warn("File ID is null, ignore close event");return}var K=null,re=!1;if(l.has(_))K=l.get(_);else if(h.has(_))K=h.get(_),re=!0;else{ge.debug("File ".concat(_," isn't open, ignore close event"));return}ne(y,re),x.closeComponent(n.root,{id:K},S)},[n.root,l,h,ne]),j=m.useCallback(y=>{var{itemName:S}=y;return M.getBaseName(S)},[]),z=m.useCallback(y=>{var{id:S}=y;return ge.debug("fileIsOpen",y,S,l),S!=null&&l.has(S)},[l]),W=m.useCallback(y=>{var{id:S}=y;return ge.debug("fileIsOpenAsPreview",y,S,h),S!=null&&h.has(S)},[h]),A=m.useCallback(y=>{if(y!=null){var S=i.getOpenedPanelById(y);S&&Za(S)&&S.focus()}},[i]),B=m.useCallback(y=>{var{id:S,settings:_,fileMetadata:K,session:re,sessionLanguage:ot,isPreview:I=!1}=y,X={settings:_,fileMetadata:K},ae=j(K);return{type:"react-component",component:tn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:re,sessionLanguage:ot,panelState:X,isPreview:I,notebooksUrl:a},title:ae,id:S}},[j,e,a]),V=m.useCallback(function(y,S,_){var K=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(_)},re=G(K);if(z(K)&&re!=null){ge.debug("File is already open, focus panel"),N(K),A(re);return}if(re==null){ge.error("Panel ID for file metadata is null");return}var ot=x.getStackForComponentTypes(n.root,[tn.COMPONENT]),I=B({id:re,settings:_,fileMetadata:K,session:y,sessionLanguage:S});ge.debug("createNotebook",I,l),x.openComponentInStack(ot,I)},[z,A,F,G,n.root,B,l,N]),pe=m.useCallback(function(y,S,_,K){var re=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ge.debug("selectNotebook",K,re);var ot=z(K),I=W(K),[X]=[...h.values()],ae=!re,ce=ae&&X?X:G(K);if(ce==null||ce==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(K)));if(ot||I)N(K);else{var $e=x.getStackForComponentTypes(n.root,[tn.COMPONENT]),_t=B({id:ce,settings:_,fileMetadata:K,session:y,sessionLanguage:S,isPreview:ae});x.openComponentInStack($e,_t)}if(I&&re){var yt=K.id,Kr=x.getStackForConfig(n.root,{component:tn.COMPONENT,id:ce}),Nn=x.getContentItemInStack(Kr,{component:tn.COMPONENT,id:ce});yt!=null&&Nn&&Je(Nn)&&(Nn.container.emit(J.PROMOTE_FROM_PREVIEW),w(yt),f(yt,ce))}re&&A(ce)},[N,z,W,A,G,n.root,B,h,w,f]),Ge=m.useCallback(function(y,S){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},K=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,re=i.getLastUsedPanelOfType(tn);re&&Za(re)?_!=null&&_.value!=null&&re.notebook!=null&&re.notebook.append(_.value):K&&V(y,S,_)},[V,i]),Ne=m.useCallback((y,S)=>Rf.hydrate(Xa(Xa({},y),{},{notebooksUrl:a}),S),[a]);return Ln(o,ni,t),Ln(o,Wg),Ln(o,Ib),Ln(o,Nb),Ln(o,tn,Ne),Ae(n.eventHub,Me.SEND_COMMAND,T),Ae(n.eventHub,Me.SETTINGS_CHANGED,P),Ae(n.eventHub,J.CLOSE_FILE,q),Ae(n.eventHub,J.CREATE_NOTEBOOK,V),Ae(n.eventHub,J.SELECT_NOTEBOOK,pe),Ae(n.eventHub,J.RENAME,ee),Ae(n.eventHub,J.RENAME_FILE,Y),Ae(n.eventHub,J.SEND_TO_NOTEBOOK,Ge),Ae(n.eventHub,J.REGISTER_FILE,$),Ae(n.eventHub,J.UNREGISTER_FILE,ne),null}function Wr(r,e,t){return(e=Wb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wb(r){var e=Vb(r,"string");return typeof e=="symbol"?e:e+""}function Vb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vr{}Wr(Vr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Wr(Vr,"INPUT_FILTER","ControlType.INPUT_FILTER");Wr(Vr,"MARKDOWN","ControlType.MARKDOWN");Wr(Vr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{ir as $,Sy as A,oe as B,js as C,Ke as D,wy as E,ll as F,Ds as G,Re as H,Et as I,Zs as J,O as K,Tc as L,H as M,Vt as N,Gn as O,Te as P,ty as Q,wm as R,Bs as S,E as T,Vr as U,CC as V,Qn as W,Qs as X,jr as Y,Xs as Z,ly as _,vt as a,Pi as a$,xC as a0,yc as a1,Fe as a2,Kf as a3,Ey as a4,Pc as a5,Yt as a6,lC as a7,Bl as a8,Dy as a9,xy as aA,Iy as aB,IC as aC,DC as aD,Py as aE,Oy as aF,Ys as aG,_y as aH,me as aI,Qb as aJ,zd as aK,Yn as aL,Qd as aM,Gd as aN,Is as aO,xs as aP,qd as aQ,Xd as aR,mt as aS,gt as aT,Ns as aU,$s as aV,Kh as aW,Ar as aX,D as aY,ks as aZ,sh as a_,cC as aa,Rf as ab,cd as ac,Es as ad,J as ae,Pt as af,qy as ag,Zy as ah,Qy as ai,eC as aj,ie as ak,yC as al,mC as am,fC as an,tn as ao,Ef as ap,hc as aq,ys as ar,Nr as as,WC as at,te as au,zn as av,HC as aw,ky as ax,Ty as ay,My as az,Tt as b,We as b$,ey as b0,zh as b1,Ti as b2,ry as b3,Ls as b4,Us as b5,As as b6,Eh as b7,wr as b8,ac as b9,dv as bA,Wy as bB,Uy as bC,ki as bD,Vy as bE,dp as bF,ip as bG,hp as bH,zt as bI,Js as bJ,Ue as bK,_r as bL,zv as bM,Rr as bN,el as bO,Bc as bP,nl as bQ,Mc as bR,Pn as bS,tl as bT,Tn as bU,kv as bV,Er as bW,rl as bX,vp as bY,Se as bZ,ci as b_,Ks as ba,Vs as bb,Ws as bc,iy as bd,oy as be,ay as bf,Um as bg,Wm as bh,we as bi,Xm as bj,lv as bk,Q as bl,Jm as bm,ke as bn,Ny as bo,al as bp,sl as bq,Ly as br,$y as bs,jy as bt,Ay as bu,Ry as bv,rv as bw,Hy as bx,By as by,uv as bz,C as c,qg as c$,ml as c0,vi as c1,Cs as c2,x as c3,Ln as c4,Gy as c5,sC as c6,wg as c7,ug as c8,lg as c9,iC as cA,gC as cB,pC as cC,Xy as cD,Jy as cE,Yy as cF,tC as cG,dC as cH,bC as cI,Ae as cJ,Zf as cK,FC as cL,$i as cM,$C as cN,Jl as cO,BC as cP,Mn as cQ,Xl as cR,Zg as cS,Xg as cT,Gg as cU,Yl as cV,Kg as cW,Vg as cX,LC as cY,zg as cZ,RC as c_,ti as ca,Ul as cb,uC as cc,nC as cd,Ll as ce,Nf as cf,Ri as cg,Li as ch,Fl as ci,mr as cj,If as ck,jl as cl,dg as cm,vC as cn,oC as co,aC as cp,Hl as cq,Al as cr,xf as cs,Pf as ct,_f as cu,Tf as cv,Of as cw,zy as cx,Bf as cy,rC as cz,kn as d,Zl as d0,Ia as d1,Yb as d2,Yi as d3,wf as d4,Fr as d5,hC as d6,M as d7,Hi as d8,UC as d9,OC as dA,$g as dB,Fb as dC,Xb as dD,Jb as dE,Zb as dF,Gr as dG,gd as dH,zr as dI,Fy as dJ,Un as dK,ni as da,Nb as db,Wg as dc,Ib as dd,Ts as de,qb as df,rr as dg,_s as dh,Zt as di,NC as dj,PC as dk,TC as dl,Gl as dm,EC as dn,_C as dp,Zn as dq,SC as dr,AC as ds,wC as dt,ft as du,jC as dv,MC as dw,kC as dx,ql as dy,Me as dz,bc as e,yy as f,uy as g,by as h,gy as i,fy as j,py as k,vy as l,sy as m,cy as n,hy as o,dy as p,_c as q,Ce as r,de as s,he as t,dc as u,Ee as v,Cy as w,my as x,ny as y,Vf as z};
|
|
24
|
-
//# sourceMappingURL=ControlType-
|
|
23
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Se.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 d.jsxs("div",{className:"log-pane h-100 w-100",children:[d.jsxs("div",{className:"log-pane-menu",children:[d.jsx(oe,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Ku,tooltip:"Clear log"}),d.jsx(oe,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:zu,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(Qn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}it(Se,"DefaultLogLevels",[xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN]);it(Se,"AllLogLevels",[xe.INFO,xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN,xe.DEBUG,xe.TRACE]);it(Se,"bufferTimeout",16);it(Se,"maxLogSize",131072);it(Se,"truncateSize",65536);const ep="var(--dh-color-chart-colorway)",tp="var(--dh-color-chart-grid)",np="var(--dh-color-chart-axis-line)",rp="var(--dh-color-chart-axis-line-zero)",aa={"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:ep,gridcolor:tp,linecolor:np,zerolinecolor:rp,"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)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)"};var sa=U.module("ChartTheme");function ip(){var r,e=hs(aa);return e.colorway=Gu((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return qu.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),sa.debug2("Chart theme:",aa),sa.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"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"]})}function la(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 op(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(n){ap(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ap(r,e,t){return(e=sp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sp(r){var e=lp(r,"string");return typeof e=="symbol"?e:e+""}function lp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var up=m.lazy(()=>bs(()=>import("./Plot-DJ6ubuGW.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function dp(r){return d.jsx(m.Suspense,{fallback:d.jsx(hn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(up,op({},r))})}var ki=m.createContext(null);ki.displayName="ChartThemeContext";function Vy(r){var{children:e}=r,{activeThemes:t}=Ds(),n=m.useMemo(ip,[t]);return d.jsx(ki.Provider,{value:n,children:e})}function hp(){return Yn(ki,"No ChartThemeContext value found.")}function ua(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function cp(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ua(o,n,i,a,s,"next",l)}function s(l){ua(o,n,i,a,s,"throw",l)}a(void 0)})}}var mp=U.module("HeapUsage");function vp(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=hp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),p=xs(),f=m.useCallback(cp(function*(){try{var A=yield t.getWorkerHeapInfo();if(!p.current)return;if(u(A),o||h){for(var B=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:pe,usages:Ge}=v.current;pe.length!==0&&V-pe[0]>a*1.5;)pe.shift(),Ge.shift();pe.push(V),Ge.push(B)}else v.current={timestamps:[],usages:[]}}catch(Ne){mp.warn("Unable to get heap usage",Ne)}}),[t,p,o,h,a]);zd(f,h?i:n);var g=(A,B)=>Math.round(A*10**B)/10**B,b=2,w=1024**3,{freeMemory:T,totalHeapSize:P,maximumHeapSize:F}=l,G=g(T/w,b),ee=g(P/w,b),Y=g(F/w,b),N=ee-G,$=function(B,V){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:Z("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:B}),d.jsx("div",{children:V})]})},{timestamps:ne,usages:q}=v.current,j=(e=ne[ne.length-1])!==null&&e!==void 0?e:0,z=P/F,W=(P-T)/F;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(z*100,"% - ").concat(z*2,"px")}}),d.jsx("div",{className:Z("used-memory",{"heap-overflow":(P-T)/F>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[$("In use:","".concat(N.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),$("Free:","".concat(G.toFixed(b)," GB")),$("Total:","".concat(ee.toFixed(b)," GB")),$("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(dp,{data:[{x:[...ne],y:[...q],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(a/6),gridcolor:s.linecolor,range:[j-a,j],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}var vl=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 pl(r){return r.componentName!==void 0}function pp(r){return r.component!==void 0}var fl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const fp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:vl,isGLComponentConfig:pl,isReactComponentConfig:pp,itemDefaultConfig:fl},Symbol.toStringTag,{value:"Module"}));function Cr(r,e,t){return(e=gp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gp(r){var e=bp(r,"string");return typeof e=="symbol"?e:e+""}function bp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ze{constructor(){Cr(this,"_mSubscriptions",void 0),Cr(this,"off",this.unbind),Cr(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[ze.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),o=1;o<n;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[ze.ALL_EVENT],u=0;u<l.length;u++){var h=l[u].ctx||{};try{l[u].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,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Cr(ze,"ALL_EVENT","__all");function ct(r,e,t){return(e=yp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yp(r){var e=Cp(r,"string");return typeof e=="symbol"?e:e+""}function Cp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class pi extends ze{constructor(e,t,n){super(),ct(this,"width",void 0),ct(this,"height",void 0),ct(this,"title",void 0),ct(this,"parent",void 0),ct(this,"layoutManager",void 0),ct(this,"tab",void 0),ct(this,"_config",void 0),ct(this,"isHidden",!1),ct(this,"beforeCloseHandler",void 0),ct(this,"_element",k(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ct(this,"_contentElement",void 0),this.title=pl(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,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",h=u==="height"?t:e,c=((n=this[u])!==null&&n!==void 0?n:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=h/c*100,p=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),f=0;f<a.contentItems.length;f++)if(a.contentItems[f]===s)a.contentItems[f].config[u]=v;else{var g;a.contentItems[f].config[u]=((g=a.contentItems[f].config[u])!==null&&g!==void 0?g:0)+p}return a.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}getConfig(){return this._config}extendState(e){this.setState(k.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,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Sp=Object.freeze(Object.defineProperty({__proto__:null,Container:pi,ItemContainer:pi},Symbol.toStringTag,{value:"Module"}));function gl(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function bl(r){if(window.location.hash)return gl(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 Mi(r){return window.requestAnimationFrame(r)}function wp(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 Or(){return wt()}function Ep(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 Ni(r){return k.trim(r.replace(/(<([^>]+)>)/gi,""))}function Xe(r,e,t){return(e=Pp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pp(r){var e=Tp(r,"string");return typeof e=="symbol"?e:e+""}function Tp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Jn extends ze{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Xe(this,"_eElement",void 0),Xe(this,"_oDocument",void 0),Xe(this,"_eBody",void 0),Xe(this,"_root",void 0),Xe(this,"_destroyAfterMouseUp",void 0),Xe(this,"_nDelay",400),Xe(this,"_timeout",void 0),Xe(this,"timeout",void 0),Xe(this,"_nDistance",10),Xe(this,"_nX",0),Xe(this,"_nY",0),Xe(this,"_nOriginalX",0),Xe(this,"_nOriginalY",0),Xe(this,"_bDragging",!1),this._eElement=e,this._oDocument=k(document),this._eBody=k(document.body),this._root=t,this._destroyAfterMouseUp=i,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(n=this._eElement)===null||n===void 0||n.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,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=a.y)!==null&&n!==void 0?n:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.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,o,a;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||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),(a=this._root)===null||a===void 0||a.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,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._root)===null||n===void 0||n.childElementContainer.addClass("lm_dragging"),(i=this._oDocument)===null||i===void 0||(i=i.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}}}function gn(r,e,t){return(e=_p(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _p(r){var e=Op(r,"string");return typeof e=="symbol"?e:e+""}function Op(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yl{constructor(e,t){gn(this,"_container",void 0),gn(this,"_reactComponent",null),gn(this,"_portalComponent",null),gn(this,"_originalComponentWillUpdate",null),gn(this,"_initialState",void 0),gn(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=Mr.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=k.extend(e,this._container._config.props);return R.createElement(this._reactClass,t)}}var xr=["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"],xp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ji(r){if(xr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Ai(r,e,"_min"),e}function fi(r){if(xr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Ai(r,e,"_max"),e}function Ai(r,e,t){var n=t==="_min"?Ip:Dp;for(var i in r)if(r.hasOwnProperty(i)){var o=Array.isArray(r)?r[Number.parseInt(i,10)]:r[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=n(i,xr);e[s]=a}Ai(o,a,t)}else{var l=n(o,xp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=n(i,xr);e[u]=l}}}}function Ip(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function Dp(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function Jr(r,e,t){return(e=kp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kp(r){var e=Mp(r,"string");return typeof e=="symbol"?e:e+""}function Mp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gi{constructor(e,t){Jr(this,"name",void 0),Jr(this,"origin",void 0),Jr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function lr(r,e,t){return(e=Np(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Np(r){var e=jp(r,"string");return typeof e=="symbol"?e:e+""}function jp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let Cl=class extends ze{constructor(e){super(),lr(this,"_layoutManager",void 0),lr(this,"_dontPropagateToParent",void 0),lr(this,"_childEventSource",void 0),lr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(ze.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),k(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(){k(window).off("gl_child_event",this._boundOnEventFromChild)}};function Sl(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function wl(r){return(e,t)=>Sl(e,r,t)}function El(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e.emit(r,...n)}}function Pl(r){return(e,t)=>{var n=m.useRef(null),i=m.useRef(()=>!1);if(n.current!=e||i.current!=t){var o;(o=n.current)===null||o===void 0||o.off(r,i.current),e==null||e.on(r,t)}n.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=n.current)===null||a===void 0?void 0:a.off(r,i.current)},[])}}function Zt(r){return{listen:wl(r),emit:El(r),useListener:Pl(r)}}const Ap=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:gi,DragListener:Jn,EventEmitter:ze,EventHub:Cl,ReactComponentHandler:yl,animFrame:Mi,filterXss:Ep,getHashValue:gl,getQueryStringParam:bl,getUniqueId:Or,listenForEvent:Sl,makeEmitFunction:El,makeEventFunctions:Zt,makeListenFunction:wl,makeUseListenerFunction:Pl,minifyConfig:ji,removeFromArray:wp,stripTags:Ni,unminifyConfig:fi},Symbol.toStringTag,{value:"Module"}));function Rt(r,e,t){return(e=Lp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lp(r){var e=Rp(r,"string");return typeof e=="symbol"?e:e+""}function Rp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Tl extends ze{constructor(e,t,n,i,o){super(),Rt(this,"isInitialised",!1),Rt(this,"_config",void 0),Rt(this,"_dimensions",void 0),Rt(this,"_parentId",void 0),Rt(this,"_indexInParent",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_popoutWindow",null),Rt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,i,o,a,s,l,u,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=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&n!==void 0?n:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s: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=k.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 o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o: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;k(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},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-"+Or();e=ji(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 _e(r,e,t){return(e=Fp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fp(r){var e=$p(r,"string");return typeof e=="symbol"?e:e+""}function $p(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class pn extends ze{constructor(e,t,n,i,o,a){var s,l,u,h,c,v,p,f;if(super(),_e(this,"_dragListener",void 0),_e(this,"_layoutManager",void 0),_e(this,"_contentItem",void 0),_e(this,"_originalParent",void 0),_e(this,"_area",null),_e(this,"_lastValidArea",null),_e(this,"_minX",void 0),_e(this,"_maxX",void 0),_e(this,"_minY",void 0),_e(this,"_maxY",void 0),_e(this,"_width",void 0),_e(this,"_height",void 0),_e(this,"_sided",void 0),_e(this,"element",void 0),_e(this,"childElementContainer",void 0),_e(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=k(pn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._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",Ni((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").text((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),k(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,T;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(h=P==null?void 0:P.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(f=this.element.height())!==null&&f!==void 0?f:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,o,a=(i=n.pageX)!==null&&i!==void 0?i:0,s=(o=n.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,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")}}_e(pn,"_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 ur(r,e,t){return(e=Hp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hp(r){var e=Bp(r,"string");return typeof e=="symbol"?e:e+""}function Bp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _l{constructor(e,t,n){ur(this,"_element",void 0),ur(this,"_itemConfig",void 0),ur(this,"_layoutManager",void 0),ur(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Jn(this._element,this._layoutManager.root,!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(k.extend(!0,{},n));new pn(e,t,this._dragListener,this._layoutManager,i,null)}}function dr(r,e,t){return(e=Up(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Up(r){var e=Wp(r,"string");return typeof e=="symbol"?e:e+""}function Wp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ol{constructor(e,t,n){dr(this,"_element",k(window)),dr(this,"_itemConfig",void 0),dr(this,"_layoutManager",void 0),dr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&this._layoutManager&&(this._dragListener=new Jn(this._element,this._layoutManager.root,!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(k.extend(!0,{},n));new pn(e,t,this._dragListener,this._layoutManager,i,null)}}}function xl(r,e,t){return(e=Vp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vp(r){var e=Kp(r,"string");return typeof e=="symbol"?e:e+""}function Kp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class er{constructor(){xl(this,"element",k(er._template)),k(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()}}xl(er,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ei(r,e,t){return(e=zp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zp(r){var e=Gp(r,"string");return typeof e=="symbol"?e:e+""}function Gp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hn{constructor(e,t,n,i){ei(this,"element",void 0),ei(this,"_header",void 0),ei(this,"_action",void 0),this._header=e,this.element=k('<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 qp(r,e,t){return(e=Xp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xp(r){var e=Zp(r,"string");return typeof e=="symbol"?e:e+""}function Zp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class an extends Error{constructor(e,t){super(),qp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Yp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:an},Symbol.toStringTag,{value:"Module"}));function Pe(r,e,t){return(e=Qp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qp(r){var e=Jp(r,"string");return typeof e=="symbol"?e:e+""}function Jp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function sn(r){return r.isStack}function Je(r){return r.isComponent}function Il(r){return r.isRoot}class De extends ze{constructor(e,t,n,i){super(),Pe(this,"config",void 0),Pe(this,"type",void 0),Pe(this,"contentItems",void 0),Pe(this,"parent",void 0),Pe(this,"layoutManager",void 0),Pe(this,"element",void 0),Pe(this,"childElementContainer",void 0),Pe(this,"componentName",void 0),Pe(this,"isInitialised",!1),Pe(this,"isMaximised",!1),Pe(this,"isRoot",!1),Pe(this,"isRow",!1),Pe(this,"isColumn",!1),Pe(this,"isStack",!1),Pe(this,"isComponent",!1),Pe(this,"tab",void 0),Pe(this,"_pendingEventPropagations",void 0),Pe(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(ze.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 o=0;o<this.contentItems.length;o++)this.contentItems[o].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 o;(o=this.parent)===null||o===void 0||o.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),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,sn(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(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),n(o.contentItems[a])};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&&Je(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 o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(n=e.width())!==null&&n!==void 0?n:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new gi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new an("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(fl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof gi&&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,Mi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function jn(r,e,t){return(e=ef(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ef(r){var e=tf(r,"string");return typeof e=="symbol"?e:e+""}function tf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dl extends De{constructor(e,t,n){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,u]=s;t[l]===void 0&&(t[l]=u)}),super(e,t,n,k()),jn(this,"config",void 0),jn(this,"componentName",void 0),jn(this,"container",void 0),jn(this,"parent",void 0),jn(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=k.extend(!0,{},this.config.componentState||{});if(o==null)throw new an('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 pi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){De.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),De.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),De.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),De.prototype._$destroy.call(this)}_$getArea(){return null}}function lt(r,e,t){return(e=nf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nf(r){var e=rf(r,"string");return typeof e=="symbol"?e:e+""}function rf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qn extends De{constructor(e,t,n,i){super(t,n,i,k('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),lt(this,"isRow",void 0),lt(this,"isColumn",void 0),lt(this,"childElementContainer",void 0),lt(this,"parent",void 0),lt(this,"_splitter",[]),lt(this,"_splitterSize",void 0),lt(this,"_splitterGrabSize",void 0),lt(this,"_isColumn",void 0),lt(this,"_dimension",void 0),lt(this,"_splitterPosition",null),lt(this,"_splitterMinPosition",null),lt(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,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),De.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}if(De.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,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(De.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,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var u,h,c=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[n];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[n]=((u=this.contentItems[l].config[n])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=u.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var p=0;p<n.length;p++){l=n[p];var f=Math.round((l.width-t)*v);a-=f,l.width-=f}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new kl(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 o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((n=a.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_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,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),c=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Mi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function da(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 ha(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?da(Object(t),!0).forEach(function(n){bi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):da(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bi(r,e,t){return(e=of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function of(r){var e=af(r,"string");return typeof e=="symbol"?e:e+""}function af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yi extends De{constructor(e,t,n){super(e,ha(ha({},t),{},{type:"root"}),null,k('<div class="lm_goldenlayout lm_item lm_root"></div>')),bi(this,"childElementContainer",void 0),bi(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(Je(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,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof qn)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}function ca(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 bn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(n){et(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function et(r,e,t){return(e=sf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sf(r){var e=lf(r,"string");return typeof e=="symbol"?e:e+""}function lf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ci extends De{constructor(e,t,n){var i,o,a,s,l,u,h,c,v;super(e,t,n,k('<div class="lm_item lm_stack"></div>')),et(this,"_activeContentItem",null),et(this,"_header",void 0),et(this,"childElementContainer",k('<div class="lm_items"></div>')),et(this,"header",void 0),et(this,"parent",void 0),et(this,"isStack",!0),et(this,"_dropSegment",null),et(this,"_contentAreaDimensions",null),et(this,"_dropIndex",void 0),et(this,"_side",void 0),et(this,"_sided",!1),et(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:(o=p.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=p.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=p.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=p.settings)!==null&&u!==void 0&&u.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(v=p.labels)===null||v===void 0?void 0:v.minimise)!==null&&c!==void 0?c:void 0},p.header&&(this._header=bn(bn({},this._header),p.header)),t.header&&(this._header=bn(bn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=bn(bn({},this._header),t.content[0].header)),this.header=new Nt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){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),Je(e)?e._$show(t):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(){De.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",o=this.parent instanceof qn&&(t&&this.parent.isColumn||n&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Je(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c,v=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.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,o,a,s,l,u,h,c,v,p,f,g,b,w,T=this.header.tabs.length;if(T===0){var P,F,G,ee,Y,N,$,ne,q=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(F=q==null?void 0:q.left)!==null&&F!==void 0?F:0,x2:((G=q==null?void 0:q.left)!==null&&G!==void 0?G:0)+100,y1:(ee=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&ee!==void 0?ee:0,y2:((N=($=this.header.element.offset())===null||$===void 0?void 0:$.top)!==null&&N!==void 0?N:0)+((ne=this.header.element.innerHeight())!==null&&ne!==void 0?ne:0)});return}var j=this.header.tabsContainer,z=(t=j.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),W=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!z||!W)){e<z.left?e=z.left+1:e>z.right&&(e=z.right-1);var A,B;if(!(W.left<e&&e<W.right)){for(var V=0;V<T;V++){var pe;if(A=this.header.tabs[V].element,B=(pe=A.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),B&&B.left<e&&e<B.right){this._dropIndex=V;break}}if(A&&B&&e<B.left+B.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var Ge;this._dropIndex=Math.min(((Ge=this._dropIndex)!==null&&Ge!==void 0?Ge:0)+1,T),A.after(this.layoutManager.tabDropPlaceholder)}}var Ne=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;Ne=Math.max(Ne,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var y=Ne+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((u=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&u!==void 0?u:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:Ne,x2:y,y1:(p=(f=this.header.element.offset())===null||f===void 0?void 0:f.top)!==null&&p!==void 0?p:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(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=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}this._dropSegment=e}}const uf=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:De,Component:Dl,ContentItem:De,Root:yi,RowOrColumn:qn,Stack:Ci,isComponent:Je,isRoot:Il,isStack:sn},Symbol.toStringTag,{value:"Module"}));function Dt(r,e,t){return(e=df(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function df(r){var e=hf(r,"string");return typeof e=="symbol"?e:e+""}function hf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class tr{constructor(e,t){var n;Dt(this,"header",void 0),Dt(this,"contentItem",void 0),Dt(this,"element",k(tr._template)),Dt(this,"titleElement",void 0),Dt(this,"closeElement",void 0),Dt(this,"isActive",!1),Dt(this,"_layoutManager",void 0),Dt(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 Jn(this.element,this._layoutManager.root),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.element.on("mouseup",this._onMouseUp),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),Je(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.text(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.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Je(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 pn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){k(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Je(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&&Je(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Je(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Je(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(),Je(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}}Dt(tr,"_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 se(r,e,t){return(e=cf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cf(r){var e=mf(r,"string");return typeof e=="symbol"?e:e+""}function mf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nt extends ze{constructor(e,t){var n,i;super(),se(this,"layoutManager",void 0),se(this,"element",k(Nt._template)),se(this,"tabsContainer",void 0),se(this,"tabDropdownContainer",void 0),se(this,"tabDropdownSearch",void 0),se(this,"tabDropdownList",null),se(this,"controlsContainer",void 0),se(this,"parent",void 0),se(this,"tabs",[]),se(this,"activeContentItem",null),se(this,"closeButton",null),se(this,"tabDropdownButton",null),se(this,"tabNextButton",k(Nt._nextButtonTemplate)),se(this,"tabPreviousButton",k(Nt._previousButtonTemplate)),se(this,"holdTimer",null),se(this,"rAF",null),se(this,"CLICK_TIMEOUT",500),se(this,"START_SPEED",.01),se(this,"ACCELERATION",5e-4),se(this,"PADDING",10),se(this,"SCROLL_LEFT","left"),se(this,"SCROLL_RIGHT","right"),se(this,"isDraggingTab",!1),se(this,"isOverflowing",!1),se(this,"isDropdownShown",!1),se(this,"dropdownKeyIndex",0),se(this,"_lastVisibleTabIndex",-1),se(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 tr(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,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(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,o,a,s;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,h;l.scrollLeft=(u=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.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,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,v,p=o||h,f=h-p,g=this.START_SPEED*f+.5*this.ACCELERATION*(f*f);g=Math.min(g,(c=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,p)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),k(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,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Hn(this,o,"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 Hn(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Hn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Hn(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"),k(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"),k(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var h=(s+l+u.length)%u.length;h!==s;){if(u.eq(h).css("display")!=="none")return h;h=(h+l+u.length)%u.length}return s}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 o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.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(),k(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(n=k(window).height())!==null&&n!==void 0?n:0,l=(i=k(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<s-u.bottom,c=!h&&u.bottom>s*.6,v=Math.min(u.left+(c?u.width:0),l-a.width-this.PADDING),p=c?Math.max(u.top-o,this.PADDING):u.bottom,f=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":f,top:p,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}se(Nt,"_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(""));se(Nt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));se(Nt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function An(r,e,t){return(e=vf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vf(r){var e=pf(r,"string");return typeof e=="symbol"?e:e+""}function pf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kl{constructor(e,t,n){An(this,"_isVertical",void 0),An(this,"_size",void 0),An(this,"_grabSize",void 0),An(this,"_dragListener",void 0),An(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new Jn(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=k('<div class="lm_drag_handle"></div>'),t=k('<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 ff=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Tl,DragProxy:pn,DragSource:_l,DragSourceFromEvent:Ol,DropTargetIndicator:er,Header:Nt,HeaderButton:Hn,Splitter:kl,Tab:tr},Symbol.toStringTag,{value:"Module"}));var gf={config:fp,container:Sp,controls:ff,errors:Yp,items:uf,utils:Ap};function ma(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 Ze(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(n){le(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function le(r,e,t){return(e=bf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bf(r){var e=yf(r,"string");return typeof e=="symbol"?e:e+""}function yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var va=["column","row","stack","component"];class Fr extends ze{static isLayoutItemConfig(e){return va.includes(e.type)}static minifyConfig(e){return ji(e)}static unminifyConfig(e){return fi(e)}constructor(e,t){super(),le(this,"isInitialised",!1),le(this,"_isFullPage",!1),le(this,"_resizeTimeoutId",void 0),le(this,"_components",{"lm-react-component":yl}),le(this,"_fallbackComponent",void 0),le(this,"_itemAreas",[]),le(this,"_maximisedItem",null),le(this,"_maximisePlaceholder",k('<div class="lm_maximise_place"></div>')),le(this,"_creationTimeoutPassed",!1),le(this,"_subWindowsCreated",!1),le(this,"_dragSources",[]),le(this,"_updatingColumnsResponsive",!1),le(this,"_firstLoad",!0),le(this,"_reactChildMap",new Map),le(this,"_reactChildren",null),le(this,"_initialHeaderHeight",void 0),le(this,"width",null),le(this,"height",null),le(this,"root",void 0),le(this,"openPopouts",[]),le(this,"selectedItem",null),le(this,"isSubWindow",!1),le(this,"eventHub",new Cl(this)),le(this,"config",void 0),le(this,"container",void 0),le(this,"_originalContainer",void 0),le(this,"dropTargetIndicator",null),le(this,"tabDropPlaceholder",k('<div class="lm_drop_tab_placeholder"></div>')),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._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&k("body").css("visibility","hidden")}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 De))throw new Error("Root must be a ContentItem");var t={settings:Ze({},this.config.settings),dimensions:Ze({},this.config.dimensions),labels:Ze({},this.config.labels),content:[]},n=function(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var u=0;u<s.contentItems.length;u++)a.content[u]={},n(a.content[u],s.contentItems[u])}};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){k(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 er,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}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}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 o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),k(window).off("resize",this._onResize),k(window).off("unload beforeunload",this._onUnload),k(window).off("blur.lm").off("focus.lm"),k(window).off("keydown",this._windowKeydown),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 an("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Fr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+va.join(","),new an(i);return e.type==="component"&&!(t instanceof Ci)&&t&&!(this.isSubWindow===!0&&t instanceof yi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Or(),e.type==="stack"?new Ci(this,e,t):e.type==="row"?new qn(!1,this,e,t):e.type==="column"?new qn(!0,this,e,t):new Dl(this,e,t)}createPopout(e,t,n,i){var o=[],a=e instanceof De,s=this;if(a){var l;o=this.toConfig(e).content,n=Or();for(var u=e.parent,h=e;((c=u)===null||c===void 0?void 0:c.contentItems.length)===1&&!u.isRoot;){var c;h=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var p,f,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,T=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:b+T.left,top:w+T.top,width:(f=e.element.width())!==null&&f!==void 0?f:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!n||i===void 0)){var P=new Tl(o,t,n,i,this);return P.on("initialised",function(){s.emit("windowOpened",P)}),P.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new _l(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Ol(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,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&n>a.surface&&(n=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Ze({},this.root._$getArea()),n=[Ze(Ze({},t),{},{side:"left",x2:t.x1+e}),Ze(Ze({},t),{},{side:"right",x1:t.x2-e}),Ze(Ze({},t),{},{side:"top",y2:t.y1+e}),Ze(Ze({},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(sn(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Ze(Ze({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof De)return e;if(k.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t??null);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&&k(window).resize(this._onResize),k(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=bl("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=fi(e),localStorage.removeItem(n)),e=k.extend(!0,{},vl,e);var i=function(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?i(l):s==="type"&&l==="react-component"&&(a.type="component",a.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=k('<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=Ni((e=this.config.content[0].title)!==null&&e!==void 0?e:""),k("head").append(k("body link, body style, template, .gl_keep")),this.container=k("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?k(this._originalContainer):k("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,k("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 an(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new an(t,e);this.root=new yi(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),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var u=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(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=>{sn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}le(Fr,"__lm",gf);const pa={"tab-height":"28px","drag-border-width":"5px"},fa=Object.freeze({tabHeight:parseInt(pa["tab-height"],10),dragBorderWidth:parseInt(pa["drag-border-width"],10)});function ga(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 It(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(n){Ml(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ml(r,e,t){return(e=Cf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cf(r){var e=Sf(r,"string");return typeof e=="symbol"?e:e+""}function Sf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ft=U.module("LayoutUtils");function Nl(r){return r.componentName!==void 0}function Wt(r){var e=r;return(Nl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function hr(r){return r.focus!==void 0}function ba(r){return r.type==="stack"}class x{static activateTab(e,t){var n=x.getStackForRoot(e,t,!1);if(!n){Ft.error("Could not find stack for config",t);return}var i=x.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=x.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),!1;var i=x.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(Il(e)){var n={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(n);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(n);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,h,c=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(h=s.config)===null||h===void 0?void 0:h.width},e);e.replaceChild(s,c),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(n=>n.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=x.getAllStackContainers(e),n=x.getFocusedStackIndex(t);return t[n]}static getStackById(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&sn(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(sn(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var n;if(((n=e.config)===null||n===void 0?void 0:n.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}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&&sn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&Ki(o.config,t))return e;var a=this.getStackForConfig(o,t,n);if(a)return a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&n&&(a=this.addStack(e)),a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,u=x.getStackForRoot(e,{component:s},n&&l,i,o);if(u)return u}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&&Ki(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 o=e[i],{content:a}=o;if(Wt(o)){var s=t(o.component,o);s!=null?n.push(s):Ft.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=It(It({},o),{},{content:x.dehydrateLayoutConfig(a,t)});n.push(l)}else n.push(o)}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?(ba(n)&&delete n.activeItemIndex,x.dropLayoutMinorChange(i)):Wt(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=x.cloneLayout(e),o=x.cloneLayout(t);return n?(x.dropLayoutMinorChange(i),x.dropLayoutMinorChange(o),Kn(i,o)):Kn(i,o)}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 o=e[i];if(Wt(o)){var a,{component:s,props:l={}}=o;n.push(It(It({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:wt(),props:t(s,l)}))}else if(o.content!==void 0){var u=x.hydrateLayoutConfig(o.content,t);ba(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ft.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(It(It({},o),{},{content:u}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,stack:n=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,h=It({},t);if(h.id==null&&(h.id=wt()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};L(e);var v=n??(a?x.addStack(e):x.getStackForRoot(e,c));L(v);var p=x.getContentItemInStack(v,c);if(s!=null){var f=b=>{Ft.debug("Component created, focusing element",s),v.off("componentCreated",f);var{element:w}=b.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",f)}if(i&&p){var g=v.contentItems.indexOf(p);v.addChild(h,g+1),v.removeChild(p),v.setActiveContentItem(v.contentItems[g])}else v.addChild(h);s==null&&u&&hr(u)&&u.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=x.getContentItemInStack(e,o);if(n&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&hr(i)&&i.focus()}static closeComponent(e,t,n){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){Ft.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(Je(o)?o.container.close(n):i.removeChild(o)),a&&document.contains(a)&&hr(a)&&a.focus()}static renameComponent(e,t,n){var i=x.getStackForRoot(e,t,!1);if(!i){Ft.error("Could not find stack for config",t);return}var o=x.getContentItemInStack(i,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=x.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),null;var{props:i={}}=t,o=x.getPanelComponentState(t),a={type:"react-component",component:t.component,props:It(It({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:wt()};return x.openComponentInStack(n,a),a}static getPanelComponentState(e){if(Nl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Wt(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:fa.tabHeight,borderWidth:fa.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=x.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return x.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=x.getComponentConfigFromContainer(t);if(n&&Wt(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]:x.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(hr(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)})}}Ml(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var wf=R.forwardRef((r,e)=>{var t=x.getComponentNameFromPanel({props:r});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});wf.displayName="PanelPlaceholder";var ie=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"}),{listen:zy,emit:Ef,useListener:Gy}=Zt(ie.OPEN),$r=Object.freeze({CYCLE_TO_NEXT_STACK:"NavigationEvent.CYCLE_TO_NEXT_STACK",CYCLE_TO_PREVIOUS_STACK:"NavigationEvent.CYCLE_TO_PREVIOUS_STACK",CYCLE_TO_NEXT_TAB:"NavigationEvent.CYCLE_TO_NEXT_TAB",CYCLE_TO_PREVIOUS_TAB:"NavigationEvent.CYCLE_TO_PREVIOUS_TAB"}),{listen:Pf,emit:qy,useListener:Xy}=Zt($r.CYCLE_TO_NEXT_STACK),{listen:Tf,emit:Zy,useListener:Yy}=Zt($r.CYCLE_TO_PREVIOUS_STACK),{listen:_f,emit:Qy,useListener:Jy}=Zt($r.CYCLE_TO_NEXT_TAB),{listen:Of,emit:eC,useListener:tC}=Zt($r.CYCLE_TO_PREVIOUS_TAB);function xf(r){return typeof r.id=="string"&&r.layout instanceof Fr&&r.panelManager instanceof Li&&typeof r.registerComponent=="function"}function If(r){if(!xf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function ya(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ca(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ya(Object(t),!0).forEach(function(n){Mt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ya(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e,t){return(e=Df(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Df(r){var e=kf(r,"string");return typeof e=="symbol"?e:e+""}function kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ut=U.module("PanelManager"),nn=function(r){return r[r.Next=0]="Next",r[r.Previous=1]="Previous",r}(nn||{});class Li{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Mt(this,"layout",void 0),Mt(this,"hydrateComponent",void 0),Mt(this,"dehydrateComponent",void 0),Mt(this,"onPanelsUpdated",void 0),Mt(this,"closed",void 0),Mt(this,"openedMap",void 0),Mt(this,"navigationEventListenerRemovers",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.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.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=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ie.FOCUS,this.handleFocus),e.on(ie.MOUNT,this.handleMount),e.on(ie.UNMOUNT,this.handleUnmount),e.on(ie.REOPEN,this.handleReopen),e.on(ie.REOPEN_LAST,this.handleReopenLast),e.on(ie.DELETE,this.handleDeleted),e.on(ie.CLOSED,this.handleClosed),e.on(ie.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(Pf(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Tf(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(_f(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Of(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(ie.FOCUS,this.handleFocus),e.off(ie.MOUNT,this.handleMount),e.off(ie.UNMOUNT,this.handleUnmount),e.off(ie.REOPEN,this.handleReopen),e.off(ie.REOPEN_LAST,this.handleReopenLast),e.off(ie.DELETE,this.handleDeleted),e.off(ie.CLOSED,this.handleClosed),e.off(ie.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}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 x.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Wt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=x.getStackForConfig(this.layout.root,{id:e});return(t=n&&x.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=>wr(n)&&t instanceof n.WrappedComponent||!wr(n)&&t instanceof n))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){ut.error("updatePanel Panel did not have an ID",e);return}ut.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=x.getIdFromPanel(e);if(t==null){ut.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ut.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ut.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ut.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){ut.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ut.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ut.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=x.getAllStackContainers(this.layout);if(!(t.length<=1)){var n=x.getFocusedStackIndex(t);if(n===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===nn.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,h=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(h,!0)}}handleCycleToNextStack(){this.cycleStack(nn.Next)}handleCycleToPreviousStack(){this.cycleStack(nn.Previous)}cycleTab(e){var t,n=x.getFocusedStack(this.layout);if(n!==void 0){var{contentItems:i}=n;if(!(i.length<=1)){var o=(t=n.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===nn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(nn.Next)}handleCycleToPreviousTab(){this.cycleTab(nn.Previous)}handleReopen(e,t){ut.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var o=Ca(Ca({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:x.getStackById(a,e.parentStackId);x.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var n=(t=x.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===n){this.handleReopen(o);return}}}}handleDeleted(e){ut.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ut.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;x.closeComponent(n,t)}addClosedPanel(e){var t=x.getComponentConfigFromContainer(e);if(t&&Wt(t)){var n=this.dehydrateComponent(t.component,t);if(n!=null){var i;n.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(n)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Mt(Li,"MAX_CLOSED_PANEL_COUNT",100);var Mf=U.module("PanelErrorBoundary");class Nf extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=x.getIdFromContainer(e);Mf.debug("componentWillUnmount",n),t.emit(ie.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(hn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Sa(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 Ir(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(t),!0).forEach(function(n){jf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function jf(r,e,t){return(e=Af(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Af(r){var e=Lf(r,"string");return typeof e=="symbol"?e:e+""}function Lf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function jl(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return n!=null&&(o.metadata=n),i!=null&&(o.panelState=i),Ir(Ir({},r),{},{componentState:null,props:o,type:"react-component"})}function Al(r,e){return Ir(Ir({},r),{},{localDashboardId:e})}const Rf={dehydrate:jl,hydrate:Al};var Ll=R.createContext(void 0);Ll.displayName="LayoutManagerContext";var Ff=be.shape({on:be.func,off:be.func,isHidden:be.bool,tab:be.shape({header:be.shape({tabs:be.arrayOf(be.shape({contentItem:be.shape({})}))})}),title:be.string,setTitle:be.func,close:be.func}),Rl=be.shape({on:be.func,off:be.func,emit:be.func}),$f=be.shape({registerComponent:be.func,root:be.shape({addChild:be.func}),on:be.func,off:be.func,eventHub:Rl}),nC=Object.freeze({Container:Ff,EventHub:Rl,Layout:$f});function Ln(r,e,t,n){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");R.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Ae(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var Fl="SET_DASHBOARD_DATA";const Hf=Dc(Fl,{},!1),Bf={dashboardData:Hf};var Uf=new Map,$l=Object.freeze({}),Wf=Object.freeze([]),rC=Ei,Vf=Ja,iC=hu,Kf=r=>r.dashboardData,Fe=(r,e)=>{var t;return(t=Kf(r)[e])!==null&&t!==void 0?t:$l},oC=(r,e)=>{var t;return(t=Fe(r,e).closed)!==null&&t!==void 0?t:Wf},aC=(r,e)=>{var t;return(t=Fe(r,e).openedMap)!==null&&t!==void 0?t:Uf},Hl=(r,e)=>{var t;return(t=Fe(r,e).pluginDataMap)!==null&&t!==void 0?t:$l},sC=(r,e,t)=>Hl(r,e)[t];function wa(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 wn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(n){zf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function zf(r,e,t){return(e=Gf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gf(r){var e=qf(r,"string");return typeof e=="symbol"?e:e+""}function qf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Bl=(r,e)=>({type:Fl,id:r,payload:e}),Yt=(r,e)=>(t,n)=>t(Bl(r,wn(wn({},Fe(n(),r)),e))),lC=(r,e,t)=>(n,i)=>n(Bl(r,wn(wn({},Fe(i(),r)),{},{pluginDataMap:wn(wn({},Hl(i(),r)),{},{[e]:t})})));Object.entries(Bf).map(r=>{var[e,t]=r;return Xu.register(e,t)});function Xf(r){var{children:e}=r;return d.jsx(d.Fragment,{children:e})}var Ri=m.createContext(null);Ri.displayName="PanelIdContext";function Zf(){return m.useContext(Ri)}function Ea(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 Rn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(n){Yf(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Yf(r,e,t){return(e=Qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qf(r){var e=Jf(r,"string");return typeof e=="symbol"?e:e+""}function Jf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var cr=U.module("DashboardLayout"),eg=Object.freeze({}),tg=[],Pa=()=>{},ng=1e3,Ta=r=>r;function uC(r){var e,t,{id:n,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=tg,onLayoutChange:l=Pa,onLayoutInitialized:u=Pa,hydrate:h=Al,dehydrate:c=jl,panelWrapper:v=Xf}=r,p=Ei(),f=(e=Ja(y=>Fe(y,n)))!==null&&e!==void 0?e:eg,[g,b]=m.useState(!1),[w,T]=m.useState(!1),[P,F]=m.useState(),[G]=m.useState((t=f==null?void 0:f.closed)!==null&&t!==void 0?t:[]),[ee,Y]=m.useState(a.getReactChildren()),N=m.useMemo(()=>new Map,[]),$=m.useMemo(()=>new Map,[]),ne=m.useCallback(function(y,S){var _,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;cr.debug2("registerComponent",y,S,K,re);function ot(X,ae){var ce=S,$e=v,_t=Ls(ce),{glContainer:yt,glEventHub:Kr}=X,Nn=x.getIdFromContainer(yt);return d.jsx(Nf,{glContainer:yt,glEventHub:Kr,children:d.jsx(Ri.Provider,{value:Nn,children:d.jsx($e,Rn(Rn({},X),{},{children:_t?d.jsx(ce,Rn(Rn({},X),{},{ref:ae})):d.jsx(ce,Rn({},X))}))})})}ot.displayName="DashboardWrapper(".concat((_=S.displayName)!==null&&_!==void 0?_:y,")");var I=a.registerComponent(y,R.forwardRef(ot));return N.set(y,K),$.set(y,re),I},[h,c,N,$,a,v]),q=m.useCallback((y,S)=>{var _;return((_=N.get(y))!==null&&_!==void 0?_:Ta)(S,n)},[N,n]),j=m.useCallback((y,S)=>{var _;return((_=$.get(y))!==null&&_!==void 0?_:Ta)(S,n)},[$,n]),z=m.useMemo(()=>new Li(a,q,j,new Map,G,y=>{var{closed:S,openedMap:_}=y;p(Yt(n,{closed:S,openedMap:_}))}),[j,p,q,n,G,a]),W=Xd(y=>{var S=P==null||!x.isEqual(P,y);cr.debug("handleLayoutStateChanged",S,y),S&&(b(a.root.contentItems.length===0),F(y),l(y),Y(a.getReactChildren()))},ng,{flushOnUnmount:!0});m.useEffect(()=>()=>W.flush(),[W]);var A=m.useCallback(()=>{if(!w){var y=a.toConfig(),S=y.content,_=x.dehydrateLayoutConfig(S,j);W(_)}},[j,w,a,W]),B=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DRAGGING,S),T(!0)},[a.eventHub]),V=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DROPPED,S),T(!1)},[a.eventHub]),pe=m.useCallback(y=>{if(cr.debug2("handleComponentCreated",y),!(y==null||y.config==null||!Wt(y.config)||y.config.component==null||y.element==null)){var S=y.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),_="".concat(S,"-component");y.element.addClass(_)}},[]),Ge=m.useCallback(()=>{Y(a.getReactChildren())},[a]);Ae(a,"stateChanged",A),Ae(a,"itemPickedUp",B),Ae(a,"itemDropped",V),Ae(a,"componentCreated",pe),Ae(a.eventHub,ie.TITLE_CHANGED,A),Ae(a,"reactChildrenChanged",Ge);var Ne=qd(s);return m.useEffect(function(){if(Ne!==s&&s!==P){cr.debug("Setting new layout content...");for(var S=x.hydrateLayoutConfig(s,q);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var _=0;_<S.length;_+=1)a.root.addChild(S[_]);b(a.root.contentItems.length===0)}},[q,a,s,P,z,Ne]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,ee,R.Children.map(i,y=>y!=null?d.jsx(Kh,{fallback:[],children:R.cloneElement(y,{id:n,layout:a,panelManager:z,registerComponent:ne})}):null)]})}var Ul=m.createContext(null);Ul.displayName="DashboardIdContext";function dC(){var r=m.useContext(Ul);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function rg(r,e,t){return(e=ig(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ig(r){var e=og(r,"string");return typeof e=="symbol"?e:e+""}function og(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Wl(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=Wl(n,e,t);if(i)return i;n=n.sibling}}}function ag(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}var Fi=ag(m.createContext(null));Fi.displayName="FiberContext";class hC extends m.Component{constructor(){super(...arguments),rg(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Fi.Provider,{value:this._reactInternals,children:e})}}function sg(){var r=m.useContext(Fi);if(r===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>wt()),t=m.useMemo(()=>{for(var n of[r,r==null?void 0:r.alternate].filter(o=>o!=null)){var i=Wl(n,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e]);return t}var cC="default",lg="CREATE_DASHBOARD",ug="CLOSE_DASHBOARD",{listen:mC,emit:vC,useListener:pC}=Zt(lg),{listen:fC,emit:dg,useListener:gC}=Zt(ug);function hg(r,e,t){return(e=cg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cg(r){var e=mg(r,"string");return typeof e=="symbol"?e:e+""}function mg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vl extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,{glContainer:n}=this.props;return[...(e=n==null||(t=n.tab)===null||t===void 0||(t=t.header)===null||t===void 0?void 0:t.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,o,a,s;if(((i=t[n].contentItem)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.id)===((o=e.tab)===null||o===void 0||(o=o.contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id))break;(a=((s=t[n])===null||s===void 0?void 0:s.contentItem).container)===null||a===void 0||a.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(ie.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var o,a,s;if(((o=t[i].contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(a=a.contentItem)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.id))break;var l=!!(!((s=t[i])===null||s===void 0||(s=s.contentItem)===null||s===void 0||(s=s.config)===null||s===void 0)&&s.isClosable);if(l){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,o=!!(!((i=e[n])===null||i===void 0||(i=i.contentItem)===null||i===void 0||(i=i.config)===null||i===void 0)&&i.isClosable);if(o){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:n,glContainer:i}=this.props,o=(e=x.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=n.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:n}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:te.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var o=(e=n.tab)===null||e===void 0||(e=e.contentItem)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.isClosable;return i.push({title:"Close",order:10,group:te.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:te.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:te.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(te,{actions:i})}}hg(Vl,"defaultProps",{additionalActions:[]});var vg=r=>({workspace:Xs(r)}),pg=In(vg,{setWorkspace:Ys})(Vl);function Kl(r,e,t){return(e=fg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fg(r){var e=gg(r,"string");return typeof e=="symbol"?e:e+""}function gg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zl extends m.PureComponent{constructor(e){super(e),Kl(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=R.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;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.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:o}=this.state;return d.jsxs("form",{className:Z("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[d.jsxs("div",{className:"form-group",children:[d.jsxs("label",{htmlFor:"rename-dialog-".concat(n,"-input"),children:["Rename ",n]}),d.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}),d.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(oe,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(oe,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Nr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Kl(zl,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var mr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function _a(r,e,t){return(e=bg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bg(r){var e=yg(r,"string");return typeof e=="symbol"?e:e+""}function yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Cg=U.module("Panel");class Sg extends m.PureComponent{constructor(e){super(e),_a(this,"ref",void 0),_a(this,"getAdditionalActions",Gt((n,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...n]})),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.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=R.createRef();var{glContainer:t}=this.props;this.state={title:x.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,{componentPanel:t,glContainer:n,glEventHub:i}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),i.on(mr.focus,this.handleTabFocus),i.on(mr.blur,this.handleTabBlur),i.emit(ie.MOUNT,t??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(e=e.parentElement)===null||e===void 0?void 0:e.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(mr.focus,this.handleTabFocus),n.off(mr.blur,this.handleTabBlur),n.emit(ie.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:x.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(ie.FOCUS,t??this);var{onFocus:i}=this.props;i==null||i(e)}handleBlur(e){var{onBlur:t}=this.props;t==null||t(e)}handleHide(){for(var{onHide:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleResize(){for(var{onResize:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}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=x.getRootFromContainer(t),i=x.getComponentConfigFromContainer(t);L(i),x.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=x.getRootFromContainer(e),i=x.getComponentConfigFromContainer(e);if(i==null){Cg.error("Could not get component config from container",e);return}var o=x.cloneComponent(n,i);o!==null&&t.emit(ie.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:te.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:te.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,glEventHub:o,additionalActions:a=ys,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:v}=i,{showRenameDialog:p,title:f,isWithinPanel:g}=this.state;return d.jsxs("div",{className:Z("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(hn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Mr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(pg,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,h,c)}),c&&d.jsx(zl,{isShown:p,value:f,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var wg=Us(Sg),Eg=U.module("useDhId"),ti="__dhId";function bC(){var r,e,t=(r=(e=sg())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[ti],i=Zf();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(ti," to be a string, but got ").concat(typeof n));return n}return i??(Eg.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ti," prop. Defaulting to null.")),null)}function nr(r,e,t){return(e=Pg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pg(r){var e=Tg(r,"string");return typeof e=="symbol"?e:e+""}function Tg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Me{}nr(Me,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");nr(Me,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");nr(Me,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");nr(Me,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");nr(Me,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function Qt(r,e,t){return(e=_g(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _g(r){var e=Og(r,"string");return typeof e=="symbol"?e:e+""}function Og(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Pt{}Qt(Pt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Qt(Pt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Qt(Pt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Qt(Pt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Qt(Pt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Qt(Pt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Qt(Pt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Qt(Pt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const yC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function At(r,e,t){return(e=xg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xg(r){var e=Ig(r,"string");return typeof e=="symbol"?e:e+""}function Ig(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class J{}At(J,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");At(J,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");At(J,"CLOSE_FILE","NotebookEvent.closeFile");At(J,"RENAME","NotebookEvent.rename");At(J,"RENAME_FILE","NotebookEvent.renameFile");At(J,"REGISTER_FILE","NotebookEvent.registerFile");At(J,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");At(J,"UNREGISTER_FILE","NotebookEvent.unregisterFile");At(J,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Dg=["children"];function Oa(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 xa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(n){kg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kg(r,e,t){return(e=Mg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mg(r){var e=Ng(r,"string");return typeof e=="symbol"?e:e+""}function Ng(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function jg(r,e){if(r==null)return{};var t,n,i=Ag(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function Ag(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}class Lg extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(Me.SESSION_CLOSED,this.handleSessionClosed),e.on(Me.SESSION_OPENED,this.handleSessionOpened),e.on(Pt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.SESSION_CLOSED,this.handleSessionClosed),e.off(Me.SESSION_OPENED,this.handleSessionOpened),e.off(Pt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var{onClearAllFilters:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n==null||n(e,t)}render(){var e=this.props,{children:t}=e,n=jg(e,Dg);return d.jsx(wg,xa(xa({},n),{},{children:t}))}}var rr=Us(Lg);const CC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Rg=Object.freeze({}),Fg=new Map,Hr=Object.freeze([]),SC=(r,e)=>{var t;return(t=Fe(r,e).columns)!==null&&t!==void 0?t:Hr},wC=(r,e)=>{var t;return(t=Fe(r,e).filterSets)!==null&&t!==void 0?t:Hr},EC=(r,e)=>{var t;return(t=Fe(r,e).filters)!==null&&t!==void 0?t:Hr},PC=(r,e)=>{var t;return(t=Fe(r,e).tableMap)!==null&&t!==void 0?t:Fg},TC=(r,e)=>Fe(r,e).isolatedLinkerPanelId,Gl=(r,e)=>{var t;return(t=Fe(r,e).links)!==null&&t!==void 0?t:Hr},_C=(r,e)=>Fe(r,e).columnSelectionValidator,OC=(r,e)=>{var t;return(t=Fe(r,e).consoleSettings)!==null&&t!==void 0?t:Rg},xC=(r,e)=>Fe(r,e).connection,ir=(r,e)=>Fe(r,e).sessionWrapper,IC=(r,e)=>t=>t(Yt(r,{connection:e})),DC=(r,e)=>t=>t(Yt(r,{sessionWrapper:e})),ql=(r,e)=>t=>t(Yt(r,{links:e})),kC=(r,e)=>(t,n)=>{var i=Gl(n(),r),o=e.filter(a=>i.findIndex(s=>Kn(s.start,a.start)&&Kn(s.end,a.end))<0);return t(ql(r,i.concat(o)))},MC=(r,e)=>(t,n)=>{var i=Gl(n(),r),o=i.filter(a=>!e.includes(a.id));return t(ql(r,o))},NC=(r,e)=>t=>t(Yt(r,{isolatedLinkerPanelId:e})),jC=(r,e)=>t=>t(Yt(r,{columnSelectionValidator:e})),$g=(r,e)=>t=>t(Yt(r,{consoleSettings:e})),AC=(r,e)=>t=>t(Yt(r,{filterSets:e}));function Dr(r,e,t){return(e=Hg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hg(r){var e=Bg(r,"string");return typeof e=="symbol"?e:e+""}function Bg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var vr=U.module("CommandHistoryPanel");class or extends m.Component{static handleError(e){vr.error(e)}constructor(e){super(e),Dr(this,"container",void 0),Dr(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=R.createRef(),this.pending=new Zn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:We.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Me.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.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(vr.debug("handleSendToNotebook",n,e),!n){vr.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?J.CREATE_NOTEBOOK:J.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;vr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Me.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;L(t),L(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(or.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(rr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&d.jsxs(d.Fragment,{children:[d.jsx(Ue,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:n}),d.jsx(te,{actions:o})]})]})}}Dr(or,"COMPONENT","CommandHistoryPanel");Dr(or,"TITLE","Command History");var Ug=(r,e)=>{var t=Gs(r),n=ir(r,e.localDashboardId),{session:i,config:o}=n??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Wg=In(Ug,null,null,{forwardRef:!0})(or),Xl=m.createContext(null);Xl.displayName="PluginsContext";var Mn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function Vg(r){return"DashboardPlugin"in r}function Kg(r){return"AuthPlugin"in r}function zg(r){return"TablePlugin"in r}function LC(r){return Vg(r)||Kg(r)||zg(r)}function Gg(r){return"type"in r&&r.type===Mn.DASHBOARD_PLUGIN}function $i(r){return"type"in r&&r.type===Mn.WIDGET_PLUGIN}function qg(r){return"type"in r&&r.type===Mn.TABLE_PLUGIN}function Xg(r){return"type"in r&&r.type===Mn.AUTH_PLUGIN}function Zl(r){return"type"in r&&r.type===Mn.THEME_PLUGIN}function Yl(r){return"type"in r&&r.type===Mn.ELEMENT_PLUGIN}function RC(r){return Gg(r)||Xg(r)||qg(r)||Zl(r)||$i(r)||Yl(r)}var Ql=U.module("@deephaven/plugin.PluginUtils");function Ia(r,e){return r==null||!$i(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function Zg(r){var e=d.jsx(ve,{icon:ls});if(!$i(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function FC(r){var e=[...r.entries()].filter(t=>Zl(t[1]));return Ql.debug("Getting theme data from plugins",e),e.map(t=>{var[n,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:u}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Zu(n,s),name:s,styleContent:u}})}).flat()}function $C(r){var e=[...r.entries()].filter(t=>Yl(t[1])&&t[1].mapping!=null);return Ql.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function HC(){return Yn(Xl,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Jl=m.createContext(null);Jl.displayName="PersistentStateContext";function BC(r){var{initialState:e,onChange:t,children:n}=r,[i,o]=R.useState(0),a=m.useRef({initial:e,initialStateMap:new Map,state:new Map,isTracking:!0}),s=m.useCallback((v,p)=>{a.current.isTracking&&a.current.state.set(v,p)},[]),l=m.useCallback(()=>{a.current.isTracking||(a.current.isTracking=!0,a.current.state=new Map,o(v=>v+1))},[]),u=m.useRef(a.current.initial[Symbol.iterator]()),h=m.useCallback(function(p){var f=a.current.initialStateMap.get(p);if(f)return f;var{value:g,done:b}=u.current.next(),w={value:g,done:b??!1};return a.current.initialStateMap.set(p,w),w},[]);m.useEffect(function(){a.current.isTracking&&(t([...a.current.state.values()]),a.current.isTracking=!1)},[i,t]);var c=m.useMemo(()=>({addState:s,scheduleStateUpdate:l,getInitialState:h,updateId:i}),[s,h,l,i]);return d.jsx(Jl.Provider,{value:c,children:n})}function Da(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 pr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Da(Object(t),!0).forEach(function(n){ln(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Da(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ln(r,e,t){return(e=Yg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yg(r){var e=Qg(r,"string");return typeof e=="symbol"?e:e+""}function Qg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fr=U.module("ConsolePanel"),Jg=500,eb=Object.freeze({consoleSettings:{},itemIds:[]});class Br extends m.PureComponent{constructor(e){super(e),ln(this,"consoleRef",void 0),ln(this,"objectSubscriptionCleanup",void 0),ln(this,"savePanelState",dn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};fr.debug("Saving panel state",l),this.setState({panelState:l})},Jg)),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=R.createRef();var{panelState:t}=e,n=pr(pr({},eb),t||{}),{consoleSettings:i,itemIds:o}=n;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(ie.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(ie.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=>{fr.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,u=[...a,...l],h=new Map(o);u.forEach(v=>{var{title:p}=v;p!==void 0&&h.delete(p)});var c=[...a,...s];return c.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,o=new Map(i);return o.set(e,t),{itemIds:o}})}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=wt(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,{itemIds:i}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(n=e.props)===null||n===void 0||(n=n.metadata)===null||n===void 0?void 0:n.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Me.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;L(this.context);var{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.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(ie.CLOSE,n),dg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;fr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Me.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;L(n);var{config:i,session:o}=n,{title:a=e.name}=e;L(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:pr(pr({},hc(e)),{},{sessionId:i.id})};fr.debug("openWidget",l),Ef(t,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 o=[...n.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(ie.CLOSE,s)}),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=>Ia(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Ia(i,e));return n!=null?Zg(n):d.jsx(Qs,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(hn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:h,session:c,connection:v,details:p={},dh:f}=i,{workerName:g,processInfoId:b}=p,{id:w,type:T}=h;return d.jsx(rr,{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&&d.jsx(zt,{dh:f,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:T,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:el.LANGUAGE_MAP.get(T)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),b,d.jsx("div",{children:"•"})]}),d.jsx(vp,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:w,timeZone:o,objectMap:u,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}ln(Br,"COMPONENT","ConsolePanel");ln(Br,"TITLE","Console");ln(Br,"contextType",Ll);var tb=(r,e)=>({commandHistoryStorage:Gs(r),sessionWrapper:ir(r,e.localDashboardId),timeZone:bc(r),plugins:yc(r)}),ni=In(tb,null,null,{forwardRef:!0})(Br);function UC(r){return r==="file"||r==="directory"}function ft(r){return r.type==="directory"}function nb(r,e,t){return(e=rb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rb(r){var e=ib(r,"string");return typeof e=="symbol"?e:e+""}function ib(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hi extends Error{constructor(){super("No file exists at the path specified"),nb(this,"isFileNotFound",!0)}}function ka(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Ma(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ka(o,n,i,a,s,"next",l)}function s(l){ka(o,n,i,a,s,"throw",l)}a(void 0)})}}var rn=function(r){return 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="",r}({});class M{static fileExists(e,t){return Ma(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Hi))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(!M.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 o=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getUniqueCopyFileName(e,t){return Ma(function*(){for(var n=M.getCopyFileName(t);yield M.fileExists(e,n);)n=M.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return rn.GROOVY;case"py":return rn.PYTHON;case"pyc":return rn.PYTHON_COMPILED;case"scala":return rn.SCALA;case"txt":return rn.PLAIN_TEXT;default:return rn.UNKNOWN}}static getParent(e){if(!M.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(!M.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,o=M.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Un("Name cannot be empty");if(t.includes(e))throw new Un('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,a;throw new Un('Invalid characters in name: "'.concat((o=(a=e.match(n))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(n=>M.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)}}var Bi=26;function Si(r){return ft(r)?M.makePath(r.filename):M.getPath(r.filename)}function Na(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=Si(e);if(r.some(n=>{var{filename:i}=n;return M.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>ft(n)&&t.startsWith(M.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function ob(r){if(ft(r))return r.isExpanded?Yu:Qu;var e=M.getMimeType(r.basename);switch(e){case rn.PYTHON:return ed;default:return Ju}}function wi(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:h,onDragOver:c,onDragEnd:v,onDragExit:p,onDrop:f}=r,g=(e=n==null?void 0:n.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,b=Si(s),w=i&&u?Si(u):null,T=i&&o&&ft(s)&&w===b,P=i&&o&&w===b,F=i&&!o&&w===b,G=ob(s),ee=M.getDepth(s.filename),Y=Array(ee).fill(null).map((N,$)=>d.jsx("span",{className:"file-list-depth-line"},$));return d.jsxs("div",{className:Z("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":T,"is-in-drop-target":P,"is-invalid-drop-target":F,"is-selected":a}),onDragStart:N=>h(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>v(l,N),onDragExit:p,onDrop:N=>f(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:G,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function ja(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 gr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(n){ab(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ab(r,e,t){return(e=sb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sb(r){var e=lb(r,"string");return typeof e=="symbol"?e:e+""}function lb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var He=U.module("FileList"),ub=500,Aa="item-list-scroll-pane";function db(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=wi,rowHeight:l=Bi,overscanCount:u=gt.DEFAULT_OVERSCAN}=r,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,p]=m.useState({top:0,bottom:0}),[f,g]=m.useState(),[b,w]=m.useState(),[T,P]=m.useState(),[F,G]=m.useState([]),ee=m.useRef(),Y=m.useRef(null),N=m.useRef(null),$=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var X=[],ae=0;ae<I.length;ae+=1)for(var ce=I[ae],$e=ce[0];$e<=ce[1];$e+=1)$e>=h.offset&&$e<h.offset+h.items.length&&X.push(h.items[$e-h.offset]);return X},[h]),ne=m.useCallback(I=>{var X=$([[I,I]]);if(X.length>0)return X[0]},[$]),q=m.useCallback(()=>{var I=mt.count(F);if(I===0)return null;if(I===1){var X=F[0][0],ae=ne(X);if(ae!=null)return ae.filename}return"".concat(I," items")},[ne,F]),j=m.useCallback(I=>{if(!(!b||!f)){He.debug("dropItems",b,"to",I);try{var{files:X,targetPath:ae}=Na(b,f);if(i==null||i(X,ae),I!=null){var ce;G([[I,I]]),(ce=Y.current)===null||ce===void 0||ce.focusItem(I)}}catch($e){He.error("Unable to complete move",$e)}}},[b,f,i]),z=m.useCallback((I,X)=>{var ae=h.items[I-h.offset];ae!==void 0&&(He.debug("handleItemClick",ae),o(ae,X),ft(ae)&&(t==null||t.setExpanded(ae.filename,!ae.isExpanded)))},[h,o,t]),W=m.useCallback((I,X)=>{var ae,ce;He.debug2("handleItemDragStart",I,F);var $e=F;mt.isSelected(F,I)||($e=[[I,I]],G($e)),w($($e)),(ae=Y.current)===null||ae===void 0||ae.resetMouseState();var _t=document.createElement("div"),yt=document.createElement("div");yt.className="dnd-placeholder-content",yt.innerText=(ce=q())!==null&&ce!==void 0?ce:"",_t.appendChild(yt),_t.className="file-list-dnd-placeholder",document.body.appendChild(_t),X.dataTransfer.setDragImage(_t,0,0),X.dataTransfer.effectAllowed="move",P(_t)},[q,$,F]),A=m.useCallback((I,X)=>{X.preventDefault(),He.debug2("handleItemDragOver",X),g(ne(I))},[ne]),B=m.useCallback((I,X)=>{He.debug("handleItemDragEnd",I),T==null||T.remove(),w(void 0),g(void 0),P(void 0)},[T]),V=m.useCallback((I,X)=>{j(I)},[j]),pe=m.useCallback(()=>{He.debug2("handleItemDragExit"),g(void 0)},[]),Ge=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Aa)&&(I.preventDefault(),He.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Ne=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Aa)&&(He.debug("handleListDrop"),j())},[j]),y=m.useCallback(function(I){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(He.debug2("handleSelectionChange",I),X===!0||I!==F){G(I);var ae=$(I);a(ae)}},[$,a,F]),S=m.useCallback(I=>{if(He.debug2("handleFocusChange",I),I!=null){var[X]=$([[I,I]]);n(X)}else n();ee.current=I},[$,n]),_=m.useCallback((I,X)=>{He.debug("handleViewportChange",I,X),(I!==v.top||X!==v.bottom)&&p({top:I,bottom:X})},[v]),K=m.useMemo(()=>{if(!b||!f)return!1;try{return Na(b,f),He.debug("handleValidateDropTarget true"),!0}catch{return He.debug("handleValidateDropTarget false"),!1}},[b,f]),{focusedPath:re}=r;m.useEffect(()=>{re!==void 0&&(re==="/"?t.collapseAll():(t.setExpanded(re,!1),t.setExpanded(re,!0)))},[t,re]),m.useEffect(function(){He.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-u),bottom:v.bottom+u})},[u,t,v]),m.useEffect(function(){var X=t.onUpdate(ae=>{c({items:ae.items.map(ce=>gr(gr({},ce),{},{itemName:ce.basename})),offset:ae.offset,itemCount:t.size})});return()=>{X()}},[t]),m.useEffect(function(){ee.current!=null&&S(ee.current),F.length>0&&y(F,!0)},[h,S,y,F]),m.useEffect(function(){if(f!=null&&ft(f)&&f.filename!=="/"){var X=setTimeout(()=>{f.isExpanded||t==null||t.setExpanded(f.filename,!0)},ub);return()=>clearTimeout(X)}},[f,t]);var ot=m.useCallback(I=>s(gr(gr({},I),{},{isDragInProgress:b!=null,dropTargetItem:f,draggedItems:b,isDropTargetValid:K,onDragStart:W,onDragEnd:B,onDragOver:A,onDragExit:pe,onDrop:V})),[B,pe,A,W,V,b,f,K,s]);return d.jsx("div",{ref:N,className:Z("file-list",{"is-dragging":b!=null}),onDragOver:Ge,onDrop:Ne,children:d.jsx(gt,{ref:Y,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:S,onSelect:z,onSelectionChange:y,onViewportChange:_,selectedRanges:F,renderItem:ot,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var hb={DELETE:de.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[O.DELETE],macShortcut:[D.CMD,O.BACKSPACE]}),RENAME:de.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[O.ENTER],macShortcut:[O.ENTER]})};const La={FILE_EXPLORER:hb};var Ra=U.module("FileListItemEditor"),cb=()=>Promise.resolve();function mb(r){var{item:e,onCancel:t,onSubmit:n,validate:i=cb}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[h,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var T;(T=o.current)===null||T===void 0||T.focus()},[o]),p=m.useCallback(T=>T.stopPropagation(),[]),f=m.useCallback(()=>{h.then(()=>{n(a)}).catch(T=>Ra.info("Unable to validate name",T))},[n,a,h]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>u(void 0)).catch(F=>{Te.isCanceled(F)||u(F)}),c(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{Ra.debug2("handleBlur"),f()},[f]),b=m.useCallback(T=>{var{value:P}=T.target;s(P)},[]),w=m.useCallback(T=>{T.stopPropagation();var{key:P}=T;switch(P){case"Enter":{f();break}case"Escape":{t();break}}},[t,f]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:Z("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Fa(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 ri(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(n){vb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function vb(r,e,t){return(e=pb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pb(r){var e=fb(r,"string");return typeof e=="symbol"?e:e+""}function fb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function eu(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:h,onSelectionChange:c,table:v,rowHeight:p=Bi,validateRename:f=()=>Promise.resolve()}=r,[g,b]=m.useState(),[w,T]=m.useState([]),[P,F]=m.useState(),G=m.useCallback(V=>{T(V),c==null||c(V)},[c]),ee=m.useCallback(V=>{F(V)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),N=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),$=m.useCallback(()=>{i==null||i()},[i]),ne=m.useCallback(()=>{P&&(o==null||o(M.getPath(P.filename)))},[P,o]),q=m.useCallback(()=>{P&&b(P)},[P]),j=m.useCallback(()=>{b(void 0)},[]),z=m.useCallback(V=>{g&&(u==null||u(g,V),b(void 0))},[u,g]),W=m.useMemo(()=>{if(g)return[];var V=[];return i&&V.push({title:"New File",description:"Create new file",action:$,group:te.groups.medium}),o&&V.push({title:"New Folder",description:"Create new folder",action:ne,group:te.groups.medium}),a&&V.push({title:"Copy File",description:"Copy the selected file",action:Y,group:te.groups.low,disabled:P==null||ft(P)}),s&&w.length>0&&V.push({title:"Delete",description:"Delete",shortcut:La.FILE_EXPLORER.DELETE,action:N,group:te.groups.low}),u&&V.push({title:"Rename",description:"Rename",shortcut:La.FILE_EXPLORER.RENAME,action:q,group:te.groups.low,disabled:P==null}),V},[Y,N,$,ne,q,P,a,i,o,s,u,w,g]),A=m.useCallback(V=>(L(g),f(g,V)),[g,f]),B=m.useCallback(V=>{var{item:pe}=V;return g&&g.filename===pe.filename?d.jsx(wi,ri(ri({},V),{},{children:d.jsx(mb,{item:pe,validate:A,onSubmit:z,onCancel:j})})):d.jsx(wi,ri({},V))},[j,z,g,A]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(db,{onMove:l,onSelect:h,onSelectionChange:G,onFocusChange:ee,renderItem:B,rowHeight:p,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(te,{actions:W})]})}eu.displayName="FileListContainer";function $a(r,e,t){return(e=gb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gb(r){var e=bb(r,"string");return typeof e=="symbol"?e:e+""}function bb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Sr extends Un{constructor(e){super("Name already exists"),$a(this,"isExistingFile",!0),$a(this,"info",void 0),this.info=e}}function Ha(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.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 o=r.apply(e,t);function a(l){Ha(o,n,i,a,s,"next",l)}function s(l){Ha(o,n,i,a,s,"throw",l)}a(void 0)})}}var Ct=U.module("FileExplorer");function Ui(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:h,rowHeight:c=Bi}=r,[v,p]=m.useState([]),[f,g]=m.useState();m.useEffect(function(){var z;function W(){return A.apply(this,arguments)}function A(){return A=Ba(function*(){Ct.debug("initTable"),z=Te.makeCancelable(e.getTable(),B=>B.close());try{g(yield z)}catch(B){Te.isCanceled(B)||Ct.error("Unable to initialize table",B)}}),A.apply(this,arguments)}return W(),()=>{z.cancel()}},[e]);var b=m.useCallback(j=>{Te.isCanceled(j)||Ct.error(j)},[]),w=m.useCallback(()=>{Ct.debug("handleCreateFile"),s()},[s]),T=m.useCallback(()=>{Ct.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(j=>{Ct.debug("handleCopyFile",j.filename),i(j)},[i]),F=m.useCallback(j=>{Ct.debug("handleDelete, pending confirmation",j),p(j)},[]),G=m.useCallback(()=>{Ct.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(ft(j)?M.makePath(j.filename):j.filename)),o(v),p([])},[v,o,e]),ee=m.useCallback(()=>{Ct.debug("handleDeleteCancel"),p([])},[]),Y=m.useCallback((j,z)=>{var W=M.reducePaths(j.map(A=>ft(A)?M.makePath(A.filename):A.filename));W.forEach(A=>{var B=M.isPath(A)?"".concat(z).concat(M.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(z).concat(M.getBaseName(A));e.moveFile(A,B).then(()=>{a(A,B)}).catch(b)})},[b,a,e]),N=m.useCallback((j,z)=>{var W=j.filename,A=ft(j);A&&!W.endsWith("/")&&(W="".concat(W,"/"));var B="".concat(M.getParent(W)).concat(z);A&&!B.endsWith("/")&&(B="".concat(B,"/")),Ct.debug2("handleRename",W,B),e.moveFile(W,B).catch(b),a(W,B)},[b,a,e]),$=m.useCallback(function(){var j=Ba(function*(z,W){if(W!==z.basename){M.validateName(W);var A="".concat(M.getPath(z.filename)).concat(W);try{var B=yield e.info(A);throw new Sr(B)}catch(V){if(!(V instanceof Hi))throw V}}});return function(z,W){return j.apply(this,arguments)}}(),[e]),ne=v.length>0,q=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return d.jsxs("div",{className:"file-explorer",children:[f&&d.jsx(eu,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:T,onCreateFile:w,onMove:Y,onDelete:F,onRename:N,onSelect:u,onSelectionChange:h,rowHeight:c,table:f,validateRename:$}),d.jsx(zn,{isOpen:ne,headerText:q,bodyText:"You cannot undo this action.",onCancel:ee,onConfirm:G,confirmButtonText:"Delete"})]})}Ui.displayName="FileExplorer";function Ua(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function yb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ua(o,n,i,a,s,"next",l)}function s(l){Ua(o,n,i,a,s,"throw",l)}a(void 0)})}}function on(r,e,t){return(e=Cb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cb(r){var e=Sb(r,"string");return typeof e=="symbol"?e:e+""}function Sb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Jt=U.module("NewItemModal");class un extends m.PureComponent{static getValidationMessage(e){return e instanceof Sr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||Jt.error(e)}constructor(e){super(e),on(this,"inputRef",R.createRef()),on(this,"cancelableValidatePromise",void 0),on(this,"cancelableExistingItemPromise",void 0),on(this,"pending",new Zn),on(this,"pathMap",new Map),on(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=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.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=Te.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return yb(function*(){M.validateName(t);var{defaultValue:o,storage:a}=i.props;if(n){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Sr(l)}catch(u){if(!(u instanceof Hi))throw u}}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(Jt.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,n=M.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 Un))throw e;Jt.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;Jt.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){Jt.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=M.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Jt.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:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;Jt.debug("submitModal",n,i);var l=M.getExtension(i);return a&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(u=>{if(u instanceof Sr&&s!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw Te.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).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 o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(n,"/"),d.jsxs(R.Fragment,{children:[d.jsx(oe,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:td,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:h,validationError:c,value:v,prevExtension:p,newExtension:f}=this.state,g=a==="directory",b=M.fileExtensionToString(p),w=M.fileExtensionToString(f),T=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(rs,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(is,{toggle:n,children:o}),d.jsx(os,{children:d.jsx("form",{children:d.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[d.jsxs("div",{className:"flex-grow-0 mb-4",children:[d.jsx("label",{htmlFor:"file-name-input",children:P}),d.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Z("form-control",{"is-invalid":c}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:un.getValidationMessage(c)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(Ui,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(ks,{children:[d.jsx(oe,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(oe,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:T})]})]}),d.jsx(zn,{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"}),d.jsx(zn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}on(un,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function wb(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(oe,{kind:"ghost",icon:fs,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(oe,{kind:"ghost",icon:nd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx($s,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Wa(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Eb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Wa(o,n,i,a,s,"next",l)}function s(l){Wa(o,n,i,a,s,"throw",l)}a(void 0)})}}function tu(r,e,t){return(e=Pb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pb(r){var e=Tb(r,"string");return typeof e=="symbol"?e:e+""}function Tb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var en=U.module("FileExplorerPanel"),_b=(r,e)=>{var t=qs(r),n=ir(r,e.localDashboardId),{session:i,config:o}=n??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},Ob=In(_b,null,null,{forwardRef:!0});function xb(r){var e=r;return e!=null&&typeof e.button=="number"}class xn extends R.Component{static handleError(e){en.error(e)}static isFocusEvent(e){return xb(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:""};en.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){en.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){en.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(xn.handleError)}handleCopyFile(e){var t=this;return Eb(function*(){var{fileStorage:n}=t.props;if(ft(e)){en.error("Invalid item in handleCopyItem",e);return}var i=yield M.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(J.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(en.debug("fileSelect",e),e.type!=="directory"){var n=xn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(J.SELECT_NOTEBOOK,a,s,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;en.debug("handleRename",e,t),n.emit(J.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:o,focusedFilePath:a}=this.state;return d.jsxs(rr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(wb,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Ui,{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}),d.jsx(un,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}tu(xn,"COMPONENT","FileExplorerPanel");tu(xn,"TITLE","File Explorer");var Ib=Ob(xn);function Xn(r,e,t){return(e=Db(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Db(r){var e=kb(r,"string");return typeof e=="symbol"?e:e+""}function kb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Va=U.module("LogPanel");class Ur extends m.PureComponent{constructor(e){super(e),Xn(this,"isBottomVisible",void 0),Xn(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){Va.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Va.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return d.jsxs(rr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&d.jsx(Se,{session:n,ref:i=>{this.logView=i}})]})}}Xn(Ur,"defaultProps",{session:null});Xn(Ur,"COMPONENT","LogPanel");Xn(Ur,"TITLE","Log");var Mb=(r,e)=>{var t;return{session:(t=ir(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},Nb=In(Mb,null,null,{forwardRef:!0})(Ur);function Ka(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function br(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ka(o,n,i,a,s,"next",l)}function s(l){Ka(o,n,i,a,s,"throw",l)}a(void 0)})}}function za(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 Ye(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?za(Object(t),!0).forEach(function(n){Le(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):za(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Le(r,e,t){return(e=jb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jb(r){var e=Ab(r,"string");return typeof e=="symbol"?e:e+""}function Ab(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Lb=m.lazy(()=>bs(()=>import("./MarkdownNotebook-D0WtEaWY.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=U.module("NotebookPanel"),Ga=400;class Oe extends m.Component{static handleError(e){Te.isCanceled(e)||ue.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Oe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Oe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.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),Le(this,"pending",void 0),Le(this,"debouncedSavePanelState",void 0),Le(this,"debouncedLoad",void 0),Le(this,"notebook",void 0),Le(this,"tabTitleElement",void 0),Le(this,"tabInitOnce",void 0),Le(this,"editor",void 0),Le(this,"getSettings",Gt((v,p)=>Ye(Ye({},v),{},{minimap:{enabled:p}}))),Le(this,"getOverflowActions",Gt((v,p,f)=>{var g=[{title:"Find",icon:od,action:this.handleFind,group:te.groups.high,shortcut:We.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:as,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:ad,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:cs,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?En:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:We.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?En:void 0,action:this.handleWordWrapChange,group:te.groups.low,shortcut:We.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:te.groups.low,order:10}),g.push({title:"Format on Save",icon:f?En:void 0,action:this.handleFormatOnSaveChange,group:te.groups.low,order:15})),g})),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.handleFormatOnSaveChange=this.handleFormatOnSaveChange.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.handleFormat=this.handleFormat.bind(this),this.canFormat=this.canFormat.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Zn,this.debouncedSavePanelState=dn(this.savePanelState.bind(this),Ga),this.debouncedLoad=dn(this.load.bind(this),Ga),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var u=s!=null&&M.hasPath(s.itemName),h=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},ue.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(J.RENAME_FILE,this.handleRenameFile),t.on(ie.DROPPED,this.handlePanelDropped),e.on(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;n!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.notebookSettings.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(J.RENAME_FILE,this.handleRenameFile),e.off(ie.DROPPED,this.handlePanelDropped),t.off(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(J.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);L(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 o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){ue.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){ue.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(J.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:o}=i;n.emit(J.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(J.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;L(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(o=>{var a;ue.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:h}=u;this.renameTab(h,M.getBaseName(s))}var c=Ye(Ye({},t),{},{language:(a=Oe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.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){ue.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;ue.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:o,settings:a}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,u=Ye(Ye({},a),{},{value:s}),h=Ye(Ye({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return ue.debug("Saving panel state",c),{settings:u,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(J.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return br(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;L(o);var{language:s}=a,{itemName:l}=o,u=yield M.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var h={id:u,itemName:u},c={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return br(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:o}=e.state;ue.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(M.hasPath(o.itemName)&&(yield M.fileExists(t,o.itemName))?(i.emit(J.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){ue.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:n-1,savedChangeCount:i}:!a&&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{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={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:Ye(Ye({},t),{},{wordWrap:n})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};n(i)}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){ue.debug("Ignoring invalid notebook link",a);return}ue.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},u={id:a,itemName:a};s.emit(J.SELECT_NOTEBOOK,n,i,l,u)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Te.isCanceled(t)||(Te.isTimedOut(t)&&(t=new Error("File not found.")),ue.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return br(function*(){ue.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:n=!1}=t;n&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},o=(t=Oe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=Ye(Ye({},a.settings),{},{language:o});return ue.debug("handleSaveSuccess",i,s,l),s&&M.hasPath(s.itemName)&&s.itemName!==i.itemName&&(ue.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(Oe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Te.isCanceled(e)||(this.setState({savedChangeCount:0}),ue.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),ue.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(o)!==M.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?me.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return br(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield me.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(o)!==JSON.stringify(n)){a.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){ue.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){ue.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;ue.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){ue.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];ue.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){ue.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){ue.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 o=new URL(i,t);return new URL(e,o).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:o,sessionLanguage:a,settings:s}=this.state,l=Ye(Ye({},s),{},{language:t,value:n}),u={id:null,itemName:e};ue.debug("handleCreateNotebook",o,a,l,u),i.emit(J.CREATE_NOTEBOOK,o,a,l,u)}runCommand(e){if(e===void 0||e===""){ue.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Me.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{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:n}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",n??!1)}render(){var e,t,n,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:h,error:c,isDashboardActive:v,isLoaded:p,isLoading:f,isPreview:g,fileMetadata:b,session:w,sessionLanguage:T,settings:P,showCloseModal:F,showDeleteModal:G,showSaveAsModal:ee}=this.state,Y=v&&!o.isHidden&&!g,N=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:Oe.DEFAULT_NAME,$=N.endsWith(".md"),ne=(b==null?void 0:b.id)!=null,q=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),j=w!=null,z=T===q.language,W=!p||!j||!z,A=!p,B=[{action:this.handleSave,shortcut:Vt.SAVE},{action:this.handleMinimapChange,shortcut:We.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:We.NOTEBOOK.WORDWRAP}],V=vi.getDisabledRunTooltip(j,z,"Notebook extension","Run"),pe=vi.getDisabledRunTooltip(j,z,"Notebook extension","Run Selected"),Ge=[{title:ne?"Rename":"Save As…",order:10,group:te.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:te.groups.high,order:20}],Ne=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[Ne!=null&&Mr.createPortal(d.jsx("span",{className:Z(Oe.UNSAVED_INDICATOR_CLASS_NAME,{[Oe.UNSAVED_STATUS_CLASS_NAME]:u!==h})}),Ne),d.jsxs(rr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:Ge,renderTabTooltip:()=>N,children:[!$&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(oe,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:W,icon:d.jsx(ve,{icon:ps,transform:"grow-4"}),tooltip:"Run ".concat(We.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&d.jsx(he,{children:V})]}),d.jsxs("span",{children:[d.jsx(oe,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:W,icon:d.jsx(ve,{icon:rd,transform:"grow-4"}),tooltip:"Run Selected ".concat(We.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(oe,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:id,tooltip:"Save ".concat(Vt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(oe,{kind:"ghost",className:"btn-overflow",disabled:A,icon:vs,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(Qn,{actions:this.getDropdownOverflowActions,popperOptions:Oe.POPPER_OPTIONS})})]}),d.jsx(ml,{isLoaded:p,isLoading:f,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:T,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:q,focusOnMount:Y,ref:y=>{this.notebook=y}})]}),$&&d.jsx(m.Suspense,{fallback:d.jsx(hn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(Lb,{content:(n=q.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(un,{isOpen:ee,type:"file",defaultValue:N,title:ne?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(zn,{isOpen:G,headerText:'Are you sure you want to delete "'.concat(N,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(zn,{isOpen:F,headerText:"Do you want to save the changes you made to ".concat(N,"?"),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"}),d.jsx(te,{actions:B})]})]})}}Le(Oe,"COMPONENT","NotebookPanel");Le(Oe,"POPPER_OPTIONS",{placement:"bottom-end"});Le(Oe,"DEFAULT_NAME","Untitled");Le(Oe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Le(Oe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Le(Oe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var Rb=(r,e)=>{var t=qs(r),n=Zs(r),i=ir(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},tn=In(Rb,{updateNotebookSettings:Tc},null,{forwardRef:!0})(Oe);function Fb(){var{python:{linter:r={}}={}}=Vf(Zs),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function qa(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 Xa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qa(Object(t),!0).forEach(function(n){$b(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):qa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function $b(r,e,t){return(e=Hb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hb(r){var e=Bb(r,"string");return typeof e=="symbol"?e:e+""}function Bb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ge=U.module("ConsolePlugin");function Za(r){return r.notebook!==void 0}function Ub(r){If(r)}function WC(r){Ub(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:o,notebooksUrl:a}=r,s=m.useRef(0),[l,u]=m.useState(new Map),[h,c]=m.useState(new Map);Fb();var v=Ei(),p=m.useCallback(()=>i.getLastUsedPanelOfType(ni),[i]),f=m.useCallback((y,S)=>{u(_=>new Map(_.set(y,S)))},[u]),g=m.useCallback(y=>{u(S=>(S.delete(y),new Map(S)))},[u]),b=m.useCallback((y,S)=>{c(_=>new Map(_.set(y,S)))},[c]),w=m.useCallback(y=>{c(S=>(S.delete(y),new Map(S)))},[c]),T=m.useCallback(function(y){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,K=y&&y.trim();if(!K)ge.info("Ignoring empty code");else{var re=p();if(!re||!(re instanceof ni.WrappedComponent)){ge.error("Console panel not found");return}ge.debug("Send command: ",y,S,_),re.addCommand(y,S,_)}},[p]),P=m.useCallback(y=>{v($g(e,y))},[v,e]),F=m.useCallback(y=>{var{language:S}=y,_=S==="python"?"py":S,K=null;return _==null?(ge.debug("No extension for language",S),K="Untitled-".concat(s.current)):K="Untitled-".concat(s.current,".").concat(_),s.current+=1,K},[]),G=m.useCallback(function(y){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:_}=y;if(_!=null&&l.has(_))return l.get(_);if(_!=null&&h.has(_))return h.get(_);if(S)return wt()},[l,h]),ee=m.useCallback((y,S)=>{x.renameComponent(n.root,{id:y},S)},[n.root]),Y=m.useCallback((y,S)=>{ge.debug("Rename file panel",y,S);var _;if(l.has(y)&&(_=l.get(y),g(y),_!=null&&f(S,_)),h.has(y)&&(_=h.get(y),w(y),_!=null&&b(S,_)),_===void 0){ge.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}ee(_,M.getBaseName(S))},[l,h,ee,f,b,g,w]),N=m.useCallback(y=>{var S=G(y,!1);if(S==null){ge.error("Could not find panel id for file metadata",y);return}x.activateTab(n.root,{id:S})},[G,n.root]),$=m.useCallback((y,S,_)=>{if(ge.debug("registerFilePanel",y,S,_),S==null||S.id==null){ge.debug("Ignore empty file id",S);return}var{id:K}=S;if(_){b(K,y);return}if(l.has(K)){var re=l.get(K);if(y===re){ge.debug("Update tab title for file ".concat(K));var{itemName:ot}=S;Y(K,ot)}else ge.error("File ".concat(K," already associated with a different tab ").concat(re));return}f(K,y),h.has(K)&&w(K)},[l,h,Y,f,b,w]),ne=m.useCallback((y,S)=>{if(ge.debug("unregisterFileTab",y,S),y==null||y.id==null){ge.debug("Ignore empty file id",y);return}var{id:_}=y;if(S){w(_);return}g(_)},[g,w]),q=m.useCallback((y,S)=>{ge.debug("closeFilePanel",y);var{id:_}=y;if(_==null){ge.warn("File ID is null, ignore close event");return}var K=null,re=!1;if(l.has(_))K=l.get(_);else if(h.has(_))K=h.get(_),re=!0;else{ge.debug("File ".concat(_," isn't open, ignore close event"));return}ne(y,re),x.closeComponent(n.root,{id:K},S)},[n.root,l,h,ne]),j=m.useCallback(y=>{var{itemName:S}=y;return M.getBaseName(S)},[]),z=m.useCallback(y=>{var{id:S}=y;return ge.debug("fileIsOpen",y,S,l),S!=null&&l.has(S)},[l]),W=m.useCallback(y=>{var{id:S}=y;return ge.debug("fileIsOpenAsPreview",y,S,h),S!=null&&h.has(S)},[h]),A=m.useCallback(y=>{if(y!=null){var S=i.getOpenedPanelById(y);S&&Za(S)&&S.focus()}},[i]),B=m.useCallback(y=>{var{id:S,settings:_,fileMetadata:K,session:re,sessionLanguage:ot,isPreview:I=!1}=y,X={settings:_,fileMetadata:K},ae=j(K);return{type:"react-component",component:tn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:re,sessionLanguage:ot,panelState:X,isPreview:I,notebooksUrl:a},title:ae,id:S}},[j,e,a]),V=m.useCallback(function(y,S,_){var K=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(_)},re=G(K);if(z(K)&&re!=null){ge.debug("File is already open, focus panel"),N(K),A(re);return}if(re==null){ge.error("Panel ID for file metadata is null");return}var ot=x.getStackForComponentTypes(n.root,[tn.COMPONENT]),I=B({id:re,settings:_,fileMetadata:K,session:y,sessionLanguage:S});ge.debug("createNotebook",I,l),x.openComponentInStack(ot,I)},[z,A,F,G,n.root,B,l,N]),pe=m.useCallback(function(y,S,_,K){var re=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ge.debug("selectNotebook",K,re);var ot=z(K),I=W(K),[X]=[...h.values()],ae=!re,ce=ae&&X?X:G(K);if(ce==null||ce==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(K)));if(ot||I)N(K);else{var $e=x.getStackForComponentTypes(n.root,[tn.COMPONENT]),_t=B({id:ce,settings:_,fileMetadata:K,session:y,sessionLanguage:S,isPreview:ae});x.openComponentInStack($e,_t)}if(I&&re){var yt=K.id,Kr=x.getStackForConfig(n.root,{component:tn.COMPONENT,id:ce}),Nn=x.getContentItemInStack(Kr,{component:tn.COMPONENT,id:ce});yt!=null&&Nn&&Je(Nn)&&(Nn.container.emit(J.PROMOTE_FROM_PREVIEW),w(yt),f(yt,ce))}re&&A(ce)},[N,z,W,A,G,n.root,B,h,w,f]),Ge=m.useCallback(function(y,S){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},K=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,re=i.getLastUsedPanelOfType(tn);re&&Za(re)?_!=null&&_.value!=null&&re.notebook!=null&&re.notebook.append(_.value):K&&V(y,S,_)},[V,i]),Ne=m.useCallback((y,S)=>Rf.hydrate(Xa(Xa({},y),{},{notebooksUrl:a}),S),[a]);return Ln(o,ni,t),Ln(o,Wg),Ln(o,Ib),Ln(o,Nb),Ln(o,tn,Ne),Ae(n.eventHub,Me.SEND_COMMAND,T),Ae(n.eventHub,Me.SETTINGS_CHANGED,P),Ae(n.eventHub,J.CLOSE_FILE,q),Ae(n.eventHub,J.CREATE_NOTEBOOK,V),Ae(n.eventHub,J.SELECT_NOTEBOOK,pe),Ae(n.eventHub,J.RENAME,ee),Ae(n.eventHub,J.RENAME_FILE,Y),Ae(n.eventHub,J.SEND_TO_NOTEBOOK,Ge),Ae(n.eventHub,J.REGISTER_FILE,$),Ae(n.eventHub,J.UNREGISTER_FILE,ne),null}function Wr(r,e,t){return(e=Wb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wb(r){var e=Vb(r,"string");return typeof e=="symbol"?e:e+""}function Vb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vr{}Wr(Vr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Wr(Vr,"INPUT_FILTER","ControlType.INPUT_FILTER");Wr(Vr,"MARKDOWN","ControlType.MARKDOWN");Wr(Vr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{ir as $,Sy as A,oe as B,js as C,Ke as D,wy as E,ll as F,Ds as G,Re as H,Et as I,Zs as J,O as K,Tc as L,H as M,Vt as N,Gn as O,Te as P,ty as Q,wm as R,Bs as S,E as T,Vr as U,CC as V,Qn as W,Qs as X,jr as Y,Xs as Z,ly as _,vt as a,Pi as a$,xC as a0,yc as a1,Fe as a2,Kf as a3,Ey as a4,Pc as a5,Yt as a6,lC as a7,Bl as a8,Dy as a9,xy as aA,Iy as aB,IC as aC,DC as aD,Py as aE,Oy as aF,Ys as aG,_y as aH,me as aI,Qb as aJ,zd as aK,Yn as aL,Qd as aM,Gd as aN,Is as aO,xs as aP,qd as aQ,Xd as aR,mt as aS,gt as aT,Ns as aU,$s as aV,Kh as aW,Ar as aX,D as aY,ks as aZ,sh as a_,cC as aa,Rf as ab,cd as ac,Es as ad,J as ae,Pt as af,qy as ag,Zy as ah,Qy as ai,eC as aj,ie as ak,yC as al,mC as am,fC as an,tn as ao,Ef as ap,hc as aq,ys as ar,Nr as as,WC as at,te as au,zn as av,HC as aw,ky as ax,Ty as ay,My as az,Tt as b,We as b$,ey as b0,zh as b1,Ti as b2,ry as b3,Ls as b4,Us as b5,As as b6,Eh as b7,wr as b8,ac as b9,dv as bA,Wy as bB,Uy as bC,ki as bD,Vy as bE,dp as bF,ip as bG,hp as bH,zt as bI,Js as bJ,Ue as bK,_r as bL,zv as bM,Rr as bN,el as bO,Bc as bP,nl as bQ,Mc as bR,Pn as bS,tl as bT,Tn as bU,kv as bV,Er as bW,rl as bX,vp as bY,Se as bZ,ci as b_,Ks as ba,Vs as bb,Ws as bc,iy as bd,oy as be,ay as bf,Um as bg,Wm as bh,we as bi,Xm as bj,lv as bk,Q as bl,Jm as bm,ke as bn,Ny as bo,al as bp,sl as bq,Ly as br,$y as bs,jy as bt,Ay as bu,Ry as bv,rv as bw,Hy as bx,By as by,uv as bz,C as c,qg as c$,ml as c0,vi as c1,Cs as c2,x as c3,Ln as c4,Gy as c5,sC as c6,wg as c7,ug as c8,lg as c9,iC as cA,gC as cB,pC as cC,Xy as cD,Jy as cE,Yy as cF,tC as cG,dC as cH,bC as cI,Ae as cJ,Zf as cK,FC as cL,$i as cM,$C as cN,Jl as cO,BC as cP,Mn as cQ,Xl as cR,Zg as cS,Xg as cT,Gg as cU,Yl as cV,Kg as cW,Vg as cX,LC as cY,zg as cZ,RC as c_,ti as ca,Ul as cb,uC as cc,nC as cd,Ll as ce,Nf as cf,Ri as cg,Li as ch,Fl as ci,mr as cj,If as ck,jl as cl,dg as cm,vC as cn,oC as co,aC as cp,Hl as cq,Al as cr,xf as cs,Pf as ct,_f as cu,Tf as cv,Of as cw,zy as cx,Bf as cy,rC as cz,kn as d,Zl as d0,Ia as d1,Yb as d2,Yi as d3,wf as d4,Fr as d5,hC as d6,M as d7,Hi as d8,UC as d9,OC as dA,$g as dB,Fb as dC,Xb as dD,Jb as dE,Zb as dF,Gr as dG,gd as dH,zr as dI,Fy as dJ,Un as dK,ni as da,Nb as db,Wg as dc,Ib as dd,Ts as de,qb as df,rr as dg,_s as dh,Zt as di,NC as dj,PC as dk,TC as dl,Gl as dm,EC as dn,_C as dp,Zn as dq,SC as dr,AC as ds,wC as dt,ft as du,jC as dv,MC as dw,kC as dx,ql as dy,Me as dz,bc as e,yy as f,uy as g,by as h,gy as i,fy as j,py as k,vy as l,sy as m,cy as n,hy as o,dy as p,_c as q,Ce as r,de as s,he as t,dc as u,Ee as v,Cy as w,my as x,ny as y,Vf as z};
|
|
24
|
+
//# sourceMappingURL=ControlType-AGuZ4-oA.js.map
|