@deephaven/code-studio 1.15.1 → 1.15.2-alpha-fetch-variable-def.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{AppRoot-yoU6xO7o.js → AppRoot-DwJuOWo6.js} +4 -4
- package/build/assets/{AppRoot-yoU6xO7o.js.map → AppRoot-DwJuOWo6.js.map} +1 -1
- package/build/assets/{Chart-B-lgYFRk.js → Chart-C1i1ho1y.js} +2 -2
- package/build/assets/{Chart-B-lgYFRk.js.map → Chart-C1i1ho1y.js.map} +1 -1
- package/build/assets/{ControlType-BXDfYonb.js → ControlType-BEonYtyB.js} +4 -4
- package/build/assets/{ControlType-BXDfYonb.js.map → ControlType-BEonYtyB.js.map} +1 -1
- package/build/assets/{FormatterUtils-VvugcpnR.js → FormatterUtils-Bg2N5U7m.js} +2 -2
- package/build/assets/{FormatterUtils-VvugcpnR.js.map → FormatterUtils-Bg2N5U7m.js.map} +1 -1
- package/build/assets/{Grid-BhSfx_MV.js → Grid-Hz5UYdT_.js} +2 -2
- package/build/assets/{Grid-BhSfx_MV.js.map → Grid-Hz5UYdT_.js.map} +1 -1
- package/build/assets/GridTokenMouseHandler-DHkBdrVc.js +2 -0
- package/build/assets/GridTokenMouseHandler-DHkBdrVc.js.map +1 -0
- package/build/assets/{IrisGrid-CxxjDqw5.js → IrisGrid-DkGF7p3K.js} +3 -3
- package/build/assets/{IrisGrid-CxxjDqw5.js.map → IrisGrid-DkGF7p3K.js.map} +1 -1
- package/build/assets/{IrisGridModel-DSlx1u3X.js → IrisGridModel-DoD8cIz5.js} +3 -3
- package/build/assets/{IrisGridModel-DSlx1u3X.js.map → IrisGridModel-DoD8cIz5.js.map} +1 -1
- package/build/assets/{IrisGridShortcuts-RA3wXust.js → IrisGridShortcuts-DBc8G-3x.js} +2 -2
- package/build/assets/{IrisGridShortcuts-RA3wXust.js.map → IrisGridShortcuts-DBc8G-3x.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-6it02n4x.js → IrisGridThemeProvider-BJrYi5zT.js} +6 -6
- package/build/assets/IrisGridThemeProvider-BJrYi5zT.js.map +1 -0
- package/build/assets/{LocalWorkspaceStorage-BZKRnSF8.js → LocalWorkspaceStorage-Ddl67eNC.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-BZKRnSF8.js.map → LocalWorkspaceStorage-Ddl67eNC.js.map} +1 -1
- package/build/assets/{MarkdownEditor-C2AAm9ih.js → MarkdownEditor-BcHfeFVY.js} +2 -2
- package/build/assets/{MarkdownEditor-C2AAm9ih.js.map → MarkdownEditor-BcHfeFVY.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-DBOYivNl.js → MarkdownNotebook-Du5g1GaK.js} +2 -2
- package/build/assets/{MarkdownNotebook-DBOYivNl.js.map → MarkdownNotebook-Du5g1GaK.js.map} +1 -1
- package/build/assets/{MissingPartitionError-uL8lR3Hy.js → MissingPartitionError-Cjrlbi18.js} +2 -2
- package/build/assets/{MissingPartitionError-uL8lR3Hy.js.map → MissingPartitionError-Cjrlbi18.js.map} +1 -1
- package/build/assets/{MockChartModel-DTdba9NN.js → MockChartModel-B9nKAkLg.js} +2 -2
- package/build/assets/{MockChartModel-DTdba9NN.js.map → MockChartModel-B9nKAkLg.js.map} +1 -1
- package/build/assets/Plot-D75AfC4O.js +2 -0
- package/build/assets/{Plot-Cachc_IP.js.map → Plot-D75AfC4O.js.map} +1 -1
- package/build/assets/{Plotly-CqwB2UoY.js → Plotly-CAcUhtAR.js} +2 -2
- package/build/assets/{Plotly-CqwB2UoY.js.map → Plotly-CAcUhtAR.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-DTTYIKzl.js → StyleGuideRoot-WshrSVsS.js} +2 -2
- package/build/assets/{StyleGuideRoot-DTTYIKzl.js.map → StyleGuideRoot-WshrSVsS.js.map} +1 -1
- package/build/assets/{index-Pb0fT4BS.js → index-CAjC8rry.js} +4 -4
- package/build/assets/{index-Pb0fT4BS.js.map → index-CAjC8rry.js.map} +1 -1
- package/build/assets/{index-SLNddBo_.js → index-Nhi6EDbw.js} +3 -3
- package/build/assets/{index-SLNddBo_.js.map → index-Nhi6EDbw.js.map} +1 -1
- package/build/assets/index-ODecto2-.js +2 -0
- package/build/assets/index-ODecto2-.js.map +1 -0
- package/build/assets/plotly-Cm_x6xfs.js +7 -0
- package/build/assets/{plotly-CJ0h1Bb8.js.map → plotly-Cm_x6xfs.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +31 -31
- package/build/assets/GridTokenMouseHandler-Dem4pZ7B.js +0 -2
- package/build/assets/GridTokenMouseHandler-Dem4pZ7B.js.map +0 -1
- package/build/assets/IrisGridThemeProvider-6it02n4x.js.map +0 -1
- package/build/assets/Plot-Cachc_IP.js +0 -2
- package/build/assets/index-DZpheLqH.js +0 -2
- package/build/assets/index-DZpheLqH.js.map +0 -1
- package/build/assets/plotly-CJ0h1Bb8.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 vn,bA as Fr,I as d,bF as yu,U as F,bG as as,ac as ui,L as ss,K as q,R as $r,bH as Cu,bI as Su,M as ve,H as Et,bJ as wu,a8 as Eu,a9 as Pu,G as ls,a1 as En,bK as Tu,bL as _u,bM as Ou,bN as xu,bD as Gn,bO as Iu,a6 as Du,a5 as ku,bz as qi,bP as Nu,bQ as Mu,ad as Xt,av as Xi,bR as Wn,bS as N,bT as Zi,bE as be,a3 as xi,af as us,bU as ju,_ as Mn}from"./vendor-DJYze3uU.js";import{aC as ds,L as B,aZ as cs,W as hs,$ as Au,ai as Lu,aj as Ru,ah as Fu,ar as $u,ad as Hu,aw as Bu,M as ms,b as vs,c as fs,aK as Uu,a_ as Wu,a$ as ps,b0 as gs,b1 as Vu,b2 as Ku,N as fn,aA as zu,b3 as Gu,b4 as qu,b5 as Xu,b6 as Zu,b7 as Yu,b8 as Qu,b9 as Ju,ba as ed,bb as td,bc as nd,E as bs,aY as rd,aV as ys,aW as id,a3 as Cs,k as od,e as L,d as di,bd as ad,be as sd,au as Ss,bf as Yi,bg as ld,bh as ud,bi as dd,bj as cd,f as ws,aO as Es,bk as hd,bl as Ps,bm as On,aU as md,bn as vd,H as Qi,bo as Ts,q as Ji,bp as _s,bq as fd,K as pd,ak as gd,br as bd,C as yd,al as Cd,bs as Sd,bt as wd,bu as Ed,bv as Pd,bw as Td,bx as _d,by as Od,aQ as xd,bz as Id,bA as Dd}from"./index-SLNddBo_.js";import{e as Ie,M as kd,b as eo,l as it,R as Os,K as rt,c as Zt,d as to,U as Nd,_ as xs}from"./monaco-DaE0jI-i.js";var Is=Object.freeze([]),Ry=new Map,Ds=()=>{};function Fy(r){return Array.isArray(r)?r:[r]}function Yr(){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 Md(r,e,t){return(e=jd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jd(r){var e=Ad(r,"string");return typeof e=="symbol"?e:e+""}function Ad(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 no extends Error{constructor(){super(...arguments),Md(this,"isCanceled",!0)}}function Ld(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Rd(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function Rd(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 Fd(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 Bd extends Error{constructor(){super(...arguments),Fd(this,"isClipboardPermissionsDeniedError",!0)}}function Ud(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=Vd(r,"string");return typeof e=="symbol"?e:e+""}function Vd(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 Qr extends Error{constructor(){super(...arguments),Ud(this,"isClipboardUnavailableError",!0)}}function Kd(r,e,t){return(e=zd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zd(r){var e=Gd(r,"string");return typeof e=="symbol"?e:e+""}function Gd(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 ks extends Error{constructor(){super(...arguments),Kd(this,"isPermissionUnsupported",!0)}}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 qd(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 io(r){return ci.apply(this,arguments)}function ci(){return ci=qd(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new ks:t}}),ci.apply(this,arguments)}function oo(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 Ns(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){oo(o,n,i,a,s,"next",l)}function s(l){oo(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ms(r){return hi.apply(this,arguments)}function hi(){return hi=Ns(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}Xd(r)}),hi.apply(this,arguments)}function Xd(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 $y(){return mi.apply(this,arguments)}function mi(){return mi=Ns(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Qr;var e=yield io("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield io("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new Bd}catch(i){throw i instanceof ks?new Qr:i}throw new Qr}),mi.apply(this,arguments)}var jn;function pn(r,e,t){return(e=Zd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zd(r){var e=Yd(r,"string");return typeof e=="symbol"?e:e+""}function Yd(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 Qd="table_",js="column_",Jd=new Set(["in","not","i","ii","k"]),ec=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"]),tc=/[^a-zA-Z0-9_$\-+@]/g,nc=/[^A-Za-z0-9_$]/g,rc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,ic=/[^a-zA-Z0-9_]/g;function oc(r){return r.replace(/[ -]/g,"_")}function ac(r){return r.replace(/\s/g,"_")}class _t{}jn=_t;pn(_t,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Jd.has(a)||ec.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});pn(_t,"legalizeTableName",r=>jn.legalize(r,ac,Qd,tc,!1,0));pn(_t,"makeVariableName",r=>jn.legalizeTableName(r).replace(ic,"_"));pn(_t,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=jn.legalizeColumnName(t,n);e.includes(i)&&(i=js+n),e.push(i)}),e});pn(_t,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return jn.legalize(r,oc,js,nc,!0,e)});pn(_t,"isValidTableName",r=>rc.test(r));pn(_t,"isValidColumnName",r=>jn.legalizeColumnName(r)===r);class As 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 no),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof no}static isTimedOut(e){return e instanceof ds}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function ao(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=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 Qn{constructor(){ao(this,"pending",[]),ao(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 Hy(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 vt{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(!vt.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*By(r,e){for(var t=r;t<=e;++t)yield t}var Uy=" ";class Ls{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")}}var Jn;function Qt(r,e,t){return(e=uc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uc(r){var e=dc(r,"string");return typeof e=="symbol"?e:e+""}function dc(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{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(ze.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])}static formatDuration(e){var t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(n,"m ").concat(i,"s"):n>0?"".concat(n,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"ms";if(e==null||t===""||t===0||t==null)return null;var i=1,o=null,a=null;if(n==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(n==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}Jn=ze;Qt(ze,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Qt(ze,"MILLIS_PER_SECOND",1e3);Qt(ze,"NANOS_PER_SECOND",1e9);Qt(ze,"NANOS_PER_MIN",60*Jn.NANOS_PER_SECOND);Qt(ze,"NANOS_PER_HOUR",60*Jn.NANOS_PER_MIN);Qt(ze,"MILLIS_PER_MIN",60*Jn.MILLIS_PER_SECOND);Qt(ze,"MILLIS_PER_HOUR",60*Jn.MILLIS_PER_MIN);Qt(ze,"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 cc(r,e,t){return(e=hc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hc(r){var e=mc(r,"string");return typeof e=="symbol"?e:e+""}function mc(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 Vn extends Error{constructor(){super(...arguments),cc(this,"isInvalid",!0)}}function Rs(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function so(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 vc(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){so(o,n,i,a,s,"next",l)}function s(l){so(o,n,i,a,s,"throw",l)}a(void 0)})}}var fc=B.module("useAsyncInterval");function pc(r,e){var t=Rs(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(vc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(h){fc.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),c=Math.max(0,e-u);n.current=window.setTimeout(a,c)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function er(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 gc(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(()=>vn(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 bc(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function yc(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>Fr(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 Fs(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var Cc=3500,Sc=B.module("useCopyToClipboard");function wc(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{Ms(i).then(()=>{e(!0)}).catch(o=>Sc.error("Unable to copy ".concat(i),`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-D75AfC4O.js","./Plotly-CAcUhtAR.js","./plotly-Cm_x6xfs.js","./helpers-BosuxZz1.js","./vendor-DJYze3uU.js","./vendor-CawHrWiI.css","./MarkdownNotebook-Du5g1GaK.js","./index-Nhi6EDbw.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-WCsQ0aAg.css","./mathjax-B1bZVHHN.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as m,a0 as vn,bA as Fr,I as d,bF as yu,U as F,bG as as,ac as ui,L as ss,K as q,R as $r,bH as Cu,bI as Su,M as ve,H as Et,bJ as wu,a8 as Eu,a9 as Pu,G as ls,a1 as En,bK as Tu,bL as _u,bM as Ou,bN as xu,bD as Gn,bO as Iu,a6 as Du,a5 as ku,bz as qi,bP as Nu,bQ as Mu,ad as Xt,av as Xi,bR as Wn,bS as N,bT as Zi,bE as be,a3 as xi,af as us,bU as ju,_ as Mn}from"./vendor-DJYze3uU.js";import{aC as ds,L as B,aZ as cs,W as hs,$ as Au,ai as Lu,aj as Ru,ah as Fu,ar as $u,ad as Hu,aw as Bu,M as ms,b as vs,c as fs,aK as Uu,a_ as Wu,a$ as ps,b0 as gs,b1 as Vu,b2 as Ku,N as fn,aA as zu,b3 as Gu,b4 as qu,b5 as Xu,b6 as Zu,b7 as Yu,b8 as Qu,b9 as Ju,ba as ed,bb as td,bc as nd,E as bs,aY as rd,aV as ys,aW as id,a3 as Cs,k as od,e as L,d as di,bd as ad,be as sd,au as Ss,bf as Yi,bg as ld,bh as ud,bi as dd,bj as cd,f as ws,aO as Es,bk as hd,bl as Ps,bm as On,aU as md,bn as vd,H as Qi,bo as Ts,q as Ji,bp as _s,bq as fd,K as pd,ak as gd,br as bd,C as yd,al as Cd,bs as Sd,bt as wd,bu as Ed,bv as Pd,bw as Td,bx as _d,by as Od,aQ as xd,bz as Id,bA as Dd}from"./index-Nhi6EDbw.js";import{e as Ie,M as kd,b as eo,l as it,R as Os,K as rt,c as Zt,d as to,U as Nd,_ as xs}from"./monaco-DaE0jI-i.js";var Is=Object.freeze([]),Ry=new Map,Ds=()=>{};function Fy(r){return Array.isArray(r)?r:[r]}function Yr(){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 Md(r,e,t){return(e=jd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jd(r){var e=Ad(r,"string");return typeof e=="symbol"?e:e+""}function Ad(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 no extends Error{constructor(){super(...arguments),Md(this,"isCanceled",!0)}}function Ld(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Rd(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function Rd(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 Fd(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 Bd extends Error{constructor(){super(...arguments),Fd(this,"isClipboardPermissionsDeniedError",!0)}}function Ud(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=Vd(r,"string");return typeof e=="symbol"?e:e+""}function Vd(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 Qr extends Error{constructor(){super(...arguments),Ud(this,"isClipboardUnavailableError",!0)}}function Kd(r,e,t){return(e=zd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zd(r){var e=Gd(r,"string");return typeof e=="symbol"?e:e+""}function Gd(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 ks extends Error{constructor(){super(...arguments),Kd(this,"isPermissionUnsupported",!0)}}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 qd(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 io(r){return ci.apply(this,arguments)}function ci(){return ci=qd(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new ks:t}}),ci.apply(this,arguments)}function oo(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 Ns(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){oo(o,n,i,a,s,"next",l)}function s(l){oo(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ms(r){return hi.apply(this,arguments)}function hi(){return hi=Ns(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}Xd(r)}),hi.apply(this,arguments)}function Xd(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 $y(){return mi.apply(this,arguments)}function mi(){return mi=Ns(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Qr;var e=yield io("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield io("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new Bd}catch(i){throw i instanceof ks?new Qr:i}throw new Qr}),mi.apply(this,arguments)}var jn;function pn(r,e,t){return(e=Zd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zd(r){var e=Yd(r,"string");return typeof e=="symbol"?e:e+""}function Yd(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 Qd="table_",js="column_",Jd=new Set(["in","not","i","ii","k"]),ec=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"]),tc=/[^a-zA-Z0-9_$\-+@]/g,nc=/[^A-Za-z0-9_$]/g,rc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,ic=/[^a-zA-Z0-9_]/g;function oc(r){return r.replace(/[ -]/g,"_")}function ac(r){return r.replace(/\s/g,"_")}class _t{}jn=_t;pn(_t,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Jd.has(a)||ec.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});pn(_t,"legalizeTableName",r=>jn.legalize(r,ac,Qd,tc,!1,0));pn(_t,"makeVariableName",r=>jn.legalizeTableName(r).replace(ic,"_"));pn(_t,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=jn.legalizeColumnName(t,n);e.includes(i)&&(i=js+n),e.push(i)}),e});pn(_t,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return jn.legalize(r,oc,js,nc,!0,e)});pn(_t,"isValidTableName",r=>rc.test(r));pn(_t,"isValidColumnName",r=>jn.legalizeColumnName(r)===r);class As 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 no),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof no}static isTimedOut(e){return e instanceof ds}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function ao(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=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 Qn{constructor(){ao(this,"pending",[]),ao(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 Hy(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 vt{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(!vt.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*By(r,e){for(var t=r;t<=e;++t)yield t}var Uy=" ";class Ls{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")}}var Jn;function Qt(r,e,t){return(e=uc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uc(r){var e=dc(r,"string");return typeof e=="symbol"?e:e+""}function dc(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{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(ze.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])}static formatDuration(e){var t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(n,"m ").concat(i,"s"):n>0?"".concat(n,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"ms";if(e==null||t===""||t===0||t==null)return null;var i=1,o=null,a=null;if(n==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(n==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}Jn=ze;Qt(ze,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Qt(ze,"MILLIS_PER_SECOND",1e3);Qt(ze,"NANOS_PER_SECOND",1e9);Qt(ze,"NANOS_PER_MIN",60*Jn.NANOS_PER_SECOND);Qt(ze,"NANOS_PER_HOUR",60*Jn.NANOS_PER_MIN);Qt(ze,"MILLIS_PER_MIN",60*Jn.MILLIS_PER_SECOND);Qt(ze,"MILLIS_PER_HOUR",60*Jn.MILLIS_PER_MIN);Qt(ze,"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 cc(r,e,t){return(e=hc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hc(r){var e=mc(r,"string");return typeof e=="symbol"?e:e+""}function mc(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 Vn extends Error{constructor(){super(...arguments),cc(this,"isInvalid",!0)}}function Rs(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function so(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 vc(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){so(o,n,i,a,s,"next",l)}function s(l){so(o,n,i,a,s,"throw",l)}a(void 0)})}}var fc=B.module("useAsyncInterval");function pc(r,e){var t=Rs(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(vc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(h){fc.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),c=Math.max(0,e-u);n.current=window.setTimeout(a,c)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function er(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 gc(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(()=>vn(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 bc(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function yc(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>Fr(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 Fs(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var Cc=3500,Sc=B.module("useCopyToClipboard");function wc(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{Ms(i).then(()=>{e(!0)}).catch(o=>Sc.error("Unable to copy ".concat(i),`
|
|
3
3
|
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),r&&(t.current=setTimeout(()=>{e(!1)},Cc)),()=>{t.current&&clearTimeout(t.current)}),[r]),[r,n]}var Ec=["gray-50","gray-75","gray-100","gray-200","gray-300","gray-400","gray-500","gray-600","gray-700","gray-800","gray-900","red-100","red-200","red-300","red-400","red-500","red-600","red-700","red-800","red-900","red-1000","red-1100","red-1200","red-1300","red-1400","orange-100","orange-200","orange-300","orange-400","orange-500","orange-600","orange-700","orange-800","orange-900","orange-1000","orange-1100","orange-1200","orange-1300","orange-1400","yellow-100","yellow-200","yellow-300","yellow-400","yellow-500","yellow-600","yellow-700","yellow-800","yellow-900","yellow-1000","yellow-1100","yellow-1200","yellow-1300","yellow-1400","chartreuse-100","chartreuse-200","chartreuse-300","chartreuse-400","chartreuse-500","chartreuse-600","chartreuse-700","chartreuse-800","chartreuse-900","chartreuse-1000","chartreuse-1100","chartreuse-1200","chartreuse-1300","chartreuse-1400","celery-100","celery-200","celery-300","celery-400","celery-500","celery-600","celery-700","celery-800","celery-900","celery-1000","celery-1100","celery-1200","celery-1300","celery-1400","green-100","green-200","green-300","green-400","green-500","green-600","green-700","green-800","green-900","green-1000","green-1100","green-1200","green-1300","green-1400","seafoam-100","seafoam-200","seafoam-300","seafoam-400","seafoam-500","seafoam-600","seafoam-700","seafoam-800","seafoam-900","seafoam-1000","seafoam-1100","seafoam-1200","seafoam-1300","seafoam-1400","cyan-100","cyan-200","cyan-300","cyan-400","cyan-500","cyan-600","cyan-700","cyan-800","cyan-900","cyan-1000","cyan-1100","cyan-1200","cyan-1300","cyan-1400","blue-100","blue-200","blue-300","blue-400","blue-500","blue-600","blue-700","blue-800","blue-900","blue-1000","blue-1100","blue-1200","blue-1300","blue-1400","indigo-100","indigo-200","indigo-300","indigo-400","indigo-500","indigo-600","indigo-700","indigo-800","indigo-900","indigo-1000","indigo-1100","indigo-1200","indigo-1300","indigo-1400","purple-100","purple-200","purple-300","purple-400","purple-500","purple-600","purple-700","purple-800","purple-900","purple-1000","purple-1100","purple-1200","purple-1300","purple-1400","fuchsia-100","fuchsia-200","fuchsia-300","fuchsia-400","fuchsia-500","fuchsia-600","fuchsia-700","fuchsia-800","fuchsia-900","fuchsia-1000","fuchsia-1100","fuchsia-1200","fuchsia-1300","fuchsia-1400","magenta-100","magenta-200","magenta-300","magenta-400","magenta-500","magenta-600","magenta-700","magenta-800","magenta-900","magenta-1000","magenta-1100","magenta-1200","magenta-1300","magenta-1400","negative","notice","positive","info","accent","accent-100","accent-200","accent-300","accent-400","accent-500","accent-600","accent-700","accent-800","accent-900","accent-1000","accent-1100","accent-1200","accent-1300","accent-1400","bg","content-bg","subdued-content-bg","surface-bg","fg"];function Pc(r){return typeof r=="string"&&Ec.includes(r)}function $s(r){return r!=null&&Pc(r)?"var(--dh-color-".concat(r,")"):r}var Tc=["color","UNSAFE_style"];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 dr(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){_c(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 _c(r,e,t){return(e=Oc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Oc(r){var e=xc(r,"string");return typeof e=="symbol"?e:e+""}function xc(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=Dc(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 Dc(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 Hs=m.forwardRef((r,e)=>{var{color:t,UNSAFE_style:n}=r,i=Ic(r,Tc),o=m.useMemo(()=>dr(dr({},n),{},{color:$s(t)}),[t,n]);return d.jsx(yu,dr(dr({},i),{},{ref:e,UNSAFE_style:o}))});Hs.displayName="Text";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 Rt(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){Pn(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 Pn(r,e,t){return(e=kc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kc(r){var e=Nc(r,"string");return typeof e=="symbol"?e:e+""}function Nc(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 co="popper",Mc={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(r,e)=>{var t,n,i=(t=as.Defaults.modifiers)===null||t===void 0||(t=t.preventOverflow)===null||t===void 0||(n=t.fn)===null||n===void 0?void 0:n.call(t,r,e);return i==null?r:(i.styles.maxHeight="".concat(document.documentElement.clientHeight-r.offsets.popper.top-2*e.padding,"px"),i??r)}},flip:{enabled:!1}}};class Hr extends m.Component{constructor(e){super(e),Pn(this,"element",void 0),Pn(this,"container",void 0),Pn(this,"nodeRef",F.createRef()),Pn(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=F.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props,{popper:n}=this.state;e.isShown!==t&&(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t?this.show():this.hide()})),n&&n.scheduleUpdate()}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var e,t,{popper:n}=this.state,{closeOnBlur:i,referenceObject:o}=this.props;if(!n&&this.container.current!==null){var{options:a,keepInParent:s}=this.props,l=s?Mc:{placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},u=Rt(Rt(Rt({},l),a),{},{modifiers:Rt(Rt(Rt({},l.modifiers),a.modifiers),{},{preventOverflow:Rt(Rt({},(e=l.modifiers)===null||e===void 0?void 0:e.preventOverflow),(t=a.modifiers)===null||t===void 0?void 0:t.preventOverflow)})});document.body.appendChild(this.element);var c=this.getVisibleElement(this.container.current);c==null&&(c=this.container.current);var h=new as(o||c,this.element,u);h.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(i){var v=this.element.querySelector(".".concat(co));v instanceof HTMLElement&&!v.contains(document.activeElement)&&v.focus()}}),ui.flushSync(()=>{this.setState({popper:h})})}}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(),ui.flushSync(()=>{this.setState({show:!0})})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){var{closeOnBlur:t,onBlur:n}=this.props;e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||(n==null||n(e),t&&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(cs,{isPortal:!0,children:d.jsx(ss,{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:q(co,{interactive:i},e),onBlur:this.handleBlur,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&&$r.createPortal(this.renderContent(),this.element)})}}Pn(Hr,"defaultProps",{options:{},className:"",timeout:hs.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,referenceObject:null,"data-testid":void 0});var vi;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 jc(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){pt(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 pt(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)}var Rc=B.module("Tooltip");class ce extends m.Component{static handleHidden(){ce.shownTooltipCount-=1,ce.shownTooltipCount===0&&(ce.lastHiddenTime=Date.now())}static handleShown(){ce.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=F.createRef(),this.popper=F.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?ce.handleShown():ce.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&ce.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Rc.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;(ce.shownTooltipCount>0||Date.now()-ce.lastHiddenTime<ce.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(),ui.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=jc({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Hr,{className:q(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]})})})}}vi=ce;pt(ce,"defaultTimeout",500);pt(ce,"defaultReshowTimeout",100);pt(ce,"triggerReshowThreshold",300);pt(ce,"shownTooltipCount",0);pt(ce,"lastHiddenTime",Date.now());pt(ce,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:vi.defaultReshowTimeout,timeout:vi.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var Fc=B.module("ThemeProvider"),Ii=m.createContext(null);Ii.displayName="ThemeContext";function Wy(r){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:n=Au,children:i}=r,o=m.useMemo(()=>Lu(),[]),[a,s]=m.useState(null),[l,u]=m.useState(Ru),c=m.useMemo(()=>e==null?null:Fu(l,{base:o,custom:e??[]}),[o,l,e]),h=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(c==null||e==null)){$u(n);var f=Hu(n);Fc.debug2("updateThemePreloadData:",{active:c.map(p=>p.themeKey),custom:e.map(p=>p.themeKey),preloadStyleContent:f,selectedThemeKey:l}),Bu({themeKey:l,preloadStyleContent:f})}},[c,l,e,n]),m.useEffect(()=>{s({activeThemes:c,selectedThemeKey:l,themes:h,setSelectedThemeKey:u})},[c,l,h]),t&&c==null?null:d.jsxs(d.Fragment,{children:[c==null?null:d.jsx(d.Fragment,{children:c.map(v=>d.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:d.jsx(Ii.Provider,{value:a,children:d.jsx(cs,{children:i})})]})}function Bs(){return er(Ii,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var $c=["color","UNSAFE_style"];function mo(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 cr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mo(Object(t),!0).forEach(function(n){Hc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):mo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hc(r,e,t){return(e=Bc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bc(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 Wc(r,e){if(r==null)return{};var t,n,i=Vc(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 Vc(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 Us=m.forwardRef((r,e)=>{var{color:t,UNSAFE_style:n}=r,i=Wc(r,$c),o=m.useMemo(()=>cr(cr({},n),{},{color:$s(t)}),[t,n]);return d.jsx(Cu,cr(cr({},i),{},{ref:e,UNSAFE_style:o}))});Us.displayName="Heading";function Kc(r){var{children:e,className:t,style:n,"data-testid":i}=r;return d.jsx("div",{className:q("btn-group",t),style:n,role:"group","data-testid":i,children:e})}var zc=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function vo(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 fo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vo(Object(t),!0).forEach(function(n){Gc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Gc(r,e,t){return(e=qc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qc(r){var e=Xc(r,"string");return typeof e=="symbol"?e:e+""}function Xc(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 Zc(r,e){if(r==null)return{};var t,n,i=Yc(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 Yc(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 Qc(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 q("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Jc(r){switch(r){case"group-end":return q("pl-2","pr-3")}}var oe=F.forwardRef((r,e)=>{var{kind:t,variant:n,type:i="button",tooltip:o,icon:a,disabled:s=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:h,onMouseUp:v,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,className:b,style:w,children:E,tabIndex:P,"data-testid":$,"aria-label":Z}=r,re=Zc(r,zc),{UNSAFE_className:Y}=Su({},"button"),M;n&&(M=Jc(n));var R;a&&(R=F.isValidElement(a)?a:d.jsx(ve,{icon:a}));var ee=R!=null&&E==null,z=Qc(t,ee),j;o!==void 0&&(j=typeof o=="string"?d.jsx(ce,{children:o}):o);var G=Z;Z===void 0&&ee&&o!=null&&typeof o=="string"&&(G=o);var W=d.jsxs("button",fo(fo({"data-testid":$,ref:e,type:i,className:q("btn",z,M,{active:l},b,Y),onClick:u,onContextMenu:c,onMouseUp:v,onMouseDown:h,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,style:w,disabled:s,tabIndex:P,"aria-label":G},re),{},{children:[a&&R,E,o!=null&&!s&&j]}));return s&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[W,j]}):W});oe.displayName="Button";function Ws(r){var{className:e,children:t,"data-testid":n}=r;return d.jsx("div",{className:q("modal-footer",e),"data-testid":n,children:t})}function qn(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:c="Discard",isConfirmDanger:h=!1,children:v,"data-testid":f}=r,p=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=p.current)===null||P===void 0||P.focus()},[]),E="";return e&&(E=typeof n=="function"?n():n),d.jsxs(ms,{isOpen:e,onOpened:w,children:[d.jsx(vs,{closeButton:!1,children:t}),d.jsx(fs,{children:E}),d.jsxs(Ws,{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":f!==void 0?"".concat(f,"-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":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:c}),i&&d.jsx(oe,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),d.jsxs(Kc,{children:[d.jsx(oe,{kind:h?"danger":"primary",onClick:b,ref:p,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:u}),v]})]})]})}function eh(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=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)}function Jr(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}}eh(Ee,"actionsDisabled",!1);var po=B.module("GlobalContextAction");class rh 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),po.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;po.debug("Global hotkey matched!",e),(n=t.action)===null||n===void 0||n.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class ih 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(rh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));n.push(s)}}return n}}function Vs(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=ah(r,"string");return typeof e=="symbol"?e:e+""}function ah(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 hr=B.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),Vs(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=F.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=>!Jr(i)&&typeof i!="function"&&i.isGlobal),n=e.actions.filter(i=>!Jr(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,c=t.find(h=>u.contains(h));if(c!==void 0)return hr.debug2('Contextmenu event ignored based on the target className "'.concat(c,'"')),{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=>Jr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}hr.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;hr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),hr.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(ih,{actions:t})})}}Vs(te,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var Ks=F.forwardRef((r,e)=>{var t,n,{closeMenu:i,children:o,menuItem:a,onMenuItemClick:s,onMenuItemMouseMove:l,onMenuItemContextMenu:u,isKeyboardSelected:c=!1,isMouseSelected:h=!1,"data-testid":v}=r,f=m.useCallback(z=>{s(a,z)},[a,s]),p=m.useCallback(z=>{l(a,z)},[a,l]),g=m.useCallback(z=>{u(a,z)},[a,u]);function b(z,j,G){if(typeof z.type=="string")return z;var W={menuItem:a,closeMenu:i,isKeyboardSelected:c,isMouseSelected:h,iconElement:j,displayShortcut:G,"data-testid":v};return F.cloneElement(z,{forwardedProps:W})}var w=(t=a.shortcutText)!==null&&t!==void 0?t:(n=a.shortcut)===null||n===void 0?void 0:n.getDisplayText(),E=null;if(a.icon){var P=a.icon;if(F.isValidElement(P))E=P;else{var $;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&($={color:a.iconColor}),E=d.jsx(ve,{icon:P,style:$})}}var Z=null,re=!!o;a.actions&&(Z=d.jsx(ve,{icon:Uu}));var Y=null;if(a.menuElement)Y=d.jsx("div",{className:"custom-menu-item",onMouseMove:p,children:b(a.menuElement,E,w)});else{var M,R=a.disabled,ee=a.iconOutline;Y=d.jsx("button",{type:"button",className:q("btn-context-menu",{disabled:R},{active:(re||h)&&(R===void 0||!R)},{"keyboard-active":c&&(R===void 0||!R)}),onClick:f,onMouseMove:p,onContextMenu:g,title:(M=a.description)!==null&&M!==void 0?M:"",children:d.jsxs("div",{className:"btn-context-menu-wrapper",children:[d.jsx("span",{className:q("icon",{outline:ee}),children:E}),d.jsx("span",{className:"title",children:a.title}),w!==void 0&&d.jsx("span",{className:"shortcut",children:w}),Z&&d.jsx("span",{className:q("submenu-indicator",{disabled:R}),children:Z})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,Y]})});Ks.displayName="ContextMenuItem";var zs=F.forwardRef((r,e)=>{var{checked:t=!1,children:n,className:i,disabled:o=!1,inputClassName:a,isInvalid:s=!1,labelClassName:l,name:u,onChange:c,"data-testid":h}=r,[v]=m.useState(Et()),f=Fs(e);m.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var p=m.useCallback(g=>{f.current&&(f.current.indeterminate=t===null),c&&c(g)},[f,t,c]);return d.jsxs("div",{className:q("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:q("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:u,onChange:p,"data-testid":h}),d.jsx("label",{className:q("custom-control-label",l),htmlFor:v,children:n})]})});zs.displayName="Checkbox";function Ir(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function Gs(r){return Ir(r)&&Gs(r.WrappedComponent)?!0:r.prototype!=null&&r.prototype.isReactComponent!=null}function sh(r){return!Ir(r)&&"$$typeof"in r&&r.$$typeof===wu.ForwardRef}function qs(r){return Gs(r)||sh(r)}var lh=["copy","tooltip","children"];function go(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 bo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?go(Object(t),!0).forEach(function(n){uh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):go(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=ch(r,"string");return typeof e=="symbol"?e:e+""}function ch(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 hh(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}var yo="Copy";function Xs(r){var{copy:e,tooltip:t=yo,children:n}=r,i=hh(r,lh),[o,a]=wc(),s=o?"Copied":t;return d.jsxs(Eu,bo(bo({},i),{},{"aria-label":s,onPress:()=>{a(typeof e=="function"?e():e)},children:[d.jsx(Pu,{UNSAFE_className:n==null?"action-button-icon-with-tooltip":void 0,children:d.jsx(ve,{icon:o?Wu:ps})}),n!=null&&d.jsx(Hs,{children:n}),(n==null||s!==yo)&&d.jsx(ce,{children:s})]}))}Xs.displayName="CopyButton";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 vh(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){Kn(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 Kn(r,e,t){return(e=fh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fh(r){var e=ph(r,"string");return typeof e=="symbol"?e:e+""}function ph(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 Zs extends m.PureComponent{constructor(e){var t;super(e),Kn(this,"container",void 0),Kn(this,"oldFocus",void 0),Kn(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=F.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(Ks,{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:vh({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Kn(Zs,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function So(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 wo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?So(Object(t),!0).forEach(function(n){Tn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):So(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Tn(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)}class tr extends m.PureComponent{constructor(e){super(e),Tn(this,"container",void 0),Tn(this,"parent",void 0),Tn(this,"popper",void 0),Tn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=F.createRef(),this.parent=null,this.popper=F.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=wo({placement:"bottom"},s),a=wo({separateKeyboardMouse:!0},a),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Hr,{ref:this.popper,options:s,className:q("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(Zs,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}Tn(tr,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Ut(r,e,t){return(e=yh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yh(r){var e=Ch(r,"string");return typeof e=="symbol"?e:e+""}function Ch(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 Eo=B.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}({}),Sh=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 ls{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||Sh.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(),Ut(this,"id",void 0),Ut(this,"name",void 0),Ut(this,"tooltip",void 0),Ut(this,"isEditable",void 0),Ut(this,"defaultKeyState",void 0),Ut(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)?(Eo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new As("onUpdate",{detail:this}))):Eo.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))}}Ut(Ce,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Ut(Ce,"isMacPlatform",Ee.isMacPlatform());function Po(r,e,t){return(e=wh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wh(r){var e=Eh(r,"string");return typeof e=="symbol"?e:e+""}function Eh(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 To=B.module("ShortcutRegistry");class Ph extends ls{constructor(){super(...arguments),Po(this,"shortcutMap",new Map),Po(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 To.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;To.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new As("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 Ph),zt={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 fi(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 Br extends m.PureComponent{constructor(e){super(e),fi(this,"inputField",void 0),fi(this,"searchChangeSelection",void 0),this.inputField=F.createRef(),this.searchChangeSelection=F.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:c,"data-testid":h,cursor:v}=this.props,f,p=[{action:()=>v==null?void 0:v.next("forward"),shortcut:zt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:zt.PREVIOUS}];return v&&l>1?f=d.jsxs(d.Fragment,{children:[d.jsx(oe,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:gs,tooltip:"Previous match (".concat(zt.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:Vu,tooltip:"Next match (".concat(zt.NEXT.getDisplayText(),")")})]}):f=l>0&&d.jsx("span",{className:"search-match",children:l}),d.jsxs("div",{className:q("search-group",a),children:[d.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:c,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:u,"data-testid":h}),l!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),d.jsx(te,{actions:p})]}):d.jsxs("span",{className:"search-end-content",children:[(n??"")!==""&&e===""&&d.jsx("span",{className:"search-end-placeholder",children:n}),d.jsx(ve,{icon:Ku})]})]})}}fi(Br,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function Ys(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 Qs extends m.PureComponent{constructor(e){super(e),Ys(this,"searchInput",void 0),this.searchInput=F.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=vn(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(Br,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":o})}}Ys(Qs,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function Js(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 kh=B.module("ItemListItem");class Ur extends m.Component{static handleKeyDown(){return kh.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Js(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=F.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:q("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ur.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})}}Js(Ur,"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 _r;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 Oo(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){ct(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 ct(r,e,t){return(e=Nh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nh(r){var e=Mh(r,"string");return typeof e=="symbol"?e:e+""}function Mh(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 xo=B.module("ItemList"),Io=5;class bt 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),ct(this,"list",void 0),ct(this,"listContainer",void 0),ct(this,"getItemSelected",En((i,o)=>vt.isSelected(o,i),{max:bt.CACHE_SIZE})),ct(this,"getCachedItem",En((i,o,a,s,l,u,c,h)=>{var v=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:c});return d.jsx(Ur,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:c,children:v},o)},{max:bt.CACHE_SIZE})),ct(this,"getOuterElement",En(i=>{var o=F.forwardRef((a,s)=>d.jsx("div",Oo({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),ct(this,"getInnerElement",En(()=>{var i=F.forwardRef((o,a)=>d.jsx("div",Oo({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),ct(this,"getItemData",En((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=F.createRef(),this.listContainer=F.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:c}=this.props;c(u)}if(o!==t.focusIndex){var{onFocusChange:h}=this.props;h(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=vt.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:vt.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){xo.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){xo.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 c=Math.abs(t.clientX-(l??0)),h=Math.abs(t.clientY-(u??0));c>Io&&h>Io&&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){vt.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:vt.deselectRange(n,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){vt.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:vt.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 c=i[t-o];return this.getCachedItem(t,t,c,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(Tu,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:c,height:h}=u;return d.jsx(_u,{className:"item-list-scroll-pane",height:h,width:c,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})}})}}_r=bt;ct(bt,"CACHE_SIZE",1e3);ct(bt,"DEFAULT_ROW_HEIGHT",20);ct(bt,"DEFAULT_OVERSCAN",10);ct(bt,"defaultProps",{offset:0,items:[],rowHeight:_r.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:_r.DEFAULT_OVERSCAN,renderItem:_r.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var jh=B.module("ErrorBoundary");class Ah 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;jh.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(fn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function Lh(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:q("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 Rh=["classNames","timeout","children","onEnter"];function Do(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 ko(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Do(Object(t),!0).forEach(function(n){Fh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Do(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Fh(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)}function Bh(r,e){if(r==null)return{};var t,n,i=Uh(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 Uh(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 Wh={display:"contents"};function Vy(r){var{classNames:e,timeout:t=hs.transitionMs,children:n,onEnter:i}=r,o=Bh(r,Rh),a=m.useRef(null),s=m.useCallback(u=>{var c=a.current;c&&(i==null||i(c,u))},[i]),l=m.useCallback(u=>{a.current=u==null?void 0:u.firstElementChild},[]);return d.jsx(ss,ko(ko({nodeRef:a,timeout:t,classNames:q("fade",e),onEnter:s},o),{},{children:d.jsx("div",{ref:l,style:Wh,children:n})}))}var Vh=["children","className","isInvalid","onChange","data-testid"];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 Mo(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){Kh(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 Kh(r,e,t){return(e=zh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zh(r){var e=Gh(r,"string");return typeof e=="symbol"?e:e+""}function Gh(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 qh(r,e){if(r==null)return{};var t,n,i=Xh(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 Xh(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 el=F.forwardRef((r,e)=>{var{children:t,className:n,isInvalid:i,onChange:o,"data-testid":a}=r,s=qh(r,Vh),l=Fs(e),u=m.useCallback(c=>{o(c.target.value)},[o]);return d.jsx("select",Mo(Mo({ref:l,className:q("custom-select",n,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});el.displayName="Select";var Di=F.createContext(new Map);Di.displayName="XComponentMapContext";var Ky=Di.Provider;function Zh(r){var e,t=m.useContext(Di);return(e=t.get(r))!==null&&e!==void 0?e:r.Original}function jo(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 ei(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jo(Object(t),!0).forEach(function(n){Yh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Yh(r,e,t){return(e=Qh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qh(r){var e=Jh(r,"string");return typeof e=="symbol"?e:e+""}function Jh(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 tl(r){var e,t;function n(i,o){var a=Zh(t);return qs(r)?d.jsx(a,ei(ei({},i),{},{ref:o})):d.jsx(a,ei({},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 em(){return er(zu,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function nl(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function rl(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function zy(r){return nl(r)||rl(r)}var il=m.createContext(null);il.displayName="ObjectFetcherContext";function Gy(r){if(rl(r))return{id:r.id,type:r.type};if(nl(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function tm(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 qy(){return er(il,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var ki=Object.freeze({}),nm=new Map,Xy=r=>r.api,Zy=r=>r.user,ol=r=>r.storage,al=r=>ol(r).commandHistoryStorage,sl=r=>ol(r).fileStorage,rm=r=>r.defaultWorkspaceSettings,ll=r=>{var{workspace:e}=r;return e},Fe=Ou(r=>{var e,t,n=(e=(t=ll(r))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=rm(r),o=xu({},i,n,(a,s)=>{if(Array.isArray(a)&&Array.isArray(s))return s});return o}),Yy=r=>r.defaultWorkspaceSettings,Qy=r=>Fe(r).defaultDateTimeFormat,Jy=r=>{var e;return(e=Fe(r).defaultDecimalFormatOptions)!==null&&e!==void 0?e:ki},eC=r=>{var e;return(e=Fe(r).defaultIntegerFormatOptions)!==null&&e!==void 0?e:ki},tC=r=>{var e;return(e=Fe(r).formatter)!==null&&e!==void 0?e:[]},im=r=>Fe(r).timeZone,nC=r=>Fe(r).showTimeZone,rC=r=>Fe(r).showTSeparator,iC=r=>Fe(r).truncateNumbersWithPound,oC=r=>Fe(r).showEmptyStrings,aC=r=>Fe(r).showNullStrings,sC=r=>Fe(r).showExtraGroupColumn,lC=r=>Fe(r).shortcutOverrides,uC=r=>Fe(r).webgl,dC=r=>Fe(r).webglEditable,ul=r=>{var e;return(e=Fe(r).notebookSettings)!==null&&e!==void 0?e:ki},cC=r=>r.activeTool,om=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:nm};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 Nt(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){am(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 am(r,e,t){return(e=sm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sm(r){var e=lm(r,"string");return typeof e=="symbol"?e:e+""}function lm(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 hC=r=>({type:Ju,payload:r}),mC=r=>({type:Xu,payload:r}),dl=r=>({type:td,payload:r}),vC=r=>({type:nd,payload:r}),fC=r=>({type:ed,payload:r}),pC=r=>({type:Yu,payload:r}),gC=r=>({type:Qu,payload:r}),um=r=>(e,t)=>{e(dl(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i==null?void 0:i.save(r)},dm=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n??{},o=Nt(Nt({},n),{},{data:Nt(Nt(Nt({},i),r),{},{settings:Nt(Nt({},i==null?void 0:i.settings),r.settings)})});return e(um(o))},cm=r=>(e,t)=>{var{notebookSettings:n}=Fe(t()),i=Nt(Nt({},n),r);return e(hm({notebookSettings:i}))},hm=r=>e=>e(dm({settings:r})),bC=r=>({type:Gu,payload:r}),yC=r=>({type:qu,payload:r}),CC=r=>({type:Zu,payload:r});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 Ro(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){mm(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 mm(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=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)}function pm(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&&Gn({payload:a},{payload:n[o]})?n:Ro(Ro({},n),{},{[o]:a})}default:return n}}}function cl(r){var{type:e}=r,t=em();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:id});case t.VariableType.FIGURE:return d.jsx(ve,{icon:ys});case t.VariableType.PANDAS:return d.jsx(ve,{icon:rd});default:return d.jsx(ve,{icon:bs})}}function Fo(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 gm(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Fo(o,n,i,a,s,"next",l)}function s(l){Fo(o,n,i,a,s,"throw",l)}a(void 0)})}}function hl(r){var{children:e,language:t}=r,[n,i]=m.useState(null),{activeThemes:o}=Bs();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=gm(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 ml{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Dr{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)?[]:Iu.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 Dr.isTableType(e,t)||Dr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function bm(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 pi(r,e,t){return(e=ym(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ym(r){var e=Cm(r,"string");return typeof e=="symbol"?e:e+""}function Cm(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.Component{constructor(e){super(e),pi(this,"timer",void 0),pi(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:q("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(Cs,{className:"ml-2"}),"Running... ",ze.formatElapsedTime(n)," ",d.jsx(oe,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:od,tooltip:"Cancel",onClick:t,disabled:e})]})})}}pi(vl,"defaultProps",{disabled:!1});function zn(r,e,t){return(e=Sm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sm(r){var e=wm(r,"string");return typeof e=="symbol"?e:e+""}function wm(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 xn extends m.PureComponent{constructor(e){super(e),zn(this,"mouseX",void 0),zn(this,"mouseY",void 0),zn(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)>=xn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=xn.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:q("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?di:ad,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")}}zn(xn,"defaultProps",{message:""});zn(xn,"mouseDragThreshold",5);var fl=m.memo(r=>{var{item:e}=r,{startTime:t,serverStartTime:n,serverEndTime:i}=e,o=m.useMemo(()=>{var c;return(c=e.endTime)!==null&&c!==void 0?c:Date.now()},[e.endTime]),a=ze.formatConvertedDuration(t,o),s=!!a,l=null;n!=null&&i!=null&&(l=ze.formatConvertedDuration(n,i,"ns"));var u=!!l;return d.jsxs(d.Fragment,{children:[d.jsx(Us,{children:"Execution Info"}),d.jsx(Du,{children:d.jsxs("div",{className:"console-history-item-contextual-help-content",children:[s&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"Elapsed time"}),d.jsx("div",{children:a})]}),u&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"Server query time"}),d.jsx("div",{children:l})]})]})})]})});fl.displayName="ConsoleHistoryItemTooltip";var Em=r=>{if((r==null?void 0:r.command)==null)return null;var e=r.command?r.command.split(`
|
|
5
5
|
`).length:0;return e>2?null:"console-history-actions-".concat(e)},pl=m.memo(r=>{var{item:e,onCommandSubmit:t,handleTooltipVisible:n}=r,i=m.useMemo(()=>Em(e),[e]);return d.jsxs("div",{className:q("console-history-actions",i),children:[e.command!=null&&d.jsx(Xs,{copy:e.command}),d.jsx(oe,{icon:sd,kind:"inline",onClick:()=>{var o;return t((o=e.command)!==null&&o!==void 0?o:"")},tooltip:"Rerun",children:null}),d.jsx(ku,{variant:"info",onOpenChange:n,UNSAFE_className:"console-history-item-contextual-help",children:d.jsx(fl,{item:e})})]})});pl.displayName="ConsoleHistoryItemActions";function Pm(r,e,t){return(e=Tm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tm(r){var e=_m(r,"string");return typeof e=="symbol"?e:e+""}function _m(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 $o=B.module("ConsoleHistoryItem");class gl extends m.PureComponent{constructor(e){super(e),this.state={isTooltipVisible:!1},this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){$o.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&($o.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{isTooltipVisible:e}=this.state,{disabled:t,item:n,language:i,iconForType:o,onCommandSubmit:a}=this.props,{disabledObjects:s,result:l}=n,u=n.command!=null&&n.command!=="",c=null;u&&(c=d.jsxs("div",{className:q("console-history-item-command",{"console-history-item-command-tooltip-active":e}),children:[d.jsx("div",{className:"console-history-gutter",children:">"}),d.jsxs("div",{className:"console-history-content",children:[d.jsx(hl,{language:i,children:n.command}),d.jsx(pl,{item:n,onCommandSubmit:a,handleTooltipVisible:M=>this.setState({isTooltipVisible:M})})]})]}));var h=[],v=!1;if(l){var{error:f,message:p,changes:g}=l;if(g){var{created:b,updated:w}=g;[...b,...w].forEach(M=>{v=!0;var{title:R}=M,ee="".concat(R),z=t===void 0||t||(s??[]).indexOf(ee)>=0,j=d.jsx(oe,{kind:"primary",onClick:()=>this.handleObjectClick(M),className:"btn-console-object",disabled:z,icon:o(M.type),children:R},ee);h.push(j)})}if(f!=null&&!u){var E,P="".concat((E=f.message)!==null&&E!==void 0?E:f);P||(P=f);var $=d.jsx(xn,{message:P},"result-error");h.push($)}if(p!==void 0&&p!==""){var Z=d.jsx("div",{className:"log-message",children:p},"log-message");h.push(Z)}}else{v=!0;var re=d.jsx(vl,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");h.push(re)}var Y=null;return h.length>0&&(Y=d.jsx(bm,{children:h})),d.jsxs("div",{className:q("console-command-result",{"console-result-buttons":v}),children:[c,Y]})}}Pm(gl,"defaultProps",{disabled:!1});function Om(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var xm=F.forwardRef(function(e,t){for(var{disabled:n=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l,onCommandSubmit:u}=e,c=[],h=0;h<i.length;h+=1){var v=i[h],f=d.jsx(gl,{disabled:n,item:v,openObject:a,language:o,supportsType:s,iconForType:l,onCommandSubmit:u},Om(h,v));c.push(f)}return d.jsx("div",{ref:t,className:"container-fluid console-history",children:c})}),Im={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]})},Dm={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]})},km={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:Im,COMMAND_HISTORY:Dm,NOTEBOOK:km};const xe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Nm="var(--dh-color-editor-bg)",Mm="var(--dh-color-editor-fg)",jm="var(--dh-color-editor-string)",Am="var(--dh-color-editor-delimiter)",Lm="var(--dh-color-editor-predefined)",Rm="var(--dh-color-editor-keyword)",Fm="var(--dh-color-editor-storage)",$m="var(--dh-color-editor-number)",Hm="var(--dh-color-editor-operator)",Bm="var(--dh-color-editor-identifier)",Um="var(--dh-color-editor-comment)",gi={"error-foreground":"var(--dh-color-editor-error-fg)",background:Nm,foreground:Mm,"line-height":"19px",string:jm,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:Am,predefined:Lm,keyword:Rm,storage:Fm,number:$m,operator:Hm,identifier:Bm,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Um,"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)","diff-editor-inserted-text-background":"var(--dh-color-editor-diff-inserted-text-bg)","diff-editor-removed-text-background":"var(--dh-color-editor-diff-removed-text-bg)","diff-editor-inserted-line-background":"var(--dh-color-editor-diff-inserted-line-bg)","diff-editor-removed-line-background":"var(--dh-color-editor-diff-removed-line-bg)"};var Wm="python",Vm={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/}}},Km={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"]]}},zm={id:Wm,conf:Vm,language:Km},Gm="groovy",qm={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/}}},Xm={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"]]}},Zm={id:Gm,conf:qm,language:Xm},Ym="scala",Qm={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>))/}}},Jm={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"]]}},ev={id:Ym,conf:Qm,language:Jm},tv="deephavenDb",nv={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/}}},rv={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"]]}},iv={id:tv,conf:nv,language:rv},ov="log",av={},sv={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"}]]}},lv={id:ov,conf:av,language:sv},uv={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 Ho(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 dv(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ho(o,n,i,a,s,"next",l)}function s(l){Ho(o,n,i,a,s,"throw",l)}a(void 0)})}}function Yt(r,e,t){return(e=cv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cv(r){var e=hv(r,"string");return typeof e=="symbol"?e:e+""}function hv(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 st=B.module("MonacoCompletionProvider");class H extends m.PureComponent{static initRuff(){return dv(function*(){if(H.isRuffEnabled)return H.initRuffPromise||(H.initRuffPromise=Nu({}).then(()=>{st.debug("Initialized Ruff",qi.version()),H.isRuffInitialized=!0,H.updateRuffWorkspace()})),H.initRuffPromise})()}static updateRuffWorkspace(){if(H.isRuffInitialized){var e=console.log;try{console.log=()=>{},H.ruffWorkspace=new qi(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);st.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?eo.Error:eo.Warning,tags:i?[kd.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=it.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 c=new Os(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&c.intersectRanges(t)}),i=n.filter(u=>{var{fix:c}=u;return c!=null}).map(u=>{var c="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?c="".concat(u.code,": ").concat(u.fix.message):c="Fix ".concat(u.code)),{title:c,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(h=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:h.location.row,startColumn:h.location.column,endLineNumber:h.end_location.row,endColumn:h.end_location.column},text:(v=h.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 c=e.getLineContent(u.location.row),h=Ie.tokenize(c,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:u.location.row,startColumn:c.length+1,endLineNumber:u.location.row,endColumn:c.length+1},text:" # noqa: ".concat(u.code)};return h!=null&&h.type.startsWith("comment")&&(v.text="# noqa: ".concat(u.code," "),c.startsWith("# noqa:",h.offset)?(v.range.startColumn=h.offset+1,v.range.endColumn=h.offset+9):(v.range.startColumn=h.offset+1,v.range.endColumn=c.startsWith("# ",h.offset)?h.offset+3:h.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,c,h)=>h.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,`
|
|
@@ -21,5 +21,5 @@ Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(thi
|
|
|
21
21
|
`&&(n+=`
|
|
22
22
|
`))}}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)!==`
|
|
23
23
|
`&&(e+=`
|
|
24
|
-
`)}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:fd,tooltip:"Clear log"}),d.jsx(oe,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:pd,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(tr,{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}})]})}}ot(Se,"DefaultLogLevels",[xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN]);ot(Se,"AllLogLevels",[xe.INFO,xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN,xe.DEBUG,xe.TRACE]);ot(Se,"bufferTimeout",16);ot(Se,"maxLogSize",131072);ot(Se,"truncateSize",65536);const Uf="var(--dh-color-chart-colorway)",Wf="var(--dh-color-chart-grid)",Vf="var(--dh-color-chart-axis-line)",Kf="var(--dh-color-chart-axis-line-zero)",fa={"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:Uf,gridcolor:Wf,linecolor:Vf,zerolinecolor:Kf,"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)","map-style":"var(--dh-color-chart-map-style)"};var pa=B.module("ChartTheme");function zf(){var r,e=Ss(fa);return e.colorway=gd((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return bd.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),pa.debug2("Chart theme:",fa),pa.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"],map_style:e["map-style"]})}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 Gf(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){qf(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 qf(r,e,t){return(e=Xf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xf(r){var e=Zf(r,"string");return typeof e=="symbol"?e:e+""}function Zf(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 Yf=m.lazy(()=>xs(()=>import("./Plot-Cachc_IP.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function Qf(r){return d.jsx(m.Suspense,{fallback:d.jsx(fn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(Yf,Gf({},r))})}var Li=m.createContext(null);Li.displayName="ChartThemeContext";function NC(r){var{children:e}=r,{activeThemes:t}=Bs(),n=m.useMemo(zf,[t]);return d.jsx(Li.Provider,{value:n,children:e})}function Jf(){return er(Li,"No ChartThemeContext value found.")}function ba(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 ep(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ba(o,n,i,a,s,"next",l)}function s(l){ba(o,n,i,a,s,"throw",l)}a(void 0)})}}var tp=B.module("HeapUsage");function np(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=Jf(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,h]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=Rs(),p=m.useCallback(ep(function*(){try{var A=yield t.getWorkerHeapInfo();if(!f.current)return;if(u(A),o||c){for(var U=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:fe,usages:qe}=v.current;fe.length!==0&&V-fe[0]>a*1.5;)fe.shift(),qe.shift();fe.push(V),qe.push(U)}else v.current={timestamps:[],usages:[]}}catch(Me){tp.warn("Unable to get heap usage",Me)}}),[t,f,o,c,a]);pc(p,c?i:n);var g=(A,U)=>Math.round(A*10**U)/10**U,b=2,w=1024**3,{freeMemory:E,totalHeapSize:P,maximumHeapSize:$}=l,Z=g(E/w,b),re=g(P/w,b),Y=g($/w,b),M=re-Z,R=function(U,V){var fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:q("heap-usage-info-row",{"heading-bottom-border":fe}),children:[d.jsx("div",{className:"font-weight-bold",children:U}),d.jsx("div",{children:V})]})},{timestamps:ee,usages:z}=v.current,j=(e=ee[ee.length-1])!==null&&e!==void 0?e:0,G=P/$,W=(P-E)/$;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(G*100,"% - ").concat(G*2,"px")}}),d.jsx("div",{className:q("used-memory",{"heap-overflow":(P-E)/$>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(ce,{onEntered:()=>h(!0),onExited:()=>h(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[R("In use:","".concat(M.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),R("Free:","".concat(Z.toFixed(b)," GB")),R("Total:","".concat(re.toFixed(b)," GB")),R("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Qf,{data:[{x:[...ee],y:[...z],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 Dl=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 kl(r){return r.componentName!==void 0}function rp(r){return r.component!==void 0}var Nl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const ip=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Dl,isGLComponentConfig:kl,isReactComponentConfig:rp,itemDefaultConfig:Nl},Symbol.toStringTag,{value:"Module"}));function Or(r,e,t){return(e=op(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function op(r){var e=ap(r,"string");return typeof e=="symbol"?e:e+""}function ap(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 Ge{constructor(){Or(this,"_mSubscriptions",void 0),Or(this,"off",this.unbind),Or(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ge.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(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Ge.ALL_EVENT],u=0;u<l.length;u++){var c=l[u].ctx||{};try{l[u].fn.apply(c,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}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)}}Or(Ge,"ALL_EVENT","__all");function mt(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)}class Ci extends Ge{constructor(e,t,n){super(),mt(this,"width",void 0),mt(this,"height",void 0),mt(this,"title",void 0),mt(this,"parent",void 0),mt(this,"layoutManager",void 0),mt(this,"tab",void 0),mt(this,"_config",void 0),mt(this,"isHidden",!1),mt(this,"beforeCloseHandler",void 0),mt(this,"_element",N(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),mt(this,"_contentElement",void 0),this.title=kl(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",c=u==="height"?t:e,h=((n=this[u])!==null&&n!==void 0?n:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=c/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[u]=v;else{var g;a.contentItems[p].config[u]=((g=a.contentItems[p].config[u])!==null&&g!==void 0?g:0)+f}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}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=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 up=Object.freeze(Object.defineProperty({__proto__:null,Container:Ci,ItemContainer:Ci},Symbol.toStringTag,{value:"Module"}));function Ml(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function jl(r){if(window.location.hash)return Ml(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 Ri(r){return window.requestAnimationFrame(r)}function dp(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 jr(){return Et()}function cp(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 Fi(r){return N.trim(r.replace(/(<([^>]+)>)/gi,""))}function Ze(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=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 nr extends Ge{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Ze(this,"_eElement",void 0),Ze(this,"_oDocument",void 0),Ze(this,"_eBody",void 0),Ze(this,"_root",void 0),Ze(this,"_destroyAfterMouseUp",void 0),Ze(this,"_nDelay",400),Ze(this,"_timeout",void 0),Ze(this,"timeout",void 0),Ze(this,"_nDistance",10),Ze(this,"_nX",0),Ze(this,"_nY",0),Ze(this,"_nOriginalX",0),Ze(this,"_nOriginalY",0),Ze(this,"_bDragging",!1),this._eElement=e,this._oDocument=N(document),this._eBody=N(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 Sn(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=fp(r,"string");return typeof e=="symbol"?e:e+""}function fp(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 Al{constructor(e,t){Sn(this,"_container",void 0),Sn(this,"_reactComponent",null),Sn(this,"_portalComponent",null),Sn(this,"_originalComponentWillUpdate",void 0),Sn(this,"_initialState",void 0),Sn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,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=$r.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,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,void 0)}_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=N.extend(e,this._container._config.props);return F.createElement(this._reactClass,t)}}var Ar=["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"],pp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function $i(r){if(Ar.length>36)throw new Error("Too many keys in config minifier map");var e={};return Hi(r,e,"_min"),e}function Si(r){if(Ar.length>36)throw new Error("Too many keys in config minifier map");var e={};return Hi(r,e,"_max"),e}function Hi(r,e,t){var n=t==="_min"?gp:bp;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,Ar);e[s]=a}Hi(o,a,t)}else{var l=n(o,pp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=n(i,Ar);e[u]=l}}}}function gp(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function bp(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function ii(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 wi{constructor(e,t){ii(this,"name",void 0),ii(this,"origin",void 0),ii(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function vr(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=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)}let Ll=class extends Ge{constructor(e){super(),vr(this,"_layoutManager",void 0),vr(this,"_dontPropagateToParent",void 0),vr(this,"_childEventSource",void 0),vr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ge.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),N(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(){N(window).off("gl_child_event",this._boundOnEventFromChild)}};function Rl(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function Fl(r){return(e,t)=>Rl(e,r,t)}function $l(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 Hl(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 Jt(r){return{listen:Fl(r),emit:$l(r),useListener:Hl(r)}}const Ep=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:wi,DragListener:nr,EventEmitter:Ge,EventHub:Ll,ReactComponentHandler:Al,animFrame:Ri,filterXss:cp,getHashValue:Ml,getQueryStringParam:jl,getUniqueId:jr,listenForEvent:Rl,makeEmitFunction:$l,makeEventFunctions:Jt,makeListenFunction:Fl,makeUseListenerFunction:Hl,minifyConfig:$i,removeFromArray:dp,stripTags:Fi,unminifyConfig:Si},Symbol.toStringTag,{value:"Module"}));function $t(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 Bl extends Ge{constructor(e,t,n,i,o){super(),$t(this,"isInitialised",!1),$t(this,"_config",void 0),$t(this,"_dimensions",void 0),$t(this,"_parentId",void 0),$t(this,"_indexInParent",void 0),$t(this,"_layoutManager",void 0),$t(this,"_popoutWindow",null),$t(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,c,h;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:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.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=N.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;N(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-"+jr();e=$i(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=_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 yn extends Ge{constructor(e,t,n,i,o,a){var s,l,u,c,h,v,f,p;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=N(yn._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",Fi((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(),N(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,E;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((E=this._proxyTab.outerHeight(!0))!==null&&E!==void 0?E:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(c=P==null?void 0:P.top)!==null&&c!==void 0?c:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(p=this.element.height())!==null&&p!==void 0?p: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(yn,"_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 fr(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=Ip(r,"string");return typeof e=="symbol"?e:e+""}function Ip(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 Ul{constructor(e,t,n){fr(this,"_element",void 0),fr(this,"_itemConfig",void 0),fr(this,"_layoutManager",void 0),fr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new nr(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(N.extend(!0,{},n));new yn(e,t,this._dragListener,this._layoutManager,i,null)}}function pr(r,e,t){return(e=Dp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dp(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 Wl{constructor(e,t,n){pr(this,"_element",N(window)),pr(this,"_itemConfig",void 0),pr(this,"_layoutManager",void 0),pr(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 nr(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(N.extend(!0,{},n));new yn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Vl(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=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 rr{constructor(){Vl(this,"element",N(rr._template)),N(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()}}Vl(rr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function oi(r,e,t){return(e=jp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jp(r){var e=Ap(r,"string");return typeof e=="symbol"?e:e+""}function Ap(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{constructor(e,t,n,i){oi(this,"element",void 0),oi(this,"_header",void 0),oi(this,"_action",void 0),this._header=e,this.element=N('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function Lp(r,e,t){return(e=Rp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rp(r){var e=Fp(r,"string");return typeof e=="symbol"?e:e+""}function Fp(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 dn extends Error{constructor(e,t){super(),Lp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const $p=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:dn},Symbol.toStringTag,{value:"Module"}));function Pe(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)}function cn(r){return r.isStack}function et(r){return r.isComponent}function Kl(r){return r.isRoot}class De extends Ge{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(Ge.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,cn(this)&&this.header.tabs[i].setContentItem(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&&et(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 wi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new dn("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(Nl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof wi&&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,Ri(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Rn(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 zl 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,N()),Rn(this,"config",void 0),Rn(this,"componentName",void 0),Rn(this,"container",void 0),Rn(this,"parent",void 0),Rn(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=N.extend(!0,{},this.config.componentState||{});if(o==null)throw new dn('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 Ci(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 ut(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 Zn extends De{constructor(e,t,n,i){super(t,n,i,N('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ut(this,"isRow",void 0),ut(this,"isColumn",void 0),ut(this,"childElementContainer",void 0),ut(this,"parent",void 0),ut(this,"_splitter",[]),ut(this,"_splitterSize",void 0),ut(this,"_splitterGrabSize",void 0),ut(this,"_isColumn",void 0),ut(this,"_dimension",void 0),ut(this,"_splitterPosition",null),ut(this,"_splitterMinPosition",null),ut(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 c;l=this.contentItems[0],this.contentItems=[],(c=this.parent)===null||c===void 0||c.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,c,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));a+=h,s.push(h)}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(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var h=u.itemSizes[c];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<n.length;f++){l=n[f];var p=Math.round((l.width-t)*v);a-=p,l.width-=p}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 Gl(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,c=this._getMinimumDimensions((n=a.after.config.content)!==null&&n!==void 0?n:[]),h=this._isColumn?c.vertical:c.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)-(h||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,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((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]=c*h,s.after.config[this._dimension]=(1-c)*h,e.element.css({top:0,left:0}),Ri(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}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){Ei(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 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 Pi extends De{constructor(e,t,n){super(e,Ca(Ca({},t),{},{type:"root"}),null,N('<div class="lm_goldenlayout lm_item lm_root"></div>')),Ei(this,"childElementContainer",void 0),Ei(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(et(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 Zn)||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 c,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((c=h.config[a])!==null&&c!==void 0?c:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}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 wn(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){tt(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 tt(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=Xp(r,"string");return typeof e=="symbol"?e:e+""}function Xp(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 Ti extends De{constructor(e,t,n){var i,o,a,s,l,u,c,h,v;super(e,t,n,N('<div class="lm_item lm_stack"></div>')),tt(this,"_activeContentItem",null),tt(this,"_header",void 0),tt(this,"childElementContainer",N('<div class="lm_items"></div>')),tt(this,"header",void 0),tt(this,"parent",void 0),tt(this,"isStack",!0),tt(this,"_dropSegment",null),tt(this,"_contentAreaDimensions",null),tt(this,"_dropIndex",void 0),tt(this,"_side",void 0),tt(this,"_sided",!1),tt(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(h=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=wn(wn({},this._header),f.header)),t.header&&(this._header=wn(wn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=wn(wn({},this._header),t.content[0].header)),this.header=new jt(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),et(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 Zn&&(t&&this.parent.isColumn||n&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(et(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+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 h,v=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.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,c,h,v,f,p,g,b,w,E=this.header.tabs.length;if(E===0){var P,$,Z,re,Y,M,R,ee,z=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:($=z==null?void 0:z.left)!==null&&$!==void 0?$:0,x2:((Z=z==null?void 0:z.left)!==null&&Z!==void 0?Z:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((M=(R=this.header.element.offset())===null||R===void 0?void 0:R.top)!==null&&M!==void 0?M:0)+((ee=this.header.element.innerHeight())!==null&&ee!==void 0?ee:0)});return}var j=this.header.tabsContainer,G=(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(!(!G||!W)){e<G.left?e=G.left+1:e>G.right&&(e=G.right-1);var A,U;if(!(W.left<e&&e<W.right)){for(var V=0;V<E;V++){var fe;if(A=this.header.tabs[V].element,U=(fe=A.get(0))===null||fe===void 0?void 0:fe.getBoundingClientRect(),U&&U.left<e&&e<U.right){this._dropIndex=V;break}}if(A&&U&&e<U.left+U.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var qe;this._dropIndex=Math.min(((qe=this._dropIndex)!==null&&qe!==void 0?qe:0)+1,E),A.after(this.layoutManager.tabDropPlaceholder)}}var Me=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;Me=Math.max(Me,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var y=Me+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((u=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:Me,x2:y,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f: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 Zp=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:De,Component:zl,ContentItem:De,Root:Pi,RowOrColumn:Zn,Stack:Ti,isComponent:et,isRoot:Kl,isStack:cn},Symbol.toStringTag,{value:"Module"}));function kt(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=Qp(r,"string");return typeof e=="symbol"?e:e+""}function Qp(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 ir{constructor(e,t){var n;kt(this,"header",void 0),kt(this,"contentItem",void 0),kt(this,"element",N(ir._template)),kt(this,"titleElement",void 0),kt(this,"closeElement",void 0),kt(this,"isActive",!1),kt(this,"_layoutManager",void 0),kt(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 nr(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),et(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)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}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),et(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 yn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){N(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){et(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&&et(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):et(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),et(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(),et(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()}}kt(ir,"_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=Jp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jp(r){var e=eg(r,"string");return typeof e=="symbol"?e:e+""}function eg(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 jt extends Ge{constructor(e,t){var n,i;super(),se(this,"layoutManager",void 0),se(this,"element",N(jt._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",N(jt._nextButtonTemplate)),se(this,"tabPreviousButton",N(jt._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 ir(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,c;l.scrollLeft=(u=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.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(c=>{var h,v,f=o||c,p=c-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(h=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$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(),N(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 Un(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 Un(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 Un(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 Un(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"),N(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"),N(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 c=(s+l+u.length)%u.length;c!==s;){if(u.eq(c).css("display")!=="none")return c;c=(c+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(),N(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=N(window).height())!==null&&n!==void 0?n:0,l=(i=N(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<s-u.bottom,h=!c&&u.bottom>s*.6,v=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,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(jt,"_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(jt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));se(jt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Fn(r,e,t){return(e=tg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tg(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)}class Gl{constructor(e,t,n){Fn(this,"_isVertical",void 0),Fn(this,"_size",void 0),Fn(this,"_grabSize",void 0),Fn(this,"_dragListener",void 0),Fn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new nr(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=N('<div class="lm_drag_handle"></div>'),t=N('<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 rg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Bl,DragProxy:yn,DragSource:Ul,DragSourceFromEvent:Wl,DropTargetIndicator:rr,Header:jt,HeaderButton:Un,Splitter:Gl,Tab:ir},Symbol.toStringTag,{value:"Module"}));var ig={config:ip,container:up,controls:rg,errors:$p,items:Zp,utils:Ep};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 Ye(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){le(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 le(r,e,t){return(e=og(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function og(r){var e=ag(r,"string");return typeof e=="symbol"?e:e+""}function ag(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 Ea=["column","row","stack","component"];class Vr extends Ge{static isLayoutItemConfig(e){return Ea.includes(e.type)}static minifyConfig(e){return $i(e)}static unminifyConfig(e){return Si(e)}constructor(e,t){super(),le(this,"isInitialised",!1),le(this,"_isFullPage",!1),le(this,"_resizeTimeoutId",void 0),le(this,"_components",{"lm-react-component":Al}),le(this,"_fallbackComponent",void 0),le(this,"_itemAreas",[]),le(this,"_maximisedItem",null),le(this,"_maximisePlaceholder",N('<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 Ll(this)),le(this,"config",void 0),le(this,"container",void 0),le(this,"_originalContainer",void 0),le(this,"dropTargetIndicator",null),le(this,"tabDropPlaceholder",N('<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&&N("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:Ye({},this.config.settings),dimensions:Ye({},this.config.dimensions),labels:Ye({},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){N(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 rr,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(),N(window).off("resize",this._onResize),N(window).off("unload beforeunload",this._onUnload),N(window).off("blur.lm").off("focus.lm"),N(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 dn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Vr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Ea.join(","),new dn(i);return e.type==="component"&&!(t instanceof Ti)&&t&&!(this.isSubWindow===!0&&t instanceof Pi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:jr(),e.type==="stack"?new Ti(this,e,t):e.type==="row"?new Zn(!1,this,e,t):e.type==="column"?new Zn(!0,this,e,t):new zl(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=jr();for(var u=e.parent,c=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;c=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(c)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,E=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+E.left,top:w+E.top,width:(p=e.element.width())!==null&&p!==void 0?p: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 Bl(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 Ul(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Wl(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=Ye({},this.root._$getArea()),n=[Ye(Ye({},t),{},{side:"left",x2:t.x1+e}),Ye(Ye({},t),{},{side:"right",x1:t.x2-e}),Ye(Ye({},t),{},{side:"top",y2:t.y1+e}),Ye(Ye({},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(cn(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=Ye(Ye({},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(N.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&&N(window).resize(this._onResize),N(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=jl("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Si(e),localStorage.removeItem(n));var i=N.extend(!0,{},Dl,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=N('<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=Fi((e=this.config.content[0].title)!==null&&e!==void 0?e:""),N("head").append(N("body link, body style, template, .gl_keep")),this.container=N("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?N(this._originalContainer):N("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,N("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 dn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new dn(t,e);this.root=new Pi(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=>{cn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}le(Vr,"__lm",ig);const Pa={"tab-height":"28px","drag-border-width":"5px"},Ta=Object.freeze({tabHeight:parseInt(Pa["tab-height"],10),dragBorderWidth:parseInt(Pa["drag-border-width"],10)});function _a(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 Dt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(n){ql(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ql(r,e,t){return(e=sg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sg(r){var e=lg(r,"string");return typeof e=="symbol"?e:e+""}function lg(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 Ht=B.module("LayoutUtils");function Xl(r){return r.componentName!==void 0}function Kt(r){var e=r;return(Xl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function gr(r){return r.focus!==void 0}function Oa(r){return r.type==="stack"}class x{static activateTab(e,t){var n=x.getStackForRoot(e,t,!1);if(!n){Ht.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 Ht.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(Kl(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,c,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(c=s.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(s,h),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&&cn(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(cn(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&&cn(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&&Zi(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&&Zi(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(Kt(o)){var s=t(o.component,o);s!=null?n.push(s):Ht.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=Dt(Dt({},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?(Oa(n)&&delete n.activeItemIndex,x.dropLayoutMinorChange(i)):Kt(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),Gn(i,o)):Gn(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(Kt(o)){var a,{component:s,props:l={}}=o;n.push(Dt(Dt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Et(),props:t(s,l)}))}else if(o.content!==void 0){var u=x.hydrateLayoutConfig(o.content,t);Oa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ht.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(Dt(Dt({},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,c=Dt({},t);if(c.id==null&&(c.id=Et()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var h=o||{id:c.id,component:c.component};L(e);var v=n??(a?x.addStack(e):x.getStackForRoot(e,h));L(v);var f=x.getContentItemInStack(v,h);if(s!=null){var p=b=>{Ht.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:w}=b.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(c,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(c);s==null&&u&&gr(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&&gr(i)&&i.focus()}static closeComponent(e,t,n){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){Ht.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(et(o)?o.container.close(n):i.removeChild(o)),a&&document.contains(a)&&gr(a)&&a.focus()}static renameComponent(e,t,n){var i=x.getStackForRoot(e,t,!1);if(!i){Ht.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 Ht.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:Dt(Dt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Et()};return x.openComponentInStack(n,a),a}static getPanelComponentState(e){if(Xl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Kt(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Ta.tabHeight,borderWidth:Ta.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&&Kt(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:(gr(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)})}}ql(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var ug=F.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.']})})});ug.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:jC,emit:dg,useListener:AC}=Jt(ie.OPEN),Kr=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:cg,emit:LC,useListener:RC}=Jt(Kr.CYCLE_TO_NEXT_STACK),{listen:hg,emit:FC,useListener:$C}=Jt(Kr.CYCLE_TO_PREVIOUS_STACK),{listen:mg,emit:HC,useListener:BC}=Jt(Kr.CYCLE_TO_NEXT_TAB),{listen:vg,emit:UC,useListener:WC}=Jt(Kr.CYCLE_TO_PREVIOUS_TAB);function fg(r){return typeof r.id=="string"&&r.layout instanceof Vr&&r.panelManager instanceof Bi&&typeof r.registerComponent=="function"}function pg(r){if(!fg(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function xa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ia(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(n){Mt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e,t){return(e=gg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gg(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 dt=B.module("PanelManager"),sn=function(r){return r[r.Next=0]="Next",r[r.Previous=1]="Previous",r}(sn||{});class Bi{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(cg(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(hg(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(mg(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(vg(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&&Kt(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=>Ir(n)&&t instanceof n.WrappedComponent||!Ir(n)&&t instanceof n))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){dt.error("updatePanel Panel did not have an ID",e);return}dt.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){dt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){dt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){dt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}dt.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){dt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){dt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){dt.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===sn.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,c=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack(sn.Next)}handleCycleToPreviousStack(){this.cycleStack(sn.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===sn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(sn.Next)}handleCycleToPreviousTab(){this.cycleTab(sn.Previous)}handleReopen(e,t){dt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var o=Ia(Ia({},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){dt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){dt.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&&Kt(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(Bi,"MAX_CLOSED_PANEL_COUNT",100);var yg=B.module("PanelErrorBoundary");class Cg 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);yg.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(fn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}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 Lr(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){Sg(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 Sg(r,e,t){return(e=wg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wg(r){var e=Eg(r,"string");return typeof e=="symbol"?e:e+""}function Eg(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 Zl(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),Lr(Lr({},r),{},{componentState:null,props:o,type:"react-component"})}function Yl(r,e){return Lr(Lr({},r),{},{localDashboardId:e})}const Pg={dehydrate:Zl,hydrate:Yl};var Ql=F.createContext(void 0);Ql.displayName="LayoutManagerContext";var Tg=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}),Jl=be.shape({on:be.func,off:be.func,emit:be.func}),_g=be.shape({registerComponent:be.func,root:be.shape({addChild:be.func}),on:be.func,off:be.func,eventHub:Jl}),VC=Object.freeze({Container:Tg,EventHub:Jl,Layout:_g});function $n(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.");F.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Le(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var eu="SET_DASHBOARD_DATA";const Og=pm(eu,{},!1),xg={dashboardData:Og};var Ig=new Map,tu=Object.freeze({}),Dg=Object.freeze([]),KC=xi,kg=us,zC=ju,Ng=r=>r.dashboardData,$e=(r,e)=>{var t;return(t=Ng(r)[e])!==null&&t!==void 0?t:tu},GC=(r,e)=>{var t;return(t=$e(r,e).closed)!==null&&t!==void 0?t:Dg},qC=(r,e)=>{var t;return(t=$e(r,e).openedMap)!==null&&t!==void 0?t:Ig},nu=(r,e)=>{var t;return(t=$e(r,e).pluginDataMap)!==null&&t!==void 0?t:tu},XC=(r,e,t)=>nu(r,e)[t];function ka(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 _n(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ka(Object(t),!0).forEach(function(n){Mg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ka(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mg(r,e,t){return(e=jg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jg(r){var e=Ag(r,"string");return typeof e=="symbol"?e:e+""}function Ag(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 ru=(r,e)=>({type:eu,id:r,payload:e}),en=(r,e)=>(t,n)=>t(ru(r,_n(_n({},$e(n(),r)),e))),ZC=(r,e,t)=>(n,i)=>n(ru(r,_n(_n({},$e(i(),r)),{},{pluginDataMap:_n(_n({},nu(i(),r)),{},{[e]:t})})));Object.entries(xg).map(r=>{var[e,t]=r;return yd.register(e,t)});var iu=m.createContext(null);iu.displayName="PersistentStateContext";function br(r,e){return"".concat(r,"::").concat(e)}function Lg(r){var{initialState:e,onChange:t,children:n}=r,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),[a]=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=m.useRef(new Map),l=m.useCallback((p,g,b)=>{var{type:w}=b,E=br(g,w),P=s.current.get(E);if(P!=null&&P!==p)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));s.current.set(E,p),i.current&&a.get(E)!==b&&(a.set(E,b),t([...a.entries()]))},[i,t,a]),u=m.useRef(e[Symbol.iterator]()),c=m.useCallback((p,g)=>{var b=br(p,g),w=a.get(b);if(w==null&&o.current){var{value:E}=u.current.next(),P=E;return a.set(b,P),P}return w},[a]),h=m.useCallback((p,g,b)=>{var w=br(g,b),E=s.current.get(w);E===p&&(a.delete(w),s.current.delete(w),i.current&&t([...a.entries()]))},[i,t,a]),v=m.useCallback((p,g,b)=>{var w=br(g,b),E=s.current.get(w);E===p&&s.current.delete(w)},[]),f=m.useMemo(()=>({addState:l,removeState:h,deregisterHook:v,getState:c}),[l,c,h,v]);return d.jsx(iu.Provider,{value:f,children:n})}var Rg=B.module("DashboardPanelWrapper");function Fg(r){var{glContainer:e,children:t}=r,n=m.useCallback(a=>{e.setPersistedState(a)},[e]),{persistedState:i}=e.getConfig(),[o]=m.useState(()=>i!=null&&!Array.isArray(i)?(Rg.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return d.jsx(Lg,{initialState:o,onChange:n,children:t})}var Ui=m.createContext(null);Ui.displayName="PanelIdContext";function $g(){return m.useContext(Ui)}function Na(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function nn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(n){Hg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hg(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=Ug(r,"string");return typeof e=="symbol"?e:e+""}function Ug(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 yr=B.module("DashboardLayout"),Wg=Object.freeze({}),Vg=[],Ma=()=>{},Kg=1e3,ja=r=>r;function YC(r){var e,t,{id:n,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=Vg,onLayoutChange:l=Ma,onLayoutInitialized:u=Ma,hydrate:c=Yl,dehydrate:h=Zl,panelWrapper:v}=r,f=xi(),p=(e=us(y=>$e(y,n)))!==null&&e!==void 0?e:Wg,[g,b]=m.useState(!1),[w,E]=m.useState(!1),[P,$]=m.useState(),[Z]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[re,Y]=m.useState(a.getReactChildren()),M=m.useMemo(()=>new Map,[]),R=m.useMemo(()=>new Map,[]),ee=m.useCallback(function(y,S){var _,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h;yr.debug2("registerComponent",y,S,K,ne);function at(X,ae){var he=S,je=v,Ot=qs(he),Ct=Ot?d.jsx(he,nn(nn({},X),{},{ref:ae})):d.jsx(he,nn({},X)),{glContainer:ur,glEventHub:Ln}=X,bu=x.getIdFromContainer(ur);return d.jsx(Cg,{glContainer:ur,glEventHub:Ln,children:d.jsx(Ui.Provider,{value:bu,children:d.jsx(Fg,nn(nn({},X),{},{children:je==null?Ct:d.jsx(je,nn(nn({},X),{},{children:Ct}))}))})})}at.displayName="DashboardWrapper(".concat((_=S.displayName)!==null&&_!==void 0?_:y,")");var I=a.registerComponent(y,F.forwardRef(at));return M.set(y,K),R.set(y,ne),I},[c,h,M,R,a,v]),z=m.useCallback((y,S)=>{var _;return((_=M.get(y))!==null&&_!==void 0?_:ja)(S,n)},[M,n]),j=m.useCallback((y,S)=>{var _;return((_=R.get(y))!==null&&_!==void 0?_:ja)(S,n)},[R,n]),G=m.useMemo(()=>new Bi(a,z,j,new Map,Z,y=>{var{closed:S,openedMap:_}=y;f(en(n,{closed:S,openedMap:_}))}),[j,f,z,n,Z,a]),W=yc(y=>{var S=P==null||!x.isEqual(P,y);yr.debug("handleLayoutStateChanged",S,y),S&&(b(a.root.contentItems.length===0),$(y),l(y),Y(a.getReactChildren()))},Kg,{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]),U=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DRAGGING,S),E(!0)},[a.eventHub]),V=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DROPPED,S),E(!1)},[a.eventHub]),fe=m.useCallback(y=>{if(yr.debug2("handleComponentCreated",y),!(y==null||y.config==null||!Kt(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(_)}},[]),qe=m.useCallback(()=>{Y(a.getReactChildren())},[a]);Le(a,"stateChanged",A),Le(a,"itemPickedUp",U),Le(a,"itemDropped",V),Le(a,"componentCreated",fe),Le(a.eventHub,ie.TITLE_CHANGED,A),Le(a,"reactChildrenChanged",qe);var Me=bc(s);return m.useEffect(function(){if(Me!==s&&s!==P){yr.debug("Setting new layout content...");for(var S=x.hydrateLayoutConfig(s,z);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)}},[z,a,s,P,G,Me]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,re,F.Children.map(i,y=>y!=null?d.jsx(Ah,{fallback:[],children:F.cloneElement(y,{id:n,layout:a,panelManager:G,registerComponent:ee})}):null)]})}var ou=m.createContext(null);ou.displayName="DashboardIdContext";function QC(){var r=m.useContext(ou);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function zg(r,e,t){return(e=Gg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gg(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)}function au(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=au(n,e,t);if(i)return i;n=n.sibling}}}function Xg(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}var Wi=Xg(m.createContext(null));Wi.displayName="FiberContext";class JC extends m.Component{constructor(){super(...arguments),zg(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Wi.Provider,{value:this._reactInternals,children:e})}}function Zg(){var r=m.useContext(Wi);if(r===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>Et()),t=m.useMemo(()=>{for(var n of[r,r==null?void 0:r.alternate].filter(o=>o!=null)){var i=au(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 e0="default",Yg="CREATE_DASHBOARD",Qg="CLOSE_DASHBOARD",{listen:t0,emit:n0,useListener:r0}=Jt(Yg),{listen:i0,emit:Jg,useListener:o0}=Jt(Qg);function eb(r,e,t){return(e=tb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tb(r){var e=nb(r,"string");return typeof e=="symbol"?e:e+""}function nb(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 su 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})}}eb(su,"defaultProps",{additionalActions:[]});var rb=r=>({workspace:ll(r)}),ib=Mn(rb,{setWorkspace:dl})(su);function lu(r,e,t){return(e=ob(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ob(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)}class uu extends m.PureComponent{constructor(e){super(e),lu(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=F.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:q("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(Hr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}lu(uu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var Cr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Aa(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 ub=B.module("Panel");class db extends m.PureComponent{constructor(e){super(e),Aa(this,"ref",void 0),Aa(this,"getAdditionalActions",Xt((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=F.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(Cr.focus,this.handleTabFocus),i.on(Cr.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(Cr.focus,this.handleTabFocus),n.off(Cr.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){ub.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=Is,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:c=!1,isRenamable:h=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:q("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(fn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&$r.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(ib,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,c,h)}),h&&d.jsx(uu,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(ce,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var cb=tl(db),hb=B.module("useDhId"),ai="__dhId";function a0(){var r,e,t=(r=(e=Zg())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[ai],i=$g();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(ai," to be a string, but got ").concat(typeof n));return n}return i??(hb.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ai," prop. Defaulting to null.")),null)}function or(r,e,t){return(e=mb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mb(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 Ne{}or(Ne,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");or(Ne,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");or(Ne,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");or(Ne,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");or(Ne,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function tn(r,e,t){return(e=fb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fb(r){var e=pb(r,"string");return typeof e=="symbol"?e:e+""}function pb(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 Tt{}tn(Tt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");tn(Tt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");tn(Tt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");tn(Tt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");tn(Tt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");tn(Tt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");tn(Tt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");tn(Tt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const s0=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Lt(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 J{}Lt(J,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Lt(J,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Lt(J,"CLOSE_FILE","NotebookEvent.closeFile");Lt(J,"RENAME","NotebookEvent.rename");Lt(J,"RENAME_FILE","NotebookEvent.renameFile");Lt(J,"REGISTER_FILE","NotebookEvent.registerFile");Lt(J,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Lt(J,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Lt(J,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var yb=["children"];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 Ra(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){Cb(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 Cb(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=wb(r,"string");return typeof e=="symbol"?e:e+""}function wb(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 Eb(r,e){if(r==null)return{};var t,n,i=Pb(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 Pb(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 Tb 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(Ne.SESSION_CLOSED,this.handleSessionClosed),e.on(Ne.SESSION_OPENED,this.handleSessionOpened),e.on(Tt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.SESSION_CLOSED,this.handleSessionClosed),e.off(Ne.SESSION_OPENED,this.handleSessionOpened),e.off(Tt.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=Eb(e,yb);return d.jsx(cb,Ra(Ra({},n),{},{children:t}))}}var ar=tl(Tb);const l0=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var _b=Object.freeze({}),Ob=new Map,zr=Object.freeze([]),u0=(r,e)=>{var t;return(t=$e(r,e).columns)!==null&&t!==void 0?t:zr},d0=(r,e)=>{var t;return(t=$e(r,e).filterSets)!==null&&t!==void 0?t:zr},c0=(r,e)=>{var t;return(t=$e(r,e).filters)!==null&&t!==void 0?t:zr},h0=(r,e)=>{var t;return(t=$e(r,e).tableMap)!==null&&t!==void 0?t:Ob},m0=(r,e)=>$e(r,e).isolatedLinkerPanelId,du=(r,e)=>{var t;return(t=$e(r,e).links)!==null&&t!==void 0?t:zr},v0=(r,e)=>$e(r,e).columnSelectionValidator,f0=(r,e)=>{var t;return(t=$e(r,e).consoleSettings)!==null&&t!==void 0?t:_b},p0=(r,e)=>$e(r,e).connection,sr=(r,e)=>$e(r,e).sessionWrapper,g0=(r,e)=>t=>t(en(r,{connection:e})),b0=(r,e)=>t=>t(en(r,{sessionWrapper:e})),cu=(r,e)=>t=>t(en(r,{links:e})),y0=(r,e)=>(t,n)=>{var i=du(n(),r),o=e.filter(a=>i.findIndex(s=>Gn(s.start,a.start)&&Gn(s.end,a.end))<0);return t(cu(r,i.concat(o)))},C0=(r,e)=>(t,n)=>{var i=du(n(),r),o=i.filter(a=>!e.includes(a.id));return t(cu(r,o))},S0=(r,e)=>t=>t(en(r,{isolatedLinkerPanelId:e})),w0=(r,e)=>t=>t(en(r,{columnSelectionValidator:e})),xb=(r,e)=>t=>t(en(r,{consoleSettings:e})),E0=(r,e)=>t=>t(en(r,{filterSets:e}));function Rr(r,e,t){return(e=Ib(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ib(r){var e=Db(r,"string");return typeof e=="symbol"?e:e+""}function Db(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 Sr=B.module("CommandHistoryPanel");class lr extends m.Component{static handleError(e){Sr.error(e)}constructor(e){super(e),Rr(this,"container",void 0),Rr(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=F.createRef(),this.pending=new Qn;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(Ne.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.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(Sr.debug("handleSendToNotebook",n,e),!n){Sr.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;Sr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Ne.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(lr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(ar,{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})]})]})}}Rr(lr,"COMPONENT","CommandHistoryPanel");Rr(lr,"TITLE","Command History");var kb=(r,e)=>{var t=al(r),n=sr(r,e.localDashboardId),{session:i,config:o}=n??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Nb=Mn(kb,null,null,{forwardRef:!0})(lr),hu=m.createContext(null);hu.displayName="PluginsContext";var An=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function Mb(r){return"DashboardPlugin"in r}function jb(r){return"AuthPlugin"in r}function Ab(r){return"TablePlugin"in r}function P0(r){return Mb(r)||jb(r)||Ab(r)}function Lb(r){return"type"in r&&r.type===An.DASHBOARD_PLUGIN}function Vi(r){return"type"in r&&r.type===An.WIDGET_PLUGIN}function Rb(r){return"type"in r&&r.type===An.TABLE_PLUGIN}function Fb(r){return"type"in r&&r.type===An.AUTH_PLUGIN}function mu(r){return"type"in r&&r.type===An.THEME_PLUGIN}function vu(r){return"type"in r&&r.type===An.ELEMENT_PLUGIN}function T0(r){return Lb(r)||Fb(r)||Rb(r)||mu(r)||Vi(r)||vu(r)}var fu=B.module("@deephaven/plugin.PluginUtils");function Fa(r,e){return r==null||!Vi(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function $b(r){var e=d.jsx(ve,{icon:bs});if(!Vi(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function _0(r){var e=[...r.entries()].filter(t=>mu(t[1]));return fu.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:Cd(n,s),name:s,styleContent:u}})}).flat()}function O0(r){var e=[...r.entries()].filter(t=>vu(t[1])&&t[1].mapping!=null);return fu.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function x0(){return er(hu,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function $a(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 wr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$a(Object(t),!0).forEach(function(n){hn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):$a(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hn(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 Er=B.module("ConsolePanel"),Ub=500,Wb=Object.freeze({consoleSettings:{},itemIds:[]});class Gr extends m.PureComponent{constructor(e){super(e),hn(this,"consoleRef",void 0),hn(this,"objectSubscriptionCleanup",void 0),hn(this,"savePanelState",vn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Er.debug("Saving panel state",l),this.setState({panelState:l})},Ub)),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=F.createRef();var{panelState:t}=e,n=wr(wr({},Wb),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=>{Er.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,u=[...a,...l],c=new Map(o);u.forEach(v=>{var{title:f}=v;f!==void 0&&c.delete(f)});var h=[...a,...s];return h.forEach(v=>{v.title!==void 0&&c.set(v.title,v)}),{objectMap:c}})})}}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=Et(),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(Ne.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),Jg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Er.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ne.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:wr(wr({},tm(e)),{},{sessionId:i.id})};Er.debug("openWidget",l),dg(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=>Fa(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Fa(i,e));return n!=null?$b(n):d.jsx(cl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(fn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:c,session:h,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:w,type:E}=c;return d.jsx(ar,{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:h!=null&&d.jsx(qt,{dh:p,ref:this.consoleRef,settings:s,session:h,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:E,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:ml.LANGUAGE_MAP.get(E)}),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(np,{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})})}}hn(Gr,"COMPONENT","ConsolePanel");hn(Gr,"TITLE","Console");hn(Gr,"contextType",Ql);var Vb=(r,e)=>({commandHistoryStorage:al(r),sessionWrapper:sr(r,e.localDashboardId),timeZone:im(r),plugins:om(r)}),si=Mn(Vb,null,null,{forwardRef:!0})(Gr);function I0(r){return r==="file"||r==="directory"}function gt(r){return r.type==="directory"}function Kb(r,e,t){return(e=zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zb(r){var e=Gb(r,"string");return typeof e=="symbol"?e:e+""}function Gb(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 Ki extends Error{constructor(){super("No file exists at the path specified"),Kb(this,"isFileNotFound",!0)}}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 ln=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 k{static fileExists(e,t){return Ba(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Ki))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(!k.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 Ba(function*(){for(var n=k.getCopyFileName(t);yield k.fileExists(e,n);)n=k.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return ln.GROOVY;case"py":return ln.PYTHON;case"pyc":return ln.PYTHON_COMPILED;case"scala":return ln.SCALA;case"txt":return ln.PLAIN_TEXT;default:return ln.UNKNOWN}}static getParent(e){if(!k.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(!k.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=k.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Vn("Name cannot be empty");if(t.includes(e))throw new Vn('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,a;throw new Vn('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=>k.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 zi=26;function _i(r){return gt(r)?k.makePath(r.filename):k.getPath(r.filename)}function Ua(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=_i(e);if(r.some(n=>{var{filename:i}=n;return k.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>gt(n)&&t.startsWith(k.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function qb(r){if(gt(r))return r.isExpanded?Sd:wd;var e=k.getMimeType(r.basename);switch(e){case ln.PYTHON:return Pd;default:return Ed}}function Oi(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:c,onDragOver:h,onDragEnd:v,onDragExit:f,onDrop:p}=r,g=(e=n==null?void 0:n.some(M=>M.id===s.id))!==null&&e!==void 0?e:!1,b=_i(s),w=i&&u?_i(u):null,E=i&&o&>(s)&&w===b,P=i&&o&&w===b,$=i&&!o&&w===b,Z=qb(s),re=k.getDepth(s.filename),Y=Array(re).fill(null).map((M,R)=>d.jsx("span",{className:"file-list-depth-line"},R));return d.jsxs("div",{className:q("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":E,"is-in-drop-target":P,"is-invalid-drop-target":$,"is-selected":a}),onDragStart:M=>c(l,M),onDragOver:M=>h(l,M),onDragEnd:M=>v(l,M),onDragExit:f,onDrop:M=>p(l,M),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:Z,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(ce,{children:s.basename})]})})]})}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 Pr(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){Xb(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 Xb(r,e,t){return(e=Zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zb(r){var e=Yb(r,"string");return typeof e=="symbol"?e:e+""}function Yb(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=B.module("FileList"),Qb=500,Va="item-list-scroll-pane";function Jb(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Oi,rowHeight:l=zi,overscanCount:u=bt.DEFAULT_OVERSCAN}=r,[c,h]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,w]=m.useState(),[E,P]=m.useState(),[$,Z]=m.useState([]),re=m.useRef(),Y=m.useRef(null),M=m.useRef(null),R=m.useCallback(I=>{if(I.length===0||c==null)return[];for(var X=[],ae=0;ae<I.length;ae+=1)for(var he=I[ae],je=he[0];je<=he[1];je+=1)je>=c.offset&&je<c.offset+c.items.length&&X.push(c.items[je-c.offset]);return X},[c]),ee=m.useCallback(I=>{var X=R([[I,I]]);if(X.length>0)return X[0]},[R]),z=m.useCallback(()=>{var I=vt.count($);if(I===0)return null;if(I===1){var X=$[0][0],ae=ee(X);if(ae!=null)return ae.filename}return"".concat(I," items")},[ee,$]),j=m.useCallback(I=>{if(!(!b||!p)){He.debug("dropItems",b,"to",I);try{var{files:X,targetPath:ae}=Ua(b,p);if(i==null||i(X,ae),I!=null){var he;Z([[I,I]]),(he=Y.current)===null||he===void 0||he.focusItem(I)}}catch(je){He.error("Unable to complete move",je)}}},[b,p,i]),G=m.useCallback((I,X)=>{var ae=c.items[I-c.offset];ae!==void 0&&(He.debug("handleItemClick",ae),o(ae,X),gt(ae)&&(t==null||t.setExpanded(ae.filename,!ae.isExpanded)))},[c,o,t]),W=m.useCallback((I,X)=>{var ae,he;He.debug2("handleItemDragStart",I,$);var je=$;vt.isSelected($,I)||(je=[[I,I]],Z(je)),w(R(je)),(ae=Y.current)===null||ae===void 0||ae.resetMouseState();var Ot=document.createElement("div"),Ct=document.createElement("div");Ct.className="dnd-placeholder-content",Ct.innerText=(he=z())!==null&&he!==void 0?he:"",Ot.appendChild(Ct),Ot.className="file-list-dnd-placeholder",document.body.appendChild(Ot),X.dataTransfer.setDragImage(Ot,0,0),X.dataTransfer.effectAllowed="move",P(Ot)},[z,R,$]),A=m.useCallback((I,X)=>{X.preventDefault(),He.debug2("handleItemDragOver",X),g(ee(I))},[ee]),U=m.useCallback((I,X)=>{He.debug("handleItemDragEnd",I),E==null||E.remove(),w(void 0),g(void 0),P(void 0)},[E]),V=m.useCallback((I,X)=>{j(I)},[j]),fe=m.useCallback(()=>{He.debug2("handleItemDragExit"),g(void 0)},[]),qe=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Va)&&(I.preventDefault(),He.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Me=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Va)&&(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!==$){Z(I);var ae=R(I);a(ae)}},[R,a,$]),S=m.useCallback(I=>{if(He.debug2("handleFocusChange",I),I!=null){var[X]=R([[I,I]]);n(X)}else n();re.current=I},[R,n]),_=m.useCallback((I,X)=>{He.debug("handleViewportChange",I,X),(I!==v.top||X!==v.bottom)&&f({top:I,bottom:X})},[v]),K=m.useMemo(()=>{if(!b||!p)return!1;try{return Ua(b,p),He.debug("handleValidateDropTarget true"),!0}catch{return He.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:ne}=r;m.useEffect(()=>{ne!==void 0&&(ne==="/"?t.collapseAll():(t.setExpanded(ne,!1),t.setExpanded(ne,!0)))},[t,ne]),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=>{h({items:ae.items.map(he=>Pr(Pr({},he),{},{itemName:he.basename})),offset:ae.offset,itemCount:t.size})});return()=>{X()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),$.length>0&&y($,!0)},[c,S,y,$]),m.useEffect(function(){if(p!=null&>(p)&&p.filename!=="/"){var X=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},Qb);return()=>clearTimeout(X)}},[p,t]);var at=m.useCallback(I=>s(Pr(Pr({},I),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:K,onDragStart:W,onDragEnd:U,onDragOver:A,onDragExit:fe,onDrop:V})),[U,fe,A,W,V,b,p,K,s]);return d.jsx("div",{ref:M,className:q("file-list",{"is-dragging":b!=null}),onDragOver:qe,onDrop:Me,children:d.jsx(bt,{ref:Y,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:S,onSelect:G,onSelectionChange:y,onViewportChange:_,selectedRanges:$,renderItem:at,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var ey={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 Ka={FILE_EXPLORER:ey};var za=B.module("FileListItemEditor"),ty=()=>Promise.resolve();function ny(r){var{item:e,onCancel:t,onSubmit:n,validate:i=ty}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[c,h]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var E;(E=o.current)===null||E===void 0||E.focus()},[o]),f=m.useCallback(E=>E.stopPropagation(),[]),p=m.useCallback(()=>{c.then(()=>{n(a)}).catch(E=>za.info("Unable to validate name",E))},[n,a,c]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>u(void 0)).catch($=>{Te.isCanceled($)||u($)}),h(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{za.debug2("handleBlur"),p()},[p]),b=m.useCallback(E=>{var{value:P}=E.target;s(P)},[]),w=m.useCallback(E=>{E.stopPropagation();var{key:P}=E;switch(P){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:q("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}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 li(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){ry(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 ry(r,e,t){return(e=iy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iy(r){var e=oy(r,"string");return typeof e=="symbol"?e:e+""}function oy(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 pu(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:c,onSelectionChange:h,table:v,rowHeight:f=zi,validateRename:p=()=>Promise.resolve()}=r,[g,b]=m.useState(),[w,E]=m.useState([]),[P,$]=m.useState(),Z=m.useCallback(V=>{E(V),h==null||h(V)},[h]),re=m.useCallback(V=>{$(V)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),M=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),R=m.useCallback(()=>{i==null||i()},[i]),ee=m.useCallback(()=>{P&&(o==null||o(k.getPath(P.filename)))},[P,o]),z=m.useCallback(()=>{P&&b(P)},[P]),j=m.useCallback(()=>{b(void 0)},[]),G=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:R,group:te.groups.medium}),o&&V.push({title:"New Folder",description:"Create new folder",action:ee,group:te.groups.medium}),a&&V.push({title:"Copy File",description:"Copy the selected file",action:Y,group:te.groups.low,disabled:P==null||gt(P)}),s&&w.length>0&&V.push({title:"Delete",description:"Delete",shortcut:Ka.FILE_EXPLORER.DELETE,action:M,group:te.groups.low}),u&&V.push({title:"Rename",description:"Rename",shortcut:Ka.FILE_EXPLORER.RENAME,action:z,group:te.groups.low,disabled:P==null}),V},[Y,M,R,ee,z,P,a,i,o,s,u,w,g]),A=m.useCallback(V=>(L(g),p(g,V)),[g,p]),U=m.useCallback(V=>{var{item:fe}=V;return g&&g.filename===fe.filename?d.jsx(Oi,li(li({},V),{},{children:d.jsx(ny,{item:fe,validate:A,onSubmit:G,onCancel:j})})):d.jsx(Oi,li({},V))},[j,G,g,A]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(Jb,{onMove:l,onSelect:c,onSelectionChange:Z,onFocusChange:re,renderItem:U,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(te,{actions:W})]})}pu.displayName="FileListContainer";function qa(r,e,t){return(e=ay(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ay(r){var e=sy(r,"string");return typeof e=="symbol"?e:e+""}function sy(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 xr extends Vn{constructor(e){super("Name already exists"),qa(this,"isExistingFile",!0),qa(this,"info",void 0),this.info=e}}function Xa(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 Za(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Xa(o,n,i,a,s,"next",l)}function s(l){Xa(o,n,i,a,s,"throw",l)}a(void 0)})}}var St=B.module("FileExplorer");function Gi(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:c,rowHeight:h=zi}=r,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var G;function W(){return A.apply(this,arguments)}function A(){return A=Za(function*(){St.debug("initTable"),G=Te.makeCancelable(e.getTable(),U=>U.close());try{g(yield G)}catch(U){Te.isCanceled(U)||St.error("Unable to initialize table",U)}}),A.apply(this,arguments)}return W(),()=>{G.cancel()}},[e]);var b=m.useCallback(j=>{Te.isCanceled(j)||St.error(j)},[]),w=m.useCallback(()=>{St.debug("handleCreateFile"),s()},[s]),E=m.useCallback(()=>{St.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(j=>{St.debug("handleCopyFile",j.filename),i(j)},[i]),$=m.useCallback(j=>{St.debug("handleDelete, pending confirmation",j),f(j)},[]),Z=m.useCallback(()=>{St.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(gt(j)?k.makePath(j.filename):j.filename)),o(v),f([])},[v,o,e]),re=m.useCallback(()=>{St.debug("handleDeleteCancel"),f([])},[]),Y=m.useCallback((j,G)=>{var W=k.reducePaths(j.map(A=>gt(A)?k.makePath(A.filename):A.filename));W.forEach(A=>{var U=k.isPath(A)?"".concat(G).concat(k.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(G).concat(k.getBaseName(A));e.moveFile(A,U).then(()=>{a(A,U)}).catch(b)})},[b,a,e]),M=m.useCallback((j,G)=>{var W=j.filename,A=gt(j);A&&!W.endsWith("/")&&(W="".concat(W,"/"));var U="".concat(k.getParent(W)).concat(G);A&&!U.endsWith("/")&&(U="".concat(U,"/")),St.debug2("handleRename",W,U),e.moveFile(W,U).catch(b),a(W,U)},[b,a,e]),R=m.useCallback(function(){var j=Za(function*(G,W){if(W!==G.basename){k.validateName(W);var A="".concat(k.getPath(G.filename)).concat(W);try{var U=yield e.info(A);throw new xr(U)}catch(V){if(!(V instanceof Ki))throw V}}});return function(G,W){return j.apply(this,arguments)}}(),[e]),ee=v.length>0,z=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:[p&&d.jsx(pu,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:E,onCreateFile:w,onMove:Y,onDelete:$,onRename:M,onSelect:u,onSelectionChange:c,rowHeight:h,table:p,validateRename:R}),d.jsx(qn,{isOpen:ee,headerText:z,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:Z,confirmButtonText:"Delete"})]})}Gi.displayName="FileExplorer";function Ya(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 ly(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ya(o,n,i,a,s,"next",l)}function s(l){Ya(o,n,i,a,s,"throw",l)}a(void 0)})}}function un(r,e,t){return(e=uy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uy(r){var e=dy(r,"string");return typeof e=="symbol"?e:e+""}function dy(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 rn=B.module("NewItemModal");class mn extends m.PureComponent{static getValidationMessage(e){return e instanceof xr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||rn.error(e)}constructor(e){super(e),un(this,"inputRef",F.createRef()),un(this,"cancelableValidatePromise",void 0),un(this,"cancelableExistingItemPromise",void 0),un(this,"pending",new Qn),un(this,"pathMap",new Map),un(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=k.hasPath(t)?k.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:k.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:k.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=k.hasPath(e)?k.getPath(e):"/";this.setState({path:t,value:k.getBaseName(e),validationError:void 0,prevExtension:k.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 ly(function*(){k.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 xr(l)}catch(u){if(!(u instanceof Ki))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(mn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(rn.debug("handleSelect",e),e.type==="directory")this.setState({path:k.makePath(e.filename)});else{var t=e.basename,n=k.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 Vn))throw e;rn.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;rn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){rn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=k.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){rn.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;rn.debug("submitModal",n,i);var l=k.getExtension(i);return a&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(u=>{if(u instanceof xr&&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(mn.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(F.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:c,validationError:h,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=k.fileExtensionToString(f),w=k.fileExtensionToString(p),E=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(ms,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(vs,{toggle:n,children:o}),d.jsx(fs,{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:q("form-control",{"is-invalid":h}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d.jsx("div",{className:"invalid-feedback",children:mn.getValidationMessage(h)})]}),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(Gi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Ws,{children:[d.jsx(oe,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(oe,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:E})]})]}),d.jsx(qn,{isOpen:c,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(qn,{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,'"')})]})}}un(mn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function cy(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:_s,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(oe,{kind:"ghost",icon:_d,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(Qs,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Qa(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 hy(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Qa(o,n,i,a,s,"next",l)}function s(l){Qa(o,n,i,a,s,"throw",l)}a(void 0)})}}function gu(r,e,t){return(e=my(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function my(r){var e=vy(r,"string");return typeof e=="symbol"?e:e+""}function vy(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 on=B.module("FileExplorerPanel"),fy=(r,e)=>{var t=sl(r),n=sr(r,e.localDashboardId),{session:i,config:o}=n??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},py=Mn(fy,null,null,{forwardRef:!0});function gy(r){var e=r;return e!=null&&typeof e.button=="number"}class Nn extends F.Component{static handleError(e){on.error(e)}static isFocusEvent(e){return gy(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:""};on.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){on.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){on.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Nn.handleError)}handleCopyFile(e){var t=this;return hy(function*(){var{fileStorage:n}=t.props;if(gt(e)){on.error("Invalid item in handleCopyItem",e);return}var i=yield k.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=k.makePath(e[0].filename):t=k.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(on.debug("fileSelect",e),e.type!=="directory"){var n=Nn.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;on.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(ar,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(cy,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Gi,{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(mn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}gu(Nn,"COMPONENT","FileExplorerPanel");gu(Nn,"TITLE","File Explorer");var by=py(Nn);function Yn(r,e,t){return(e=yy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yy(r){var e=Cy(r,"string");return typeof e=="symbol"?e:e+""}function Cy(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 Ja=B.module("LogPanel");class qr extends m.PureComponent{constructor(e){super(e),Yn(this,"isBottomVisible",void 0),Yn(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){Ja.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Ja.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(ar,{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}})]})}}Yn(qr,"defaultProps",{session:null});Yn(qr,"COMPONENT","LogPanel");Yn(qr,"TITLE","Log");var Sy=(r,e)=>{var t;return{session:(t=sr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},wy=Mn(Sy,null,null,{forwardRef:!0})(qr);function es(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 Tr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){es(o,n,i,a,s,"next",l)}function s(l){es(o,n,i,a,s,"throw",l)}a(void 0)})}}function ts(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 Qe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ts(Object(t),!0).forEach(function(n){Re(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ts(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Re(r,e,t){return(e=Ey(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r){var e=Py(r,"string");return typeof e=="symbol"?e:e+""}function Py(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 Ty=m.lazy(()=>xs(()=>import("./MarkdownNotebook-DBOYivNl.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=B.module("NotebookPanel"),ns=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=k.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),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",Xt((v,f)=>Qe(Qe({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",Xt((v,f,p)=>{var g=[{title:"Find",icon:Id,action:this.handleFind,group:te.groups.high,shortcut:We.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:ps,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:Dd,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:ws,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?On:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:We.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?On: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:p?On: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 Qn,this.debouncedSavePanelState=vn(this.savePanelState.bind(this),ns),this.debouncedLoad=vn(this.load.bind(this),ns),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&&k.hasPath(s.itemName),c=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,h=c?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,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:c}=u;this.renameTab(c,k.getBaseName(s))}var h=Qe(Qe({},t),{},{language:(a=Oe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(h.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:h}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&k.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=Qe(Qe({},a),{},{value:s}),c=Qe(Qe({},a),{},{value:l}),h={settings:c,fileMetadata:i,isPreview:o};return ue.debug("Saving panel state",h),{settings:u,panelState:h}})}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 Tr(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 k.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var c={id:u,itemName:u},h={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,h,c,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Tr(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&&(k.hasPath(o.itemName)&&(yield k.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:Qe(Qe({},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 Tr(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=Qe(Qe({},a.settings),{},{language:o});return ue.debug("handleSaveSuccess",i,s,l),s&&k.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}),k.getBaseName(o)!==k.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,k.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 Tr(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=Qe(Qe({},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(Ne.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:c,error:h,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:w,sessionLanguage:E,settings:P,showCloseModal:$,showDeleteModal:Z,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,M=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:Oe.DEFAULT_NAME,R=M.endsWith(".md"),ee=(b==null?void 0:b.id)!=null,z=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),j=w!=null,G=E===z.language,W=!f||!j||!G,A=!f,U=[{action:this.handleSave,shortcut:zt.SAVE},{action:this.handleMinimapChange,shortcut:We.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:We.NOTEBOOK.WORDWRAP}],V=yi.getDisabledRunTooltip(j,G,"Notebook extension","Run"),fe=yi.getDisabledRunTooltip(j,G,"Notebook extension","Run Selected"),qe=[{title:ee?"Rename":"Save As…",order:10,group:te.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:te.groups.high,order:20}],Me=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[Me!=null&&$r.createPortal(d.jsx("span",{className:q(Oe.UNSAVED_INDICATOR_CLASS_NAME,{[Oe.UNSAVED_STATUS_CLASS_NAME]:u!==c})}),Me),d.jsxs(ar,{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:qe,renderTabTooltip:()=>M,children:[!R&&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:Ts,transform:"grow-4"}),tooltip:"Run ".concat(We.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&d.jsx(ce,{children:V})]}),d.jsxs("span",{children:[d.jsx(oe,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:W,icon:d.jsx(ve,{icon:Od,transform:"grow-4"}),tooltip:"Run Selected ".concat(We.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),fe!=null&&d.jsx(ce,{children:fe})]}),d.jsx(oe,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:xd,tooltip:"Save ".concat(zt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(oe,{kind:"ghost",className:"btn-overflow",disabled:A,icon:Ps,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(tr,{actions:this.getDropdownOverflowActions,popperOptions:Oe.POPPER_OPTIONS})})]}),d.jsx(xl,{isLoaded:f,isLoading:p,error:h,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:E,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:z,focusOnMount:Y,ref:y=>{this.notebook=y}})]}),R&&d.jsx(m.Suspense,{fallback:d.jsx(fn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(Ty,{content:(n=z.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(mn,{isOpen:re,type:"file",defaultValue:M,title:ee?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(qn,{isOpen:Z,headerText:'Are you sure you want to delete "'.concat(M,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(qn,{isOpen:$,headerText:"Do you want to save the changes you made to ".concat(M,"?"),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:U})]})]})}}Re(Oe,"COMPONENT","NotebookPanel");Re(Oe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(Oe,"DEFAULT_NAME","Untitled");Re(Oe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(Oe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(Oe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var _y=(r,e)=>{var t=sl(r),n=ul(r),i=sr(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},an=Mn(_y,{updateNotebookSettings:cm},null,{forwardRef:!0})(Oe);function Oy(){var{python:{linter:r={}}={}}=kg(ul),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function rs(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 is(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rs(Object(t),!0).forEach(function(n){xy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rs(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xy(r,e,t){return(e=Iy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Iy(r){var e=Dy(r,"string");return typeof e=="symbol"?e:e+""}function Dy(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=B.module("ConsolePlugin");function os(r){return r.notebook!==void 0}function ky(r){pg(r)}function D0(r){ky(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),[c,h]=m.useState(new Map);Oy();var v=xi(),f=m.useCallback(()=>i.getLastUsedPanelOfType(si),[i]),p=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)=>{h(_=>new Map(_.set(y,S)))},[h]),w=m.useCallback(y=>{h(S=>(S.delete(y),new Map(S)))},[h]),E=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 ne=f();if(!ne||!(ne instanceof si.WrappedComponent)){ge.error("Console panel not found");return}ge.debug("Send command: ",y,S,_),ne.addCommand(y,S,_)}},[f]),P=m.useCallback(y=>{v(xb(e,y))},[v,e]),$=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},[]),Z=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&&c.has(_))return c.get(_);if(S)return Et()},[l,c]),re=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&&p(S,_)),c.has(y)&&(_=c.get(y),w(y),_!=null&&b(S,_)),_===void 0){ge.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}re(_,k.getBaseName(S))},[l,c,re,p,b,g,w]),M=m.useCallback(y=>{var S=Z(y,!1);if(S==null){ge.error("Could not find panel id for file metadata",y);return}x.activateTab(n.root,{id:S})},[Z,n.root]),R=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 ne=l.get(K);if(y===ne){ge.debug("Update tab title for file ".concat(K));var{itemName:at}=S;Y(K,at)}else ge.error("File ".concat(K," already associated with a different tab ").concat(ne));return}p(K,y),c.has(K)&&w(K)},[l,c,Y,p,b,w]),ee=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]),z=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,ne=!1;if(l.has(_))K=l.get(_);else if(c.has(_))K=c.get(_),ne=!0;else{ge.debug("File ".concat(_," isn't open, ignore close event"));return}ee(y,ne),x.closeComponent(n.root,{id:K},S)},[n.root,l,c,ee]),j=m.useCallback(y=>{var{itemName:S}=y;return k.getBaseName(S)},[]),G=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,c),S!=null&&c.has(S)},[c]),A=m.useCallback(y=>{if(y!=null){var S=i.getOpenedPanelById(y);S&&os(S)&&S.focus()}},[i]),U=m.useCallback(y=>{var{id:S,settings:_,fileMetadata:K,session:ne,sessionLanguage:at,isPreview:I=!1}=y,X={settings:_,fileMetadata:K},ae=j(K);return{type:"react-component",component:an.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ne,sessionLanguage:at,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:$(_)},ne=Z(K);if(G(K)&&ne!=null){ge.debug("File is already open, focus panel"),M(K),A(ne);return}if(ne==null){ge.error("Panel ID for file metadata is null");return}var at=x.getStackForComponentTypes(n.root,[an.COMPONENT]),I=U({id:ne,settings:_,fileMetadata:K,session:y,sessionLanguage:S});ge.debug("createNotebook",I,l),x.openComponentInStack(at,I)},[G,A,$,Z,n.root,U,l,M]),fe=m.useCallback(function(y,S,_,K){var ne=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ge.debug("selectNotebook",K,ne);var at=G(K),I=W(K),[X]=[...c.values()],ae=!ne,he=ae&&X?X:Z(K);if(he==null||he==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(K)));if(at||I)M(K);else{var je=x.getStackForComponentTypes(n.root,[an.COMPONENT]),Ot=U({id:he,settings:_,fileMetadata:K,session:y,sessionLanguage:S,isPreview:ae});x.openComponentInStack(je,Ot)}if(I&&ne){var Ct=K.id,ur=x.getStackForConfig(n.root,{component:an.COMPONENT,id:he}),Ln=x.getContentItemInStack(ur,{component:an.COMPONENT,id:he});Ct!=null&&Ln&&et(Ln)&&(Ln.container.emit(J.PROMOTE_FROM_PREVIEW),w(Ct),p(Ct,he))}ne&&A(he)},[M,G,W,A,Z,n.root,U,c,w,p]),qe=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,ne=i.getLastUsedPanelOfType(an);ne&&os(ne)?_!=null&&_.value!=null&&ne.notebook!=null&&ne.notebook.append(_.value):K&&V(y,S,_)},[V,i]),Me=m.useCallback((y,S)=>Pg.hydrate(is(is({},y),{},{notebooksUrl:a}),S),[a]);return $n(o,si,t),$n(o,Nb),$n(o,by),$n(o,wy),$n(o,an,Me),Le(n.eventHub,Ne.SEND_COMMAND,E),Le(n.eventHub,Ne.SETTINGS_CHANGED,P),Le(n.eventHub,J.CLOSE_FILE,z),Le(n.eventHub,J.CREATE_NOTEBOOK,V),Le(n.eventHub,J.SELECT_NOTEBOOK,fe),Le(n.eventHub,J.RENAME,re),Le(n.eventHub,J.RENAME_FILE,Y),Le(n.eventHub,J.SEND_TO_NOTEBOOK,qe),Le(n.eventHub,J.REGISTER_FILE,R),Le(n.eventHub,J.UNREGISTER_FILE,ee),null}function Xr(r,e,t){return(e=Ny(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ny(r){var e=My(r,"string");return typeof e=="symbol"?e:e+""}function My(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 Zr{}Xr(Zr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Xr(Zr,"INPUT_FILTER","ControlType.INPUT_FILTER");Xr(Zr,"MARKDOWN","ControlType.MARKDOWN");Xr(Zr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{dm as $,uC as A,oe as B,zs as C,Ke as D,dC as E,El as F,Hs as G,Us as H,Pt as I,Bs as J,O as K,Fe as L,ul as M,cm as N,Xn as O,Te as P,H as Q,uv as R,el as S,T,zt as U,Xs as V,Zr as W,l0 as X,tr as Y,cl as Z,Br as _,ft as a,D as a$,en as a0,ZC as a1,ru as a2,bC as a3,ll as a4,Zy as a5,sr as a6,p0 as a7,om as a8,$e as a9,mC as aA,CC as aB,pC as aC,gC as aD,g0 as aE,b0 as aF,hC as aG,fC as aH,dl as aI,vC as aJ,me as aK,By as aL,pc as aM,er as aN,wc as aO,gc as aP,Fs as aQ,Rs as aR,bc as aS,yc as aT,vt as aU,bt as aV,Ec as aW,Ks as aX,Qs as aY,Ah as aZ,Ur as a_,e0 as aa,Ng as ab,cC as ac,Pg as ad,Ld as ae,Ms as af,J as ag,Tt as ah,LC as ai,FC as aj,HC as ak,UC as al,ie as am,s0 as an,t0 as ao,i0 as ap,an as aq,dg as ar,tm as as,Is as at,Hr as au,D0 as av,te as aw,qn as ax,x0 as ay,yC as az,_t as b,Dr as b$,Ws as b0,Kc as b1,Ii as b2,Wy as b3,Lh as b4,Di as b5,Ky as b6,qs as b7,$s as b8,tl as b9,TC as bA,Vv as bB,xC as bC,IC as bD,Zv as bE,Yv as bF,kC as bG,DC as bH,Li as bI,NC as bJ,Qf as bK,zf as bL,Jf as bM,qt as bN,hl as bO,Ue as bP,Mr as bQ,jf as bR,Il as bS,ml as bT,xm as bU,gl as bV,bm as bW,xn as bX,vl as bY,In as bZ,yf as b_,Gs as ba,Pc as bb,sh as bc,Ir as bd,Zh as be,il as bf,rl as bg,nl as bh,zy as bi,Gy as bj,qy as bk,Iv as bl,Dv as bm,we as bn,Lv as bo,Xv as bp,Q as bq,Hv as br,ke as bs,SC as bt,Sl as bu,wl as bv,PC as bw,OC as bx,wC as by,EC as bz,C as c,jb as c$,bl as c0,np as c1,Se as c2,gi as c3,We as c4,xl as c5,yi as c6,Ds as c7,x as c8,$n as c9,cg as cA,mg as cB,hg as cC,vg as cD,jC as cE,xg as cF,KC as cG,zC as cH,o0 as cI,r0 as cJ,RC as cK,BC as cL,$C as cM,WC as cN,QC as cO,a0 as cP,Le as cQ,$g as cR,_0 as cS,Vi as cT,O0 as cU,An as cV,hu as cW,$b as cX,Fb as cY,Lb as cZ,vu as c_,AC as ca,XC as cb,cb as cc,Qg as cd,Yg as ce,ai as cf,ou as cg,YC as ch,VC as ci,Ql as cj,Cg as ck,Ui as cl,Bi as cm,iu as cn,Lg as co,eu as cp,Cr as cq,pg as cr,Zl as cs,Jg as ct,n0 as cu,GC as cv,qC as cw,nu as cx,Yl as cy,fg as cz,ze as d,Mb as d0,P0 as d1,Ab as d2,T0 as d3,Rb as d4,mu as d5,Fa as d6,Hy as d7,no as d8,ug as d9,w0 as dA,C0 as dB,y0 as dC,cu as dD,Ne as dE,f0 as dF,xb as dG,Oy as dH,Fy as dI,Uy as dJ,$y as dK,Qr as dL,Bd as dM,Yr as dN,_C as dO,Vn as dP,Vr as da,JC as db,k as dc,Ki as dd,I0 as de,si as df,wy as dg,Nb as dh,by as di,As as dj,Ry as dk,ar as dl,Ls as dm,Jt as dn,S0 as dp,h0 as dq,m0 as dr,du as ds,c0 as dt,v0 as du,Qn as dv,u0 as dw,E0 as dx,d0 as dy,gt as dz,hm as e,im as f,Yy as g,sC as h,aC as i,oC as j,iC as k,rC as l,nC as m,Xy as n,eC as o,Jy as p,Qy as q,Ce as r,de as s,ce as t,em as u,Ee as v,lC as w,tC as x,Vy as y,kg as z};
|
|
25
|
-
//# sourceMappingURL=ControlType-
|
|
24
|
+
`)}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:fd,tooltip:"Clear log"}),d.jsx(oe,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:pd,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(tr,{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}})]})}}ot(Se,"DefaultLogLevels",[xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN]);ot(Se,"AllLogLevels",[xe.INFO,xe.STDOUT,xe.ERROR,xe.FATAL,xe.STDERR,xe.WARN,xe.DEBUG,xe.TRACE]);ot(Se,"bufferTimeout",16);ot(Se,"maxLogSize",131072);ot(Se,"truncateSize",65536);const Uf="var(--dh-color-chart-colorway)",Wf="var(--dh-color-chart-grid)",Vf="var(--dh-color-chart-axis-line)",Kf="var(--dh-color-chart-axis-line-zero)",fa={"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:Uf,gridcolor:Wf,linecolor:Vf,zerolinecolor:Kf,"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)","map-style":"var(--dh-color-chart-map-style)"};var pa=B.module("ChartTheme");function zf(){var r,e=Ss(fa);return e.colorway=gd((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return bd.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),pa.debug2("Chart theme:",fa),pa.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"],map_style:e["map-style"]})}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 Gf(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){qf(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 qf(r,e,t){return(e=Xf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xf(r){var e=Zf(r,"string");return typeof e=="symbol"?e:e+""}function Zf(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 Yf=m.lazy(()=>xs(()=>import("./Plot-D75AfC4O.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function Qf(r){return d.jsx(m.Suspense,{fallback:d.jsx(fn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(Yf,Gf({},r))})}var Li=m.createContext(null);Li.displayName="ChartThemeContext";function NC(r){var{children:e}=r,{activeThemes:t}=Bs(),n=m.useMemo(zf,[t]);return d.jsx(Li.Provider,{value:n,children:e})}function Jf(){return er(Li,"No ChartThemeContext value found.")}function ba(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 ep(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ba(o,n,i,a,s,"next",l)}function s(l){ba(o,n,i,a,s,"throw",l)}a(void 0)})}}var tp=B.module("HeapUsage");function np(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=Jf(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,h]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=Rs(),p=m.useCallback(ep(function*(){try{var A=yield t.getWorkerHeapInfo();if(!f.current)return;if(u(A),o||c){for(var U=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:fe,usages:qe}=v.current;fe.length!==0&&V-fe[0]>a*1.5;)fe.shift(),qe.shift();fe.push(V),qe.push(U)}else v.current={timestamps:[],usages:[]}}catch(Me){tp.warn("Unable to get heap usage",Me)}}),[t,f,o,c,a]);pc(p,c?i:n);var g=(A,U)=>Math.round(A*10**U)/10**U,b=2,w=1024**3,{freeMemory:E,totalHeapSize:P,maximumHeapSize:$}=l,Z=g(E/w,b),re=g(P/w,b),Y=g($/w,b),M=re-Z,R=function(U,V){var fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:q("heap-usage-info-row",{"heading-bottom-border":fe}),children:[d.jsx("div",{className:"font-weight-bold",children:U}),d.jsx("div",{children:V})]})},{timestamps:ee,usages:z}=v.current,j=(e=ee[ee.length-1])!==null&&e!==void 0?e:0,G=P/$,W=(P-E)/$;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(G*100,"% - ").concat(G*2,"px")}}),d.jsx("div",{className:q("used-memory",{"heap-overflow":(P-E)/$>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(ce,{onEntered:()=>h(!0),onExited:()=>h(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[R("In use:","".concat(M.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),R("Free:","".concat(Z.toFixed(b)," GB")),R("Total:","".concat(re.toFixed(b)," GB")),R("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Qf,{data:[{x:[...ee],y:[...z],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 Dl=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 kl(r){return r.componentName!==void 0}function rp(r){return r.component!==void 0}var Nl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const ip=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Dl,isGLComponentConfig:kl,isReactComponentConfig:rp,itemDefaultConfig:Nl},Symbol.toStringTag,{value:"Module"}));function Or(r,e,t){return(e=op(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function op(r){var e=ap(r,"string");return typeof e=="symbol"?e:e+""}function ap(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 Ge{constructor(){Or(this,"_mSubscriptions",void 0),Or(this,"off",this.unbind),Or(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ge.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(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Ge.ALL_EVENT],u=0;u<l.length;u++){var c=l[u].ctx||{};try{l[u].fn.apply(c,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}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)}}Or(Ge,"ALL_EVENT","__all");function mt(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)}class Ci extends Ge{constructor(e,t,n){super(),mt(this,"width",void 0),mt(this,"height",void 0),mt(this,"title",void 0),mt(this,"parent",void 0),mt(this,"layoutManager",void 0),mt(this,"tab",void 0),mt(this,"_config",void 0),mt(this,"isHidden",!1),mt(this,"beforeCloseHandler",void 0),mt(this,"_element",N(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),mt(this,"_contentElement",void 0),this.title=kl(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",c=u==="height"?t:e,h=((n=this[u])!==null&&n!==void 0?n:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=c/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[u]=v;else{var g;a.contentItems[p].config[u]=((g=a.contentItems[p].config[u])!==null&&g!==void 0?g:0)+f}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}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=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 up=Object.freeze(Object.defineProperty({__proto__:null,Container:Ci,ItemContainer:Ci},Symbol.toStringTag,{value:"Module"}));function Ml(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function jl(r){if(window.location.hash)return Ml(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 Ri(r){return window.requestAnimationFrame(r)}function dp(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 jr(){return Et()}function cp(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 Fi(r){return N.trim(r.replace(/(<([^>]+)>)/gi,""))}function Ze(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=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 nr extends Ge{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Ze(this,"_eElement",void 0),Ze(this,"_oDocument",void 0),Ze(this,"_eBody",void 0),Ze(this,"_root",void 0),Ze(this,"_destroyAfterMouseUp",void 0),Ze(this,"_nDelay",400),Ze(this,"_timeout",void 0),Ze(this,"timeout",void 0),Ze(this,"_nDistance",10),Ze(this,"_nX",0),Ze(this,"_nY",0),Ze(this,"_nOriginalX",0),Ze(this,"_nOriginalY",0),Ze(this,"_bDragging",!1),this._eElement=e,this._oDocument=N(document),this._eBody=N(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 Sn(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=fp(r,"string");return typeof e=="symbol"?e:e+""}function fp(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 Al{constructor(e,t){Sn(this,"_container",void 0),Sn(this,"_reactComponent",null),Sn(this,"_portalComponent",null),Sn(this,"_originalComponentWillUpdate",void 0),Sn(this,"_initialState",void 0),Sn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,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=$r.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,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,void 0)}_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=N.extend(e,this._container._config.props);return F.createElement(this._reactClass,t)}}var Ar=["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"],pp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function $i(r){if(Ar.length>36)throw new Error("Too many keys in config minifier map");var e={};return Hi(r,e,"_min"),e}function Si(r){if(Ar.length>36)throw new Error("Too many keys in config minifier map");var e={};return Hi(r,e,"_max"),e}function Hi(r,e,t){var n=t==="_min"?gp:bp;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,Ar);e[s]=a}Hi(o,a,t)}else{var l=n(o,pp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=n(i,Ar);e[u]=l}}}}function gp(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function bp(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function ii(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 wi{constructor(e,t){ii(this,"name",void 0),ii(this,"origin",void 0),ii(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function vr(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=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)}let Ll=class extends Ge{constructor(e){super(),vr(this,"_layoutManager",void 0),vr(this,"_dontPropagateToParent",void 0),vr(this,"_childEventSource",void 0),vr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ge.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),N(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(){N(window).off("gl_child_event",this._boundOnEventFromChild)}};function Rl(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function Fl(r){return(e,t)=>Rl(e,r,t)}function $l(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 Hl(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 Jt(r){return{listen:Fl(r),emit:$l(r),useListener:Hl(r)}}const Ep=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:wi,DragListener:nr,EventEmitter:Ge,EventHub:Ll,ReactComponentHandler:Al,animFrame:Ri,filterXss:cp,getHashValue:Ml,getQueryStringParam:jl,getUniqueId:jr,listenForEvent:Rl,makeEmitFunction:$l,makeEventFunctions:Jt,makeListenFunction:Fl,makeUseListenerFunction:Hl,minifyConfig:$i,removeFromArray:dp,stripTags:Fi,unminifyConfig:Si},Symbol.toStringTag,{value:"Module"}));function $t(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 Bl extends Ge{constructor(e,t,n,i,o){super(),$t(this,"isInitialised",!1),$t(this,"_config",void 0),$t(this,"_dimensions",void 0),$t(this,"_parentId",void 0),$t(this,"_indexInParent",void 0),$t(this,"_layoutManager",void 0),$t(this,"_popoutWindow",null),$t(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,c,h;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:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.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=N.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;N(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-"+jr();e=$i(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=_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 yn extends Ge{constructor(e,t,n,i,o,a){var s,l,u,c,h,v,f,p;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=N(yn._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",Fi((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(),N(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,E;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((E=this._proxyTab.outerHeight(!0))!==null&&E!==void 0?E:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(c=P==null?void 0:P.top)!==null&&c!==void 0?c:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(p=this.element.height())!==null&&p!==void 0?p: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(yn,"_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 fr(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=Ip(r,"string");return typeof e=="symbol"?e:e+""}function Ip(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 Ul{constructor(e,t,n){fr(this,"_element",void 0),fr(this,"_itemConfig",void 0),fr(this,"_layoutManager",void 0),fr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new nr(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(N.extend(!0,{},n));new yn(e,t,this._dragListener,this._layoutManager,i,null)}}function pr(r,e,t){return(e=Dp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dp(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 Wl{constructor(e,t,n){pr(this,"_element",N(window)),pr(this,"_itemConfig",void 0),pr(this,"_layoutManager",void 0),pr(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 nr(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(N.extend(!0,{},n));new yn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Vl(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=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 rr{constructor(){Vl(this,"element",N(rr._template)),N(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()}}Vl(rr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function oi(r,e,t){return(e=jp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jp(r){var e=Ap(r,"string");return typeof e=="symbol"?e:e+""}function Ap(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{constructor(e,t,n,i){oi(this,"element",void 0),oi(this,"_header",void 0),oi(this,"_action",void 0),this._header=e,this.element=N('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function Lp(r,e,t){return(e=Rp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rp(r){var e=Fp(r,"string");return typeof e=="symbol"?e:e+""}function Fp(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 dn extends Error{constructor(e,t){super(),Lp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const $p=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:dn},Symbol.toStringTag,{value:"Module"}));function Pe(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)}function cn(r){return r.isStack}function et(r){return r.isComponent}function Kl(r){return r.isRoot}class De extends Ge{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(Ge.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,cn(this)&&this.header.tabs[i].setContentItem(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&&et(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 wi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new dn("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(Nl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof wi&&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,Ri(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Rn(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 zl 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,N()),Rn(this,"config",void 0),Rn(this,"componentName",void 0),Rn(this,"container",void 0),Rn(this,"parent",void 0),Rn(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=N.extend(!0,{},this.config.componentState||{});if(o==null)throw new dn('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 Ci(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 ut(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 Zn extends De{constructor(e,t,n,i){super(t,n,i,N('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ut(this,"isRow",void 0),ut(this,"isColumn",void 0),ut(this,"childElementContainer",void 0),ut(this,"parent",void 0),ut(this,"_splitter",[]),ut(this,"_splitterSize",void 0),ut(this,"_splitterGrabSize",void 0),ut(this,"_isColumn",void 0),ut(this,"_dimension",void 0),ut(this,"_splitterPosition",null),ut(this,"_splitterMinPosition",null),ut(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 c;l=this.contentItems[0],this.contentItems=[],(c=this.parent)===null||c===void 0||c.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,c,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));a+=h,s.push(h)}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(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var h=u.itemSizes[c];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<n.length;f++){l=n[f];var p=Math.round((l.width-t)*v);a-=p,l.width-=p}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 Gl(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,c=this._getMinimumDimensions((n=a.after.config.content)!==null&&n!==void 0?n:[]),h=this._isColumn?c.vertical:c.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)-(h||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,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((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]=c*h,s.after.config[this._dimension]=(1-c)*h,e.element.css({top:0,left:0}),Ri(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}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){Ei(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 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 Pi extends De{constructor(e,t,n){super(e,Ca(Ca({},t),{},{type:"root"}),null,N('<div class="lm_goldenlayout lm_item lm_root"></div>')),Ei(this,"childElementContainer",void 0),Ei(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(et(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 Zn)||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 c,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((c=h.config[a])!==null&&c!==void 0?c:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}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 wn(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){tt(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 tt(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=Xp(r,"string");return typeof e=="symbol"?e:e+""}function Xp(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 Ti extends De{constructor(e,t,n){var i,o,a,s,l,u,c,h,v;super(e,t,n,N('<div class="lm_item lm_stack"></div>')),tt(this,"_activeContentItem",null),tt(this,"_header",void 0),tt(this,"childElementContainer",N('<div class="lm_items"></div>')),tt(this,"header",void 0),tt(this,"parent",void 0),tt(this,"isStack",!0),tt(this,"_dropSegment",null),tt(this,"_contentAreaDimensions",null),tt(this,"_dropIndex",void 0),tt(this,"_side",void 0),tt(this,"_sided",!1),tt(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(h=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=wn(wn({},this._header),f.header)),t.header&&(this._header=wn(wn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=wn(wn({},this._header),t.content[0].header)),this.header=new jt(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),et(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 Zn&&(t&&this.parent.isColumn||n&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(et(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+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 h,v=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.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,c,h,v,f,p,g,b,w,E=this.header.tabs.length;if(E===0){var P,$,Z,re,Y,M,R,ee,z=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:($=z==null?void 0:z.left)!==null&&$!==void 0?$:0,x2:((Z=z==null?void 0:z.left)!==null&&Z!==void 0?Z:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((M=(R=this.header.element.offset())===null||R===void 0?void 0:R.top)!==null&&M!==void 0?M:0)+((ee=this.header.element.innerHeight())!==null&&ee!==void 0?ee:0)});return}var j=this.header.tabsContainer,G=(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(!(!G||!W)){e<G.left?e=G.left+1:e>G.right&&(e=G.right-1);var A,U;if(!(W.left<e&&e<W.right)){for(var V=0;V<E;V++){var fe;if(A=this.header.tabs[V].element,U=(fe=A.get(0))===null||fe===void 0?void 0:fe.getBoundingClientRect(),U&&U.left<e&&e<U.right){this._dropIndex=V;break}}if(A&&U&&e<U.left+U.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var qe;this._dropIndex=Math.min(((qe=this._dropIndex)!==null&&qe!==void 0?qe:0)+1,E),A.after(this.layoutManager.tabDropPlaceholder)}}var Me=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;Me=Math.max(Me,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var y=Me+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((u=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:Me,x2:y,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f: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 Zp=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:De,Component:zl,ContentItem:De,Root:Pi,RowOrColumn:Zn,Stack:Ti,isComponent:et,isRoot:Kl,isStack:cn},Symbol.toStringTag,{value:"Module"}));function kt(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=Qp(r,"string");return typeof e=="symbol"?e:e+""}function Qp(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 ir{constructor(e,t){var n;kt(this,"header",void 0),kt(this,"contentItem",void 0),kt(this,"element",N(ir._template)),kt(this,"titleElement",void 0),kt(this,"closeElement",void 0),kt(this,"isActive",!1),kt(this,"_layoutManager",void 0),kt(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 nr(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),et(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)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}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),et(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 yn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){N(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){et(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&&et(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):et(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),et(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(),et(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()}}kt(ir,"_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=Jp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jp(r){var e=eg(r,"string");return typeof e=="symbol"?e:e+""}function eg(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 jt extends Ge{constructor(e,t){var n,i;super(),se(this,"layoutManager",void 0),se(this,"element",N(jt._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",N(jt._nextButtonTemplate)),se(this,"tabPreviousButton",N(jt._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 ir(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,c;l.scrollLeft=(u=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.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(c=>{var h,v,f=o||c,p=c-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(h=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$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(),N(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 Un(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 Un(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 Un(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 Un(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"),N(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"),N(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 c=(s+l+u.length)%u.length;c!==s;){if(u.eq(c).css("display")!=="none")return c;c=(c+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(),N(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=N(window).height())!==null&&n!==void 0?n:0,l=(i=N(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<s-u.bottom,h=!c&&u.bottom>s*.6,v=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,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(jt,"_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(jt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));se(jt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Fn(r,e,t){return(e=tg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tg(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)}class Gl{constructor(e,t,n){Fn(this,"_isVertical",void 0),Fn(this,"_size",void 0),Fn(this,"_grabSize",void 0),Fn(this,"_dragListener",void 0),Fn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new nr(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=N('<div class="lm_drag_handle"></div>'),t=N('<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 rg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Bl,DragProxy:yn,DragSource:Ul,DragSourceFromEvent:Wl,DropTargetIndicator:rr,Header:jt,HeaderButton:Un,Splitter:Gl,Tab:ir},Symbol.toStringTag,{value:"Module"}));var ig={config:ip,container:up,controls:rg,errors:$p,items:Zp,utils:Ep};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 Ye(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){le(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 le(r,e,t){return(e=og(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function og(r){var e=ag(r,"string");return typeof e=="symbol"?e:e+""}function ag(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 Ea=["column","row","stack","component"];class Vr extends Ge{static isLayoutItemConfig(e){return Ea.includes(e.type)}static minifyConfig(e){return $i(e)}static unminifyConfig(e){return Si(e)}constructor(e,t){super(),le(this,"isInitialised",!1),le(this,"_isFullPage",!1),le(this,"_resizeTimeoutId",void 0),le(this,"_components",{"lm-react-component":Al}),le(this,"_fallbackComponent",void 0),le(this,"_itemAreas",[]),le(this,"_maximisedItem",null),le(this,"_maximisePlaceholder",N('<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 Ll(this)),le(this,"config",void 0),le(this,"container",void 0),le(this,"_originalContainer",void 0),le(this,"dropTargetIndicator",null),le(this,"tabDropPlaceholder",N('<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&&N("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:Ye({},this.config.settings),dimensions:Ye({},this.config.dimensions),labels:Ye({},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){N(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 rr,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(),N(window).off("resize",this._onResize),N(window).off("unload beforeunload",this._onUnload),N(window).off("blur.lm").off("focus.lm"),N(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 dn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Vr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Ea.join(","),new dn(i);return e.type==="component"&&!(t instanceof Ti)&&t&&!(this.isSubWindow===!0&&t instanceof Pi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:jr(),e.type==="stack"?new Ti(this,e,t):e.type==="row"?new Zn(!1,this,e,t):e.type==="column"?new Zn(!0,this,e,t):new zl(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=jr();for(var u=e.parent,c=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;c=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(c)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,E=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+E.left,top:w+E.top,width:(p=e.element.width())!==null&&p!==void 0?p: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 Bl(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 Ul(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Wl(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=Ye({},this.root._$getArea()),n=[Ye(Ye({},t),{},{side:"left",x2:t.x1+e}),Ye(Ye({},t),{},{side:"right",x1:t.x2-e}),Ye(Ye({},t),{},{side:"top",y2:t.y1+e}),Ye(Ye({},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(cn(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=Ye(Ye({},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(N.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&&N(window).resize(this._onResize),N(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=jl("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Si(e),localStorage.removeItem(n));var i=N.extend(!0,{},Dl,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=N('<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=Fi((e=this.config.content[0].title)!==null&&e!==void 0?e:""),N("head").append(N("body link, body style, template, .gl_keep")),this.container=N("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?N(this._originalContainer):N("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,N("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 dn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new dn(t,e);this.root=new Pi(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=>{cn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}le(Vr,"__lm",ig);const Pa={"tab-height":"28px","drag-border-width":"5px"},Ta=Object.freeze({tabHeight:parseInt(Pa["tab-height"],10),dragBorderWidth:parseInt(Pa["drag-border-width"],10)});function _a(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 Dt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(n){ql(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ql(r,e,t){return(e=sg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sg(r){var e=lg(r,"string");return typeof e=="symbol"?e:e+""}function lg(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 Ht=B.module("LayoutUtils");function Xl(r){return r.componentName!==void 0}function Kt(r){var e=r;return(Xl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function gr(r){return r.focus!==void 0}function Oa(r){return r.type==="stack"}class x{static activateTab(e,t){var n=x.getStackForRoot(e,t,!1);if(!n){Ht.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 Ht.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(Kl(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,c,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(c=s.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(s,h),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&&cn(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(cn(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&&cn(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&&Zi(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&&Zi(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(Kt(o)){var s=t(o.component,o);s!=null?n.push(s):Ht.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=Dt(Dt({},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?(Oa(n)&&delete n.activeItemIndex,x.dropLayoutMinorChange(i)):Kt(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),Gn(i,o)):Gn(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(Kt(o)){var a,{component:s,props:l={}}=o;n.push(Dt(Dt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Et(),props:t(s,l)}))}else if(o.content!==void 0){var u=x.hydrateLayoutConfig(o.content,t);Oa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ht.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(Dt(Dt({},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,c=Dt({},t);if(c.id==null&&(c.id=Et()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var h=o||{id:c.id,component:c.component};L(e);var v=n??(a?x.addStack(e):x.getStackForRoot(e,h));L(v);var f=x.getContentItemInStack(v,h);if(s!=null){var p=b=>{Ht.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:w}=b.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(c,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(c);s==null&&u&&gr(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&&gr(i)&&i.focus()}static closeComponent(e,t,n){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){Ht.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(et(o)?o.container.close(n):i.removeChild(o)),a&&document.contains(a)&&gr(a)&&a.focus()}static renameComponent(e,t,n){var i=x.getStackForRoot(e,t,!1);if(!i){Ht.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 Ht.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:Dt(Dt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Et()};return x.openComponentInStack(n,a),a}static getPanelComponentState(e){if(Xl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Kt(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Ta.tabHeight,borderWidth:Ta.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&&Kt(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:(gr(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)})}}ql(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var ug=F.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.']})})});ug.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:jC,emit:dg,useListener:AC}=Jt(ie.OPEN),Kr=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:cg,emit:LC,useListener:RC}=Jt(Kr.CYCLE_TO_NEXT_STACK),{listen:hg,emit:FC,useListener:$C}=Jt(Kr.CYCLE_TO_PREVIOUS_STACK),{listen:mg,emit:HC,useListener:BC}=Jt(Kr.CYCLE_TO_NEXT_TAB),{listen:vg,emit:UC,useListener:WC}=Jt(Kr.CYCLE_TO_PREVIOUS_TAB);function fg(r){return typeof r.id=="string"&&r.layout instanceof Vr&&r.panelManager instanceof Bi&&typeof r.registerComponent=="function"}function pg(r){if(!fg(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function xa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ia(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(n){Mt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e,t){return(e=gg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function gg(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 dt=B.module("PanelManager"),sn=function(r){return r[r.Next=0]="Next",r[r.Previous=1]="Previous",r}(sn||{});class Bi{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(cg(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(hg(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(mg(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(vg(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&&Kt(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=>Ir(n)&&t instanceof n.WrappedComponent||!Ir(n)&&t instanceof n))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){dt.error("updatePanel Panel did not have an ID",e);return}dt.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){dt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){dt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){dt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}dt.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){dt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){dt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){dt.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===sn.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,c=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack(sn.Next)}handleCycleToPreviousStack(){this.cycleStack(sn.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===sn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(sn.Next)}handleCycleToPreviousTab(){this.cycleTab(sn.Previous)}handleReopen(e,t){dt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var o=Ia(Ia({},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){dt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){dt.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&&Kt(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(Bi,"MAX_CLOSED_PANEL_COUNT",100);var yg=B.module("PanelErrorBoundary");class Cg 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);yg.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(fn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}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 Lr(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){Sg(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 Sg(r,e,t){return(e=wg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wg(r){var e=Eg(r,"string");return typeof e=="symbol"?e:e+""}function Eg(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 Zl(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),Lr(Lr({},r),{},{componentState:null,props:o,type:"react-component"})}function Yl(r,e){return Lr(Lr({},r),{},{localDashboardId:e})}const Pg={dehydrate:Zl,hydrate:Yl};var Ql=F.createContext(void 0);Ql.displayName="LayoutManagerContext";var Tg=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}),Jl=be.shape({on:be.func,off:be.func,emit:be.func}),_g=be.shape({registerComponent:be.func,root:be.shape({addChild:be.func}),on:be.func,off:be.func,eventHub:Jl}),VC=Object.freeze({Container:Tg,EventHub:Jl,Layout:_g});function $n(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.");F.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Le(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var eu="SET_DASHBOARD_DATA";const Og=pm(eu,{},!1),xg={dashboardData:Og};var Ig=new Map,tu=Object.freeze({}),Dg=Object.freeze([]),KC=xi,kg=us,zC=ju,Ng=r=>r.dashboardData,$e=(r,e)=>{var t;return(t=Ng(r)[e])!==null&&t!==void 0?t:tu},GC=(r,e)=>{var t;return(t=$e(r,e).closed)!==null&&t!==void 0?t:Dg},qC=(r,e)=>{var t;return(t=$e(r,e).openedMap)!==null&&t!==void 0?t:Ig},nu=(r,e)=>{var t;return(t=$e(r,e).pluginDataMap)!==null&&t!==void 0?t:tu},XC=(r,e,t)=>nu(r,e)[t];function ka(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 _n(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ka(Object(t),!0).forEach(function(n){Mg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ka(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mg(r,e,t){return(e=jg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jg(r){var e=Ag(r,"string");return typeof e=="symbol"?e:e+""}function Ag(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 ru=(r,e)=>({type:eu,id:r,payload:e}),en=(r,e)=>(t,n)=>t(ru(r,_n(_n({},$e(n(),r)),e))),ZC=(r,e,t)=>(n,i)=>n(ru(r,_n(_n({},$e(i(),r)),{},{pluginDataMap:_n(_n({},nu(i(),r)),{},{[e]:t})})));Object.entries(xg).map(r=>{var[e,t]=r;return yd.register(e,t)});var iu=m.createContext(null);iu.displayName="PersistentStateContext";function br(r,e){return"".concat(r,"::").concat(e)}function Lg(r){var{initialState:e,onChange:t,children:n}=r,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),[a]=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=m.useRef(new Map),l=m.useCallback((p,g,b)=>{var{type:w}=b,E=br(g,w),P=s.current.get(E);if(P!=null&&P!==p)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));s.current.set(E,p),i.current&&a.get(E)!==b&&(a.set(E,b),t([...a.entries()]))},[i,t,a]),u=m.useRef(e[Symbol.iterator]()),c=m.useCallback((p,g)=>{var b=br(p,g),w=a.get(b);if(w==null&&o.current){var{value:E}=u.current.next(),P=E;return a.set(b,P),P}return w},[a]),h=m.useCallback((p,g,b)=>{var w=br(g,b),E=s.current.get(w);E===p&&(a.delete(w),s.current.delete(w),i.current&&t([...a.entries()]))},[i,t,a]),v=m.useCallback((p,g,b)=>{var w=br(g,b),E=s.current.get(w);E===p&&s.current.delete(w)},[]),f=m.useMemo(()=>({addState:l,removeState:h,deregisterHook:v,getState:c}),[l,c,h,v]);return d.jsx(iu.Provider,{value:f,children:n})}var Rg=B.module("DashboardPanelWrapper");function Fg(r){var{glContainer:e,children:t}=r,n=m.useCallback(a=>{e.setPersistedState(a)},[e]),{persistedState:i}=e.getConfig(),[o]=m.useState(()=>i!=null&&!Array.isArray(i)?(Rg.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return d.jsx(Lg,{initialState:o,onChange:n,children:t})}var Ui=m.createContext(null);Ui.displayName="PanelIdContext";function $g(){return m.useContext(Ui)}function Na(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function nn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(n){Hg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hg(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=Ug(r,"string");return typeof e=="symbol"?e:e+""}function Ug(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 yr=B.module("DashboardLayout"),Wg=Object.freeze({}),Vg=[],Ma=()=>{},Kg=1e3,ja=r=>r;function YC(r){var e,t,{id:n,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=Vg,onLayoutChange:l=Ma,onLayoutInitialized:u=Ma,hydrate:c=Yl,dehydrate:h=Zl,panelWrapper:v}=r,f=xi(),p=(e=us(y=>$e(y,n)))!==null&&e!==void 0?e:Wg,[g,b]=m.useState(!1),[w,E]=m.useState(!1),[P,$]=m.useState(),[Z]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[re,Y]=m.useState(a.getReactChildren()),M=m.useMemo(()=>new Map,[]),R=m.useMemo(()=>new Map,[]),ee=m.useCallback(function(y,S){var _,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h;yr.debug2("registerComponent",y,S,K,ne);function at(X,ae){var he=S,je=v,Ot=qs(he),Ct=Ot?d.jsx(he,nn(nn({},X),{},{ref:ae})):d.jsx(he,nn({},X)),{glContainer:ur,glEventHub:Ln}=X,bu=x.getIdFromContainer(ur);return d.jsx(Cg,{glContainer:ur,glEventHub:Ln,children:d.jsx(Ui.Provider,{value:bu,children:d.jsx(Fg,nn(nn({},X),{},{children:je==null?Ct:d.jsx(je,nn(nn({},X),{},{children:Ct}))}))})})}at.displayName="DashboardWrapper(".concat((_=S.displayName)!==null&&_!==void 0?_:y,")");var I=a.registerComponent(y,F.forwardRef(at));return M.set(y,K),R.set(y,ne),I},[c,h,M,R,a,v]),z=m.useCallback((y,S)=>{var _;return((_=M.get(y))!==null&&_!==void 0?_:ja)(S,n)},[M,n]),j=m.useCallback((y,S)=>{var _;return((_=R.get(y))!==null&&_!==void 0?_:ja)(S,n)},[R,n]),G=m.useMemo(()=>new Bi(a,z,j,new Map,Z,y=>{var{closed:S,openedMap:_}=y;f(en(n,{closed:S,openedMap:_}))}),[j,f,z,n,Z,a]),W=yc(y=>{var S=P==null||!x.isEqual(P,y);yr.debug("handleLayoutStateChanged",S,y),S&&(b(a.root.contentItems.length===0),$(y),l(y),Y(a.getReactChildren()))},Kg,{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]),U=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DRAGGING,S),E(!0)},[a.eventHub]),V=m.useCallback(y=>{var S=x.getIdFromContainer(y);a.eventHub.emit(ie.DROPPED,S),E(!1)},[a.eventHub]),fe=m.useCallback(y=>{if(yr.debug2("handleComponentCreated",y),!(y==null||y.config==null||!Kt(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(_)}},[]),qe=m.useCallback(()=>{Y(a.getReactChildren())},[a]);Le(a,"stateChanged",A),Le(a,"itemPickedUp",U),Le(a,"itemDropped",V),Le(a,"componentCreated",fe),Le(a.eventHub,ie.TITLE_CHANGED,A),Le(a,"reactChildrenChanged",qe);var Me=bc(s);return m.useEffect(function(){if(Me!==s&&s!==P){yr.debug("Setting new layout content...");for(var S=x.hydrateLayoutConfig(s,z);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)}},[z,a,s,P,G,Me]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,re,F.Children.map(i,y=>y!=null?d.jsx(Ah,{fallback:[],children:F.cloneElement(y,{id:n,layout:a,panelManager:G,registerComponent:ee})}):null)]})}var ou=m.createContext(null);ou.displayName="DashboardIdContext";function QC(){var r=m.useContext(ou);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function zg(r,e,t){return(e=Gg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gg(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)}function au(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=au(n,e,t);if(i)return i;n=n.sibling}}}function Xg(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}var Wi=Xg(m.createContext(null));Wi.displayName="FiberContext";class JC extends m.Component{constructor(){super(...arguments),zg(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Wi.Provider,{value:this._reactInternals,children:e})}}function Zg(){var r=m.useContext(Wi);if(r===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>Et()),t=m.useMemo(()=>{for(var n of[r,r==null?void 0:r.alternate].filter(o=>o!=null)){var i=au(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 e0="default",Yg="CREATE_DASHBOARD",Qg="CLOSE_DASHBOARD",{listen:t0,emit:n0,useListener:r0}=Jt(Yg),{listen:i0,emit:Jg,useListener:o0}=Jt(Qg);function eb(r,e,t){return(e=tb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tb(r){var e=nb(r,"string");return typeof e=="symbol"?e:e+""}function nb(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 su 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})}}eb(su,"defaultProps",{additionalActions:[]});var rb=r=>({workspace:ll(r)}),ib=Mn(rb,{setWorkspace:dl})(su);function lu(r,e,t){return(e=ob(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ob(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)}class uu extends m.PureComponent{constructor(e){super(e),lu(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=F.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:q("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(Hr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}lu(uu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var Cr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Aa(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 ub=B.module("Panel");class db extends m.PureComponent{constructor(e){super(e),Aa(this,"ref",void 0),Aa(this,"getAdditionalActions",Xt((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=F.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(Cr.focus,this.handleTabFocus),i.on(Cr.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(Cr.focus,this.handleTabFocus),n.off(Cr.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){ub.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=Is,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:c=!1,isRenamable:h=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:q("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(fn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&$r.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(ib,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,c,h)}),h&&d.jsx(uu,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(ce,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var cb=tl(db),hb=B.module("useDhId"),ai="__dhId";function a0(){var r,e,t=(r=(e=Zg())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[ai],i=$g();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(ai," to be a string, but got ").concat(typeof n));return n}return i??(hb.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ai," prop. Defaulting to null.")),null)}function or(r,e,t){return(e=mb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mb(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 Ne{}or(Ne,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");or(Ne,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");or(Ne,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");or(Ne,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");or(Ne,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function tn(r,e,t){return(e=fb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fb(r){var e=pb(r,"string");return typeof e=="symbol"?e:e+""}function pb(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 Tt{}tn(Tt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");tn(Tt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");tn(Tt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");tn(Tt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");tn(Tt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");tn(Tt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");tn(Tt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");tn(Tt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const s0=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Lt(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 J{}Lt(J,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Lt(J,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Lt(J,"CLOSE_FILE","NotebookEvent.closeFile");Lt(J,"RENAME","NotebookEvent.rename");Lt(J,"RENAME_FILE","NotebookEvent.renameFile");Lt(J,"REGISTER_FILE","NotebookEvent.registerFile");Lt(J,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Lt(J,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Lt(J,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var yb=["children"];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 Ra(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){Cb(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 Cb(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=wb(r,"string");return typeof e=="symbol"?e:e+""}function wb(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 Eb(r,e){if(r==null)return{};var t,n,i=Pb(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 Pb(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 Tb 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(Ne.SESSION_CLOSED,this.handleSessionClosed),e.on(Ne.SESSION_OPENED,this.handleSessionOpened),e.on(Tt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.SESSION_CLOSED,this.handleSessionClosed),e.off(Ne.SESSION_OPENED,this.handleSessionOpened),e.off(Tt.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=Eb(e,yb);return d.jsx(cb,Ra(Ra({},n),{},{children:t}))}}var ar=tl(Tb);const l0=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var _b=Object.freeze({}),Ob=new Map,zr=Object.freeze([]),u0=(r,e)=>{var t;return(t=$e(r,e).columns)!==null&&t!==void 0?t:zr},d0=(r,e)=>{var t;return(t=$e(r,e).filterSets)!==null&&t!==void 0?t:zr},c0=(r,e)=>{var t;return(t=$e(r,e).filters)!==null&&t!==void 0?t:zr},h0=(r,e)=>{var t;return(t=$e(r,e).tableMap)!==null&&t!==void 0?t:Ob},m0=(r,e)=>$e(r,e).isolatedLinkerPanelId,du=(r,e)=>{var t;return(t=$e(r,e).links)!==null&&t!==void 0?t:zr},v0=(r,e)=>$e(r,e).columnSelectionValidator,f0=(r,e)=>{var t;return(t=$e(r,e).consoleSettings)!==null&&t!==void 0?t:_b},p0=(r,e)=>$e(r,e).connection,sr=(r,e)=>$e(r,e).sessionWrapper,g0=(r,e)=>t=>t(en(r,{connection:e})),b0=(r,e)=>t=>t(en(r,{sessionWrapper:e})),cu=(r,e)=>t=>t(en(r,{links:e})),y0=(r,e)=>(t,n)=>{var i=du(n(),r),o=e.filter(a=>i.findIndex(s=>Gn(s.start,a.start)&&Gn(s.end,a.end))<0);return t(cu(r,i.concat(o)))},C0=(r,e)=>(t,n)=>{var i=du(n(),r),o=i.filter(a=>!e.includes(a.id));return t(cu(r,o))},S0=(r,e)=>t=>t(en(r,{isolatedLinkerPanelId:e})),w0=(r,e)=>t=>t(en(r,{columnSelectionValidator:e})),xb=(r,e)=>t=>t(en(r,{consoleSettings:e})),E0=(r,e)=>t=>t(en(r,{filterSets:e}));function Rr(r,e,t){return(e=Ib(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ib(r){var e=Db(r,"string");return typeof e=="symbol"?e:e+""}function Db(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 Sr=B.module("CommandHistoryPanel");class lr extends m.Component{static handleError(e){Sr.error(e)}constructor(e){super(e),Rr(this,"container",void 0),Rr(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=F.createRef(),this.pending=new Qn;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(Ne.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.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(Sr.debug("handleSendToNotebook",n,e),!n){Sr.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;Sr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Ne.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(lr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(ar,{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})]})]})}}Rr(lr,"COMPONENT","CommandHistoryPanel");Rr(lr,"TITLE","Command History");var kb=(r,e)=>{var t=al(r),n=sr(r,e.localDashboardId),{session:i,config:o}=n??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Nb=Mn(kb,null,null,{forwardRef:!0})(lr),hu=m.createContext(null);hu.displayName="PluginsContext";var An=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function Mb(r){return"DashboardPlugin"in r}function jb(r){return"AuthPlugin"in r}function Ab(r){return"TablePlugin"in r}function P0(r){return Mb(r)||jb(r)||Ab(r)}function Lb(r){return"type"in r&&r.type===An.DASHBOARD_PLUGIN}function Vi(r){return"type"in r&&r.type===An.WIDGET_PLUGIN}function Rb(r){return"type"in r&&r.type===An.TABLE_PLUGIN}function Fb(r){return"type"in r&&r.type===An.AUTH_PLUGIN}function mu(r){return"type"in r&&r.type===An.THEME_PLUGIN}function vu(r){return"type"in r&&r.type===An.ELEMENT_PLUGIN}function T0(r){return Lb(r)||Fb(r)||Rb(r)||mu(r)||Vi(r)||vu(r)}var fu=B.module("@deephaven/plugin.PluginUtils");function Fa(r,e){return r==null||!Vi(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function $b(r){var e=d.jsx(ve,{icon:bs});if(!Vi(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function _0(r){var e=[...r.entries()].filter(t=>mu(t[1]));return fu.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:Cd(n,s),name:s,styleContent:u}})}).flat()}function O0(r){var e=[...r.entries()].filter(t=>vu(t[1])&&t[1].mapping!=null);return fu.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function x0(){return er(hu,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function $a(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 wr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$a(Object(t),!0).forEach(function(n){hn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):$a(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hn(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 Er=B.module("ConsolePanel"),Ub=500,Wb=Object.freeze({consoleSettings:{},itemIds:[]});class Gr extends m.PureComponent{constructor(e){super(e),hn(this,"consoleRef",void 0),hn(this,"objectSubscriptionCleanup",void 0),hn(this,"savePanelState",vn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Er.debug("Saving panel state",l),this.setState({panelState:l})},Ub)),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=F.createRef();var{panelState:t}=e,n=wr(wr({},Wb),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=>{Er.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,u=[...a,...l],c=new Map(o);u.forEach(v=>{var{title:f}=v;f!==void 0&&c.delete(f)});var h=[...a,...s];return h.forEach(v=>{v.title!==void 0&&c.set(v.title,v)}),{objectMap:c}})})}}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=Et(),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(Ne.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),Jg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Er.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ne.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:wr(wr({},tm(e)),{},{sessionId:i.id})};Er.debug("openWidget",l),dg(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=>Fa(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>Fa(i,e));return n!=null?$b(n):d.jsx(cl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(fn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:c,session:h,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:w,type:E}=c;return d.jsx(ar,{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:h!=null&&d.jsx(qt,{dh:p,ref:this.consoleRef,settings:s,session:h,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:E,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:ml.LANGUAGE_MAP.get(E)}),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(np,{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})})}}hn(Gr,"COMPONENT","ConsolePanel");hn(Gr,"TITLE","Console");hn(Gr,"contextType",Ql);var Vb=(r,e)=>({commandHistoryStorage:al(r),sessionWrapper:sr(r,e.localDashboardId),timeZone:im(r),plugins:om(r)}),si=Mn(Vb,null,null,{forwardRef:!0})(Gr);function I0(r){return r==="file"||r==="directory"}function gt(r){return r.type==="directory"}function Kb(r,e,t){return(e=zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zb(r){var e=Gb(r,"string");return typeof e=="symbol"?e:e+""}function Gb(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 Ki extends Error{constructor(){super("No file exists at the path specified"),Kb(this,"isFileNotFound",!0)}}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 ln=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 k{static fileExists(e,t){return Ba(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Ki))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(!k.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 Ba(function*(){for(var n=k.getCopyFileName(t);yield k.fileExists(e,n);)n=k.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return ln.GROOVY;case"py":return ln.PYTHON;case"pyc":return ln.PYTHON_COMPILED;case"scala":return ln.SCALA;case"txt":return ln.PLAIN_TEXT;default:return ln.UNKNOWN}}static getParent(e){if(!k.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(!k.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=k.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Vn("Name cannot be empty");if(t.includes(e))throw new Vn('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,a;throw new Vn('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=>k.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 zi=26;function _i(r){return gt(r)?k.makePath(r.filename):k.getPath(r.filename)}function Ua(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=_i(e);if(r.some(n=>{var{filename:i}=n;return k.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>gt(n)&&t.startsWith(k.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function qb(r){if(gt(r))return r.isExpanded?Sd:wd;var e=k.getMimeType(r.basename);switch(e){case ln.PYTHON:return Pd;default:return Ed}}function Oi(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:c,onDragOver:h,onDragEnd:v,onDragExit:f,onDrop:p}=r,g=(e=n==null?void 0:n.some(M=>M.id===s.id))!==null&&e!==void 0?e:!1,b=_i(s),w=i&&u?_i(u):null,E=i&&o&>(s)&&w===b,P=i&&o&&w===b,$=i&&!o&&w===b,Z=qb(s),re=k.getDepth(s.filename),Y=Array(re).fill(null).map((M,R)=>d.jsx("span",{className:"file-list-depth-line"},R));return d.jsxs("div",{className:q("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":E,"is-in-drop-target":P,"is-invalid-drop-target":$,"is-selected":a}),onDragStart:M=>c(l,M),onDragOver:M=>h(l,M),onDragEnd:M=>v(l,M),onDragExit:f,onDrop:M=>p(l,M),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:Z,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(ce,{children:s.basename})]})})]})}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 Pr(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){Xb(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 Xb(r,e,t){return(e=Zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zb(r){var e=Yb(r,"string");return typeof e=="symbol"?e:e+""}function Yb(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=B.module("FileList"),Qb=500,Va="item-list-scroll-pane";function Jb(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Oi,rowHeight:l=zi,overscanCount:u=bt.DEFAULT_OVERSCAN}=r,[c,h]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,w]=m.useState(),[E,P]=m.useState(),[$,Z]=m.useState([]),re=m.useRef(),Y=m.useRef(null),M=m.useRef(null),R=m.useCallback(I=>{if(I.length===0||c==null)return[];for(var X=[],ae=0;ae<I.length;ae+=1)for(var he=I[ae],je=he[0];je<=he[1];je+=1)je>=c.offset&&je<c.offset+c.items.length&&X.push(c.items[je-c.offset]);return X},[c]),ee=m.useCallback(I=>{var X=R([[I,I]]);if(X.length>0)return X[0]},[R]),z=m.useCallback(()=>{var I=vt.count($);if(I===0)return null;if(I===1){var X=$[0][0],ae=ee(X);if(ae!=null)return ae.filename}return"".concat(I," items")},[ee,$]),j=m.useCallback(I=>{if(!(!b||!p)){He.debug("dropItems",b,"to",I);try{var{files:X,targetPath:ae}=Ua(b,p);if(i==null||i(X,ae),I!=null){var he;Z([[I,I]]),(he=Y.current)===null||he===void 0||he.focusItem(I)}}catch(je){He.error("Unable to complete move",je)}}},[b,p,i]),G=m.useCallback((I,X)=>{var ae=c.items[I-c.offset];ae!==void 0&&(He.debug("handleItemClick",ae),o(ae,X),gt(ae)&&(t==null||t.setExpanded(ae.filename,!ae.isExpanded)))},[c,o,t]),W=m.useCallback((I,X)=>{var ae,he;He.debug2("handleItemDragStart",I,$);var je=$;vt.isSelected($,I)||(je=[[I,I]],Z(je)),w(R(je)),(ae=Y.current)===null||ae===void 0||ae.resetMouseState();var Ot=document.createElement("div"),Ct=document.createElement("div");Ct.className="dnd-placeholder-content",Ct.innerText=(he=z())!==null&&he!==void 0?he:"",Ot.appendChild(Ct),Ot.className="file-list-dnd-placeholder",document.body.appendChild(Ot),X.dataTransfer.setDragImage(Ot,0,0),X.dataTransfer.effectAllowed="move",P(Ot)},[z,R,$]),A=m.useCallback((I,X)=>{X.preventDefault(),He.debug2("handleItemDragOver",X),g(ee(I))},[ee]),U=m.useCallback((I,X)=>{He.debug("handleItemDragEnd",I),E==null||E.remove(),w(void 0),g(void 0),P(void 0)},[E]),V=m.useCallback((I,X)=>{j(I)},[j]),fe=m.useCallback(()=>{He.debug2("handleItemDragExit"),g(void 0)},[]),qe=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Va)&&(I.preventDefault(),He.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Me=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Va)&&(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!==$){Z(I);var ae=R(I);a(ae)}},[R,a,$]),S=m.useCallback(I=>{if(He.debug2("handleFocusChange",I),I!=null){var[X]=R([[I,I]]);n(X)}else n();re.current=I},[R,n]),_=m.useCallback((I,X)=>{He.debug("handleViewportChange",I,X),(I!==v.top||X!==v.bottom)&&f({top:I,bottom:X})},[v]),K=m.useMemo(()=>{if(!b||!p)return!1;try{return Ua(b,p),He.debug("handleValidateDropTarget true"),!0}catch{return He.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:ne}=r;m.useEffect(()=>{ne!==void 0&&(ne==="/"?t.collapseAll():(t.setExpanded(ne,!1),t.setExpanded(ne,!0)))},[t,ne]),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=>{h({items:ae.items.map(he=>Pr(Pr({},he),{},{itemName:he.basename})),offset:ae.offset,itemCount:t.size})});return()=>{X()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),$.length>0&&y($,!0)},[c,S,y,$]),m.useEffect(function(){if(p!=null&>(p)&&p.filename!=="/"){var X=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},Qb);return()=>clearTimeout(X)}},[p,t]);var at=m.useCallback(I=>s(Pr(Pr({},I),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:K,onDragStart:W,onDragEnd:U,onDragOver:A,onDragExit:fe,onDrop:V})),[U,fe,A,W,V,b,p,K,s]);return d.jsx("div",{ref:M,className:q("file-list",{"is-dragging":b!=null}),onDragOver:qe,onDrop:Me,children:d.jsx(bt,{ref:Y,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:S,onSelect:G,onSelectionChange:y,onViewportChange:_,selectedRanges:$,renderItem:at,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var ey={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 Ka={FILE_EXPLORER:ey};var za=B.module("FileListItemEditor"),ty=()=>Promise.resolve();function ny(r){var{item:e,onCancel:t,onSubmit:n,validate:i=ty}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[c,h]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var E;(E=o.current)===null||E===void 0||E.focus()},[o]),f=m.useCallback(E=>E.stopPropagation(),[]),p=m.useCallback(()=>{c.then(()=>{n(a)}).catch(E=>za.info("Unable to validate name",E))},[n,a,c]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>u(void 0)).catch($=>{Te.isCanceled($)||u($)}),h(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{za.debug2("handleBlur"),p()},[p]),b=m.useCallback(E=>{var{value:P}=E.target;s(P)},[]),w=m.useCallback(E=>{E.stopPropagation();var{key:P}=E;switch(P){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:q("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}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 li(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){ry(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 ry(r,e,t){return(e=iy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iy(r){var e=oy(r,"string");return typeof e=="symbol"?e:e+""}function oy(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 pu(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:c,onSelectionChange:h,table:v,rowHeight:f=zi,validateRename:p=()=>Promise.resolve()}=r,[g,b]=m.useState(),[w,E]=m.useState([]),[P,$]=m.useState(),Z=m.useCallback(V=>{E(V),h==null||h(V)},[h]),re=m.useCallback(V=>{$(V)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),M=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),R=m.useCallback(()=>{i==null||i()},[i]),ee=m.useCallback(()=>{P&&(o==null||o(k.getPath(P.filename)))},[P,o]),z=m.useCallback(()=>{P&&b(P)},[P]),j=m.useCallback(()=>{b(void 0)},[]),G=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:R,group:te.groups.medium}),o&&V.push({title:"New Folder",description:"Create new folder",action:ee,group:te.groups.medium}),a&&V.push({title:"Copy File",description:"Copy the selected file",action:Y,group:te.groups.low,disabled:P==null||gt(P)}),s&&w.length>0&&V.push({title:"Delete",description:"Delete",shortcut:Ka.FILE_EXPLORER.DELETE,action:M,group:te.groups.low}),u&&V.push({title:"Rename",description:"Rename",shortcut:Ka.FILE_EXPLORER.RENAME,action:z,group:te.groups.low,disabled:P==null}),V},[Y,M,R,ee,z,P,a,i,o,s,u,w,g]),A=m.useCallback(V=>(L(g),p(g,V)),[g,p]),U=m.useCallback(V=>{var{item:fe}=V;return g&&g.filename===fe.filename?d.jsx(Oi,li(li({},V),{},{children:d.jsx(ny,{item:fe,validate:A,onSubmit:G,onCancel:j})})):d.jsx(Oi,li({},V))},[j,G,g,A]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(Jb,{onMove:l,onSelect:c,onSelectionChange:Z,onFocusChange:re,renderItem:U,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(te,{actions:W})]})}pu.displayName="FileListContainer";function qa(r,e,t){return(e=ay(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ay(r){var e=sy(r,"string");return typeof e=="symbol"?e:e+""}function sy(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 xr extends Vn{constructor(e){super("Name already exists"),qa(this,"isExistingFile",!0),qa(this,"info",void 0),this.info=e}}function Xa(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 Za(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Xa(o,n,i,a,s,"next",l)}function s(l){Xa(o,n,i,a,s,"throw",l)}a(void 0)})}}var St=B.module("FileExplorer");function Gi(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:c,rowHeight:h=zi}=r,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var G;function W(){return A.apply(this,arguments)}function A(){return A=Za(function*(){St.debug("initTable"),G=Te.makeCancelable(e.getTable(),U=>U.close());try{g(yield G)}catch(U){Te.isCanceled(U)||St.error("Unable to initialize table",U)}}),A.apply(this,arguments)}return W(),()=>{G.cancel()}},[e]);var b=m.useCallback(j=>{Te.isCanceled(j)||St.error(j)},[]),w=m.useCallback(()=>{St.debug("handleCreateFile"),s()},[s]),E=m.useCallback(()=>{St.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(j=>{St.debug("handleCopyFile",j.filename),i(j)},[i]),$=m.useCallback(j=>{St.debug("handleDelete, pending confirmation",j),f(j)},[]),Z=m.useCallback(()=>{St.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(gt(j)?k.makePath(j.filename):j.filename)),o(v),f([])},[v,o,e]),re=m.useCallback(()=>{St.debug("handleDeleteCancel"),f([])},[]),Y=m.useCallback((j,G)=>{var W=k.reducePaths(j.map(A=>gt(A)?k.makePath(A.filename):A.filename));W.forEach(A=>{var U=k.isPath(A)?"".concat(G).concat(k.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(G).concat(k.getBaseName(A));e.moveFile(A,U).then(()=>{a(A,U)}).catch(b)})},[b,a,e]),M=m.useCallback((j,G)=>{var W=j.filename,A=gt(j);A&&!W.endsWith("/")&&(W="".concat(W,"/"));var U="".concat(k.getParent(W)).concat(G);A&&!U.endsWith("/")&&(U="".concat(U,"/")),St.debug2("handleRename",W,U),e.moveFile(W,U).catch(b),a(W,U)},[b,a,e]),R=m.useCallback(function(){var j=Za(function*(G,W){if(W!==G.basename){k.validateName(W);var A="".concat(k.getPath(G.filename)).concat(W);try{var U=yield e.info(A);throw new xr(U)}catch(V){if(!(V instanceof Ki))throw V}}});return function(G,W){return j.apply(this,arguments)}}(),[e]),ee=v.length>0,z=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:[p&&d.jsx(pu,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:E,onCreateFile:w,onMove:Y,onDelete:$,onRename:M,onSelect:u,onSelectionChange:c,rowHeight:h,table:p,validateRename:R}),d.jsx(qn,{isOpen:ee,headerText:z,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:Z,confirmButtonText:"Delete"})]})}Gi.displayName="FileExplorer";function Ya(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 ly(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ya(o,n,i,a,s,"next",l)}function s(l){Ya(o,n,i,a,s,"throw",l)}a(void 0)})}}function un(r,e,t){return(e=uy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uy(r){var e=dy(r,"string");return typeof e=="symbol"?e:e+""}function dy(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 rn=B.module("NewItemModal");class mn extends m.PureComponent{static getValidationMessage(e){return e instanceof xr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||rn.error(e)}constructor(e){super(e),un(this,"inputRef",F.createRef()),un(this,"cancelableValidatePromise",void 0),un(this,"cancelableExistingItemPromise",void 0),un(this,"pending",new Qn),un(this,"pathMap",new Map),un(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=k.hasPath(t)?k.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:k.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:k.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=k.hasPath(e)?k.getPath(e):"/";this.setState({path:t,value:k.getBaseName(e),validationError:void 0,prevExtension:k.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 ly(function*(){k.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 xr(l)}catch(u){if(!(u instanceof Ki))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(mn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(rn.debug("handleSelect",e),e.type==="directory")this.setState({path:k.makePath(e.filename)});else{var t=e.basename,n=k.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 Vn))throw e;rn.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;rn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){rn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=k.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){rn.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;rn.debug("submitModal",n,i);var l=k.getExtension(i);return a&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(u=>{if(u instanceof xr&&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(mn.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(F.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:c,validationError:h,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=k.fileExtensionToString(f),w=k.fileExtensionToString(p),E=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(ms,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(vs,{toggle:n,children:o}),d.jsx(fs,{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:q("form-control",{"is-invalid":h}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d.jsx("div",{className:"invalid-feedback",children:mn.getValidationMessage(h)})]}),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(Gi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Ws,{children:[d.jsx(oe,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(oe,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:E})]})]}),d.jsx(qn,{isOpen:c,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(qn,{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,'"')})]})}}un(mn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function cy(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:_s,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(oe,{kind:"ghost",icon:_d,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(Qs,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Qa(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 hy(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Qa(o,n,i,a,s,"next",l)}function s(l){Qa(o,n,i,a,s,"throw",l)}a(void 0)})}}function gu(r,e,t){return(e=my(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function my(r){var e=vy(r,"string");return typeof e=="symbol"?e:e+""}function vy(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 on=B.module("FileExplorerPanel"),fy=(r,e)=>{var t=sl(r),n=sr(r,e.localDashboardId),{session:i,config:o}=n??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},py=Mn(fy,null,null,{forwardRef:!0});function gy(r){var e=r;return e!=null&&typeof e.button=="number"}class Nn extends F.Component{static handleError(e){on.error(e)}static isFocusEvent(e){return gy(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:""};on.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){on.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){on.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Nn.handleError)}handleCopyFile(e){var t=this;return hy(function*(){var{fileStorage:n}=t.props;if(gt(e)){on.error("Invalid item in handleCopyItem",e);return}var i=yield k.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=k.makePath(e[0].filename):t=k.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(on.debug("fileSelect",e),e.type!=="directory"){var n=Nn.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;on.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(ar,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(cy,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Gi,{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(mn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}gu(Nn,"COMPONENT","FileExplorerPanel");gu(Nn,"TITLE","File Explorer");var by=py(Nn);function Yn(r,e,t){return(e=yy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yy(r){var e=Cy(r,"string");return typeof e=="symbol"?e:e+""}function Cy(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 Ja=B.module("LogPanel");class qr extends m.PureComponent{constructor(e){super(e),Yn(this,"isBottomVisible",void 0),Yn(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){Ja.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Ja.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(ar,{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}})]})}}Yn(qr,"defaultProps",{session:null});Yn(qr,"COMPONENT","LogPanel");Yn(qr,"TITLE","Log");var Sy=(r,e)=>{var t;return{session:(t=sr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},wy=Mn(Sy,null,null,{forwardRef:!0})(qr);function es(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 Tr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){es(o,n,i,a,s,"next",l)}function s(l){es(o,n,i,a,s,"throw",l)}a(void 0)})}}function ts(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 Qe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ts(Object(t),!0).forEach(function(n){Re(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ts(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Re(r,e,t){return(e=Ey(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r){var e=Py(r,"string");return typeof e=="symbol"?e:e+""}function Py(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 Ty=m.lazy(()=>xs(()=>import("./MarkdownNotebook-Du5g1GaK.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=B.module("NotebookPanel"),ns=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=k.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),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",Xt((v,f)=>Qe(Qe({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",Xt((v,f,p)=>{var g=[{title:"Find",icon:Id,action:this.handleFind,group:te.groups.high,shortcut:We.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:ps,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:Dd,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:ws,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?On:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:We.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?On: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:p?On: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 Qn,this.debouncedSavePanelState=vn(this.savePanelState.bind(this),ns),this.debouncedLoad=vn(this.load.bind(this),ns),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&&k.hasPath(s.itemName),c=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,h=c?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,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:c}=u;this.renameTab(c,k.getBaseName(s))}var h=Qe(Qe({},t),{},{language:(a=Oe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(h.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:h}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&k.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=Qe(Qe({},a),{},{value:s}),c=Qe(Qe({},a),{},{value:l}),h={settings:c,fileMetadata:i,isPreview:o};return ue.debug("Saving panel state",h),{settings:u,panelState:h}})}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 Tr(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 k.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var c={id:u,itemName:u},h={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,h,c,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Tr(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&&(k.hasPath(o.itemName)&&(yield k.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:Qe(Qe({},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 Tr(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=Qe(Qe({},a.settings),{},{language:o});return ue.debug("handleSaveSuccess",i,s,l),s&&k.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}),k.getBaseName(o)!==k.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,k.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 Tr(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=Qe(Qe({},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(Ne.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:c,error:h,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:w,sessionLanguage:E,settings:P,showCloseModal:$,showDeleteModal:Z,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,M=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:Oe.DEFAULT_NAME,R=M.endsWith(".md"),ee=(b==null?void 0:b.id)!=null,z=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),j=w!=null,G=E===z.language,W=!f||!j||!G,A=!f,U=[{action:this.handleSave,shortcut:zt.SAVE},{action:this.handleMinimapChange,shortcut:We.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:We.NOTEBOOK.WORDWRAP}],V=yi.getDisabledRunTooltip(j,G,"Notebook extension","Run"),fe=yi.getDisabledRunTooltip(j,G,"Notebook extension","Run Selected"),qe=[{title:ee?"Rename":"Save As…",order:10,group:te.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:te.groups.high,order:20}],Me=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[Me!=null&&$r.createPortal(d.jsx("span",{className:q(Oe.UNSAVED_INDICATOR_CLASS_NAME,{[Oe.UNSAVED_STATUS_CLASS_NAME]:u!==c})}),Me),d.jsxs(ar,{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:qe,renderTabTooltip:()=>M,children:[!R&&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:Ts,transform:"grow-4"}),tooltip:"Run ".concat(We.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&d.jsx(ce,{children:V})]}),d.jsxs("span",{children:[d.jsx(oe,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:W,icon:d.jsx(ve,{icon:Od,transform:"grow-4"}),tooltip:"Run Selected ".concat(We.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),fe!=null&&d.jsx(ce,{children:fe})]}),d.jsx(oe,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:xd,tooltip:"Save ".concat(zt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(oe,{kind:"ghost",className:"btn-overflow",disabled:A,icon:Ps,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(tr,{actions:this.getDropdownOverflowActions,popperOptions:Oe.POPPER_OPTIONS})})]}),d.jsx(xl,{isLoaded:f,isLoading:p,error:h,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:E,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:z,focusOnMount:Y,ref:y=>{this.notebook=y}})]}),R&&d.jsx(m.Suspense,{fallback:d.jsx(fn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(Ty,{content:(n=z.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(mn,{isOpen:re,type:"file",defaultValue:M,title:ee?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(qn,{isOpen:Z,headerText:'Are you sure you want to delete "'.concat(M,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(qn,{isOpen:$,headerText:"Do you want to save the changes you made to ".concat(M,"?"),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:U})]})]})}}Re(Oe,"COMPONENT","NotebookPanel");Re(Oe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(Oe,"DEFAULT_NAME","Untitled");Re(Oe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(Oe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(Oe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var _y=(r,e)=>{var t=sl(r),n=ul(r),i=sr(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},an=Mn(_y,{updateNotebookSettings:cm},null,{forwardRef:!0})(Oe);function Oy(){var{python:{linter:r={}}={}}=kg(ul),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function rs(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 is(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rs(Object(t),!0).forEach(function(n){xy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rs(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xy(r,e,t){return(e=Iy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Iy(r){var e=Dy(r,"string");return typeof e=="symbol"?e:e+""}function Dy(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=B.module("ConsolePlugin");function os(r){return r.notebook!==void 0}function ky(r){pg(r)}function D0(r){ky(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),[c,h]=m.useState(new Map);Oy();var v=xi(),f=m.useCallback(()=>i.getLastUsedPanelOfType(si),[i]),p=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)=>{h(_=>new Map(_.set(y,S)))},[h]),w=m.useCallback(y=>{h(S=>(S.delete(y),new Map(S)))},[h]),E=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 ne=f();if(!ne||!(ne instanceof si.WrappedComponent)){ge.error("Console panel not found");return}ge.debug("Send command: ",y,S,_),ne.addCommand(y,S,_)}},[f]),P=m.useCallback(y=>{v(xb(e,y))},[v,e]),$=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},[]),Z=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&&c.has(_))return c.get(_);if(S)return Et()},[l,c]),re=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&&p(S,_)),c.has(y)&&(_=c.get(y),w(y),_!=null&&b(S,_)),_===void 0){ge.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}re(_,k.getBaseName(S))},[l,c,re,p,b,g,w]),M=m.useCallback(y=>{var S=Z(y,!1);if(S==null){ge.error("Could not find panel id for file metadata",y);return}x.activateTab(n.root,{id:S})},[Z,n.root]),R=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 ne=l.get(K);if(y===ne){ge.debug("Update tab title for file ".concat(K));var{itemName:at}=S;Y(K,at)}else ge.error("File ".concat(K," already associated with a different tab ").concat(ne));return}p(K,y),c.has(K)&&w(K)},[l,c,Y,p,b,w]),ee=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]),z=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,ne=!1;if(l.has(_))K=l.get(_);else if(c.has(_))K=c.get(_),ne=!0;else{ge.debug("File ".concat(_," isn't open, ignore close event"));return}ee(y,ne),x.closeComponent(n.root,{id:K},S)},[n.root,l,c,ee]),j=m.useCallback(y=>{var{itemName:S}=y;return k.getBaseName(S)},[]),G=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,c),S!=null&&c.has(S)},[c]),A=m.useCallback(y=>{if(y!=null){var S=i.getOpenedPanelById(y);S&&os(S)&&S.focus()}},[i]),U=m.useCallback(y=>{var{id:S,settings:_,fileMetadata:K,session:ne,sessionLanguage:at,isPreview:I=!1}=y,X={settings:_,fileMetadata:K},ae=j(K);return{type:"react-component",component:an.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ne,sessionLanguage:at,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:$(_)},ne=Z(K);if(G(K)&&ne!=null){ge.debug("File is already open, focus panel"),M(K),A(ne);return}if(ne==null){ge.error("Panel ID for file metadata is null");return}var at=x.getStackForComponentTypes(n.root,[an.COMPONENT]),I=U({id:ne,settings:_,fileMetadata:K,session:y,sessionLanguage:S});ge.debug("createNotebook",I,l),x.openComponentInStack(at,I)},[G,A,$,Z,n.root,U,l,M]),fe=m.useCallback(function(y,S,_,K){var ne=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ge.debug("selectNotebook",K,ne);var at=G(K),I=W(K),[X]=[...c.values()],ae=!ne,he=ae&&X?X:Z(K);if(he==null||he==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(K)));if(at||I)M(K);else{var je=x.getStackForComponentTypes(n.root,[an.COMPONENT]),Ot=U({id:he,settings:_,fileMetadata:K,session:y,sessionLanguage:S,isPreview:ae});x.openComponentInStack(je,Ot)}if(I&&ne){var Ct=K.id,ur=x.getStackForConfig(n.root,{component:an.COMPONENT,id:he}),Ln=x.getContentItemInStack(ur,{component:an.COMPONENT,id:he});Ct!=null&&Ln&&et(Ln)&&(Ln.container.emit(J.PROMOTE_FROM_PREVIEW),w(Ct),p(Ct,he))}ne&&A(he)},[M,G,W,A,Z,n.root,U,c,w,p]),qe=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,ne=i.getLastUsedPanelOfType(an);ne&&os(ne)?_!=null&&_.value!=null&&ne.notebook!=null&&ne.notebook.append(_.value):K&&V(y,S,_)},[V,i]),Me=m.useCallback((y,S)=>Pg.hydrate(is(is({},y),{},{notebooksUrl:a}),S),[a]);return $n(o,si,t),$n(o,Nb),$n(o,by),$n(o,wy),$n(o,an,Me),Le(n.eventHub,Ne.SEND_COMMAND,E),Le(n.eventHub,Ne.SETTINGS_CHANGED,P),Le(n.eventHub,J.CLOSE_FILE,z),Le(n.eventHub,J.CREATE_NOTEBOOK,V),Le(n.eventHub,J.SELECT_NOTEBOOK,fe),Le(n.eventHub,J.RENAME,re),Le(n.eventHub,J.RENAME_FILE,Y),Le(n.eventHub,J.SEND_TO_NOTEBOOK,qe),Le(n.eventHub,J.REGISTER_FILE,R),Le(n.eventHub,J.UNREGISTER_FILE,ee),null}function Xr(r,e,t){return(e=Ny(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ny(r){var e=My(r,"string");return typeof e=="symbol"?e:e+""}function My(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 Zr{}Xr(Zr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Xr(Zr,"INPUT_FILTER","ControlType.INPUT_FILTER");Xr(Zr,"MARKDOWN","ControlType.MARKDOWN");Xr(Zr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{dm as $,uC as A,oe as B,zs as C,Ke as D,dC as E,El as F,Hs as G,Us as H,Pt as I,Bs as J,O as K,Fe as L,ul as M,cm as N,Xn as O,Te as P,H as Q,uv as R,el as S,T,zt as U,Xs as V,Zr as W,l0 as X,tr as Y,cl as Z,Br as _,ft as a,D as a$,en as a0,ZC as a1,ru as a2,bC as a3,ll as a4,Zy as a5,sr as a6,p0 as a7,om as a8,$e as a9,mC as aA,CC as aB,pC as aC,gC as aD,g0 as aE,b0 as aF,hC as aG,fC as aH,dl as aI,vC as aJ,me as aK,By as aL,pc as aM,er as aN,wc as aO,gc as aP,Fs as aQ,Rs as aR,bc as aS,yc as aT,vt as aU,bt as aV,Ec as aW,Ks as aX,Qs as aY,Ah as aZ,Ur as a_,e0 as aa,Ng as ab,cC as ac,Pg as ad,Ld as ae,Ms as af,J as ag,Tt as ah,LC as ai,FC as aj,HC as ak,UC as al,ie as am,s0 as an,t0 as ao,i0 as ap,an as aq,dg as ar,tm as as,Is as at,Hr as au,D0 as av,te as aw,qn as ax,x0 as ay,yC as az,_t as b,Dr as b$,Ws as b0,Kc as b1,Ii as b2,Wy as b3,Lh as b4,Di as b5,Ky as b6,qs as b7,$s as b8,tl as b9,TC as bA,Vv as bB,xC as bC,IC as bD,Zv as bE,Yv as bF,kC as bG,DC as bH,Li as bI,NC as bJ,Qf as bK,zf as bL,Jf as bM,qt as bN,hl as bO,Ue as bP,Mr as bQ,jf as bR,Il as bS,ml as bT,xm as bU,gl as bV,bm as bW,xn as bX,vl as bY,In as bZ,yf as b_,Gs as ba,Pc as bb,sh as bc,Ir as bd,Zh as be,il as bf,rl as bg,nl as bh,zy as bi,Gy as bj,qy as bk,Iv as bl,Dv as bm,we as bn,Lv as bo,Xv as bp,Q as bq,Hv as br,ke as bs,SC as bt,Sl as bu,wl as bv,PC as bw,OC as bx,wC as by,EC as bz,C as c,jb as c$,bl as c0,np as c1,Se as c2,gi as c3,We as c4,xl as c5,yi as c6,Ds as c7,x as c8,$n as c9,cg as cA,mg as cB,hg as cC,vg as cD,jC as cE,xg as cF,KC as cG,zC as cH,o0 as cI,r0 as cJ,RC as cK,BC as cL,$C as cM,WC as cN,QC as cO,a0 as cP,Le as cQ,$g as cR,_0 as cS,Vi as cT,O0 as cU,An as cV,hu as cW,$b as cX,Fb as cY,Lb as cZ,vu as c_,AC as ca,XC as cb,cb as cc,Qg as cd,Yg as ce,ai as cf,ou as cg,YC as ch,VC as ci,Ql as cj,Cg as ck,Ui as cl,Bi as cm,iu as cn,Lg as co,eu as cp,Cr as cq,pg as cr,Zl as cs,Jg as ct,n0 as cu,GC as cv,qC as cw,nu as cx,Yl as cy,fg as cz,ze as d,Mb as d0,P0 as d1,Ab as d2,T0 as d3,Rb as d4,mu as d5,Fa as d6,Hy as d7,no as d8,ug as d9,w0 as dA,C0 as dB,y0 as dC,cu as dD,Ne as dE,f0 as dF,xb as dG,Oy as dH,Fy as dI,Uy as dJ,$y as dK,Qr as dL,Bd as dM,Yr as dN,_C as dO,Vn as dP,Vr as da,JC as db,k as dc,Ki as dd,I0 as de,si as df,wy as dg,Nb as dh,by as di,As as dj,Ry as dk,ar as dl,Ls as dm,Jt as dn,S0 as dp,h0 as dq,m0 as dr,du as ds,c0 as dt,v0 as du,Qn as dv,u0 as dw,E0 as dx,d0 as dy,gt as dz,hm as e,im as f,Yy as g,sC as h,aC as i,oC as j,iC as k,rC as l,nC as m,Xy as n,eC as o,Jy as p,Qy as q,Ce as r,de as s,ce as t,em as u,Ee as v,lC as w,tC as x,Vy as y,kg as z};
|
|
25
|
+
//# sourceMappingURL=ControlType-BEonYtyB.js.map
|