@deephaven/code-studio 1.10.2-lerna-v9.0 → 1.10.2

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.
Files changed (40) hide show
  1. package/build/assets/{AppRoot-Dsp0-nx9.js → AppRoot-BY4a1UaK.js} +6 -6
  2. package/build/assets/{AppRoot-Dsp0-nx9.js.map → AppRoot-BY4a1UaK.js.map} +1 -1
  3. package/build/assets/{Chart-P_gTGGZ1.js → Chart-DmqNQtr3.js} +2 -2
  4. package/build/assets/{Chart-P_gTGGZ1.js.map → Chart-DmqNQtr3.js.map} +1 -1
  5. package/build/assets/{ControlType-lgZLQmfY.js → ControlType-RBsIk8KS.js} +4 -4
  6. package/build/assets/{ControlType-lgZLQmfY.js.map → ControlType-RBsIk8KS.js.map} +1 -1
  7. package/build/assets/{FormatterUtils-C9ixv8yB.js → FormatterUtils-C3xgIs6_.js} +2 -2
  8. package/build/assets/{FormatterUtils-C9ixv8yB.js.map → FormatterUtils-C3xgIs6_.js.map} +1 -1
  9. package/build/assets/{Grid-DQPrZJGB.js → Grid-B7dO0Sbi.js} +2 -2
  10. package/build/assets/{Grid-DQPrZJGB.js.map → Grid-B7dO0Sbi.js.map} +1 -1
  11. package/build/assets/{GridTokenMouseHandler-X2JErABm.js → GridTokenMouseHandler-Ds5xKqrO.js} +2 -2
  12. package/build/assets/{GridTokenMouseHandler-X2JErABm.js.map → GridTokenMouseHandler-Ds5xKqrO.js.map} +1 -1
  13. package/build/assets/{IrisGrid-m82zJTmT.js → IrisGrid-CFqfz-_M.js} +2 -2
  14. package/build/assets/{IrisGrid-m82zJTmT.js.map → IrisGrid-CFqfz-_M.js.map} +1 -1
  15. package/build/assets/{IrisGridModel-BWX_u8pv.js → IrisGridModel-CfNBLna8.js} +3 -3
  16. package/build/assets/{IrisGridModel-BWX_u8pv.js.map → IrisGridModel-CfNBLna8.js.map} +1 -1
  17. package/build/assets/{IrisGridShortcuts-QN2zgZUQ.js → IrisGridShortcuts-Bw5ADLgT.js} +2 -2
  18. package/build/assets/{IrisGridShortcuts-QN2zgZUQ.js.map → IrisGridShortcuts-Bw5ADLgT.js.map} +1 -1
  19. package/build/assets/{IrisGridThemeProvider-DtrPDGfJ.js → IrisGridThemeProvider-CggmgZiA.js} +2 -2
  20. package/build/assets/{IrisGridThemeProvider-DtrPDGfJ.js.map → IrisGridThemeProvider-CggmgZiA.js.map} +1 -1
  21. package/build/assets/{LocalWorkspaceStorage-C6dxwi4z.js → LocalWorkspaceStorage-DXAI74vd.js} +2 -2
  22. package/build/assets/{LocalWorkspaceStorage-C6dxwi4z.js.map → LocalWorkspaceStorage-DXAI74vd.js.map} +1 -1
  23. package/build/assets/{MarkdownEditor-B4WFJDBT.js → MarkdownEditor-CjiUT8XD.js} +2 -2
  24. package/build/assets/{MarkdownEditor-B4WFJDBT.js.map → MarkdownEditor-CjiUT8XD.js.map} +1 -1
  25. package/build/assets/{MarkdownNotebook-Bw-fDcJ8.js → MarkdownNotebook-CsCP6Muy.js} +2 -2
  26. package/build/assets/{MarkdownNotebook-Bw-fDcJ8.js.map → MarkdownNotebook-CsCP6Muy.js.map} +1 -1
  27. package/build/assets/{MissingPartitionError-Cw7iLwy0.js → MissingPartitionError-DXkc6F4C.js} +2 -2
  28. package/build/assets/{MissingPartitionError-Cw7iLwy0.js.map → MissingPartitionError-DXkc6F4C.js.map} +1 -1
  29. package/build/assets/{MockChartModel-C5m_XRVw.js → MockChartModel-B0Gv2sr1.js} +2 -2
  30. package/build/assets/{MockChartModel-C5m_XRVw.js.map → MockChartModel-B0Gv2sr1.js.map} +1 -1
  31. package/build/assets/{StyleGuideRoot-DGm-hysw.js → StyleGuideRoot-BAYFLFTM.js} +2 -2
  32. package/build/assets/{StyleGuideRoot-DGm-hysw.js.map → StyleGuideRoot-BAYFLFTM.js.map} +1 -1
  33. package/build/assets/{index-LXmN419B.js → index-Bjvh6jhx.js} +4 -4
  34. package/build/assets/{index-LXmN419B.js.map → index-Bjvh6jhx.js.map} +1 -1
  35. package/build/assets/{index-CqIl8EDR.js → index-CVle8e1T.js} +2 -2
  36. package/build/assets/{index-CqIl8EDR.js.map → index-CVle8e1T.js.map} +1 -1
  37. package/build/assets/{index-DmVB6hX1.js → index-Cwc_E41j.js} +3 -3
  38. package/build/assets/{index-DmVB6hX1.js.map → index-Cwc_E41j.js.map} +1 -1
  39. package/build/index.html +2 -2
  40. package/package.json +31 -31
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-gzyKAEuz.js","./Plotly-DIvLbxz7.js","./plotly-_1p61Fhy.js","./helpers-BosuxZz1.js","./vendor-DVrAV4v1.js","./vendor-CawHrWiI.css","./MarkdownNotebook-Bw-fDcJ8.js","./index-DmVB6hX1.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-WCsQ0aAg.css","./mathjax-DWeFhW7B.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
2
- import{r as m,a0 as mn,bA as Ar,U as R,bF as ts,ac as si,I as d,L as ns,K as q,R as Lr,bG as du,bH as hu,M as ve,H as Et,bI as cu,G as rs,a1 as wn,bJ as mu,bK as vu,bL as pu,bD as Gn,bM as fu,a6 as gu,a5 as bu,bz as zi,bN as yu,bO as Cu,ad as Xt,av as Gi,bP as Wn,bQ as N,bR as qi,bE as be,af as is,a3 as _i,bS as Su,_ as Mn}from"./vendor-DVrAV4v1.js";import{aC as os,L as U,aZ as as,W as ss,$ as wu,ai as Eu,aj as Pu,ah as Tu,ar as _u,ad as Ou,aw as xu,M as ls,b as us,c as ds,aK as Iu,a_ as Du,a$ as hs,b0 as cs,b1 as Nu,b2 as Mu,N as vn,aA as ku,b3 as ju,b4 as Au,b5 as Lu,b6 as Ru,b7 as Fu,b8 as $u,b9 as Hu,ba as Bu,bb as Uu,bc as Wu,E as ms,aY as Vu,aV as vs,aW as Ku,a3 as ps,k as zu,e as L,d as li,bd as Gu,be as qu,au as fs,bf as Xi,bg as Xu,bh as Zu,bi as Yu,bj as Qu,f as gs,aO as bs,bk as Ju,bl as ys,bm as _n,aU as ed,bn as td,H as Zi,bo as Cs,q as Yi,bp as Ss,bq as nd,K as rd,ak as id,br as od,C as ad,al as sd,bs as ld,bt as ud,bu as dd,bv as hd,bw as cd,bx as md,by as vd,aQ as pd,bz as fd,bA as gd}from"./index-DmVB6hX1.js";import{e as Ie,M as bd,b as Qi,l as it,R as ws,K as rt,c as Zt,d as Ji,U as yd,_ as Es}from"./monaco-DaE0jI-i.js";var Ps=Object.freeze([]),fy=new Map,Ts=()=>{};function gy(r){return Array.isArray(r)?r:[r]}function Xr(){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 Cd(r,e,t){return(e=Sd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sd(r){var e=wd(r,"string");return typeof e=="symbol"?e:e+""}function wd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class eo extends Error{constructor(){super(...arguments),Cd(this,"isCanceled",!0)}}function Ed(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Pd(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function Pd(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 Td(r,e,t){return(e=_d(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _d(r){var e=Od(r,"string");return typeof e=="symbol"?e:e+""}function Od(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class xd extends Error{constructor(){super(...arguments),Td(this,"isClipboardPermissionsDeniedError",!0)}}function Id(r,e,t){return(e=Dd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dd(r){var e=Nd(r,"string");return typeof e=="symbol"?e:e+""}function Nd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 extends Error{constructor(){super(...arguments),Id(this,"isClipboardUnavailableError",!0)}}function Md(r,e,t){return(e=kd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kd(r){var e=jd(r,"string");return typeof e=="symbol"?e:e+""}function jd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _s extends Error{constructor(){super(...arguments),Md(this,"isPermissionUnsupported",!0)}}function to(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 Ad(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){to(o,n,i,a,s,"next",l)}function s(l){to(o,n,i,a,s,"throw",l)}a(void 0)})}}function no(r){return ui.apply(this,arguments)}function ui(){return ui=Ad(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new _s:t}}),ui.apply(this,arguments)}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 Os(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 xs(r){return di.apply(this,arguments)}function di(){return di=Os(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}Ld(r)}),di.apply(this,arguments)}function Ld(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 by(){return hi.apply(this,arguments)}function hi(){return hi=Os(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Zr;var e=yield no("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield no("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new xd}catch(i){throw i instanceof _s?new Zr:i}throw new Zr}),hi.apply(this,arguments)}var kn;function pn(r,e,t){return(e=Rd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rd(r){var e=Fd(r,"string");return typeof e=="symbol"?e:e+""}function Fd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var $d="table_",Is="column_",Hd=new Set(["in","not","i","ii","k"]),Bd=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"]),Ud=/[^a-zA-Z0-9_$\-+@]/g,Wd=/[^A-Za-z0-9_$]/g,Vd=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,Kd=/[^a-zA-Z0-9_]/g;function zd(r){return r.replace(/[ -]/g,"_")}function Gd(r){return r.replace(/\s/g,"_")}class _t{}kn=_t;pn(_t,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Hd.has(a)||Bd.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});pn(_t,"legalizeTableName",r=>kn.legalize(r,Gd,$d,Ud,!1,0));pn(_t,"makeVariableName",r=>kn.legalizeTableName(r).replace(Kd,"_"));pn(_t,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=kn.legalizeColumnName(t,n);e.includes(i)&&(i=Is+n),e.push(i)}),e});pn(_t,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return kn.legalize(r,zd,Is,Wd,!0,e)});pn(_t,"isValidTableName",r=>Vd.test(r));pn(_t,"isValidColumnName",r=>kn.legalizeColumnName(r)===r);class Ds 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 eo),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof eo}static isTimedOut(e){return e instanceof os}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function io(r,e,t){return(e=qd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qd(r){var e=Xd(r,"string");return typeof e=="symbol"?e:e+""}function Xd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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(){io(this,"pending",[]),io(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 yy(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*Cy(r,e){for(var t=r;t<=e;++t)yield t}var Sy=" ";class Ns{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=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)}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 Qd(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=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)}class Vn extends Error{constructor(){super(...arguments),Qd(this,"isInvalid",!0)}}function Ms(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}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 th(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)})}}var nh=U.module("useAsyncInterval");function rh(r,e){var t=Ms(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(th(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(c){nh.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),h=Math.max(0,e-u);n.current=window.setTimeout(a,h)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function 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 ih(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(()=>mn(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 oh(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function ah(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>Ar(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 ks(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var sh=3500,lh=U.module("useCopyToClipboard");function uh(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{xs(i).then(()=>{e(!0)}).catch(o=>lh.error("Unable to copy ".concat(i),`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-gzyKAEuz.js","./Plotly-DIvLbxz7.js","./plotly-_1p61Fhy.js","./helpers-BosuxZz1.js","./vendor-DVrAV4v1.js","./vendor-CawHrWiI.css","./MarkdownNotebook-CsCP6Muy.js","./index-Cwc_E41j.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-WCsQ0aAg.css","./mathjax-DWeFhW7B.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
2
+ import{r as m,a0 as mn,bA as Ar,U as R,bF as ts,ac as si,I as d,L as ns,K as q,R as Lr,bG as du,bH as hu,M as ve,H as Et,bI as cu,G as rs,a1 as wn,bJ as mu,bK as vu,bL as pu,bD as Gn,bM as fu,a6 as gu,a5 as bu,bz as zi,bN as yu,bO as Cu,ad as Xt,av as Gi,bP as Wn,bQ as N,bR as qi,bE as be,af as is,a3 as _i,bS as Su,_ as Mn}from"./vendor-DVrAV4v1.js";import{aC as os,L as U,aZ as as,W as ss,$ as wu,ai as Eu,aj as Pu,ah as Tu,ar as _u,ad as Ou,aw as xu,M as ls,b as us,c as ds,aK as Iu,a_ as Du,a$ as hs,b0 as cs,b1 as Nu,b2 as Mu,N as vn,aA as ku,b3 as ju,b4 as Au,b5 as Lu,b6 as Ru,b7 as Fu,b8 as $u,b9 as Hu,ba as Bu,bb as Uu,bc as Wu,E as ms,aY as Vu,aV as vs,aW as Ku,a3 as ps,k as zu,e as L,d as li,bd as Gu,be as qu,au as fs,bf as Xi,bg as Xu,bh as Zu,bi as Yu,bj as Qu,f as gs,aO as bs,bk as Ju,bl as ys,bm as _n,aU as ed,bn as td,H as Zi,bo as Cs,q as Yi,bp as Ss,bq as nd,K as rd,ak as id,br as od,C as ad,al as sd,bs as ld,bt as ud,bu as dd,bv as hd,bw as cd,bx as md,by as vd,aQ as pd,bz as fd,bA as gd}from"./index-Cwc_E41j.js";import{e as Ie,M as bd,b as Qi,l as it,R as ws,K as rt,c as Zt,d as Ji,U as yd,_ as Es}from"./monaco-DaE0jI-i.js";var Ps=Object.freeze([]),fy=new Map,Ts=()=>{};function gy(r){return Array.isArray(r)?r:[r]}function Xr(){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 Cd(r,e,t){return(e=Sd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sd(r){var e=wd(r,"string");return typeof e=="symbol"?e:e+""}function wd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class eo extends Error{constructor(){super(...arguments),Cd(this,"isCanceled",!0)}}function Ed(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Pd(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function Pd(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 Td(r,e,t){return(e=_d(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _d(r){var e=Od(r,"string");return typeof e=="symbol"?e:e+""}function Od(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class xd extends Error{constructor(){super(...arguments),Td(this,"isClipboardPermissionsDeniedError",!0)}}function Id(r,e,t){return(e=Dd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dd(r){var e=Nd(r,"string");return typeof e=="symbol"?e:e+""}function Nd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 extends Error{constructor(){super(...arguments),Id(this,"isClipboardUnavailableError",!0)}}function Md(r,e,t){return(e=kd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kd(r){var e=jd(r,"string");return typeof e=="symbol"?e:e+""}function jd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _s extends Error{constructor(){super(...arguments),Md(this,"isPermissionUnsupported",!0)}}function to(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 Ad(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){to(o,n,i,a,s,"next",l)}function s(l){to(o,n,i,a,s,"throw",l)}a(void 0)})}}function no(r){return ui.apply(this,arguments)}function ui(){return ui=Ad(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new _s:t}}),ui.apply(this,arguments)}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 Os(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 xs(r){return di.apply(this,arguments)}function di(){return di=Os(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}Ld(r)}),di.apply(this,arguments)}function Ld(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 by(){return hi.apply(this,arguments)}function hi(){return hi=Os(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Zr;var e=yield no("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield no("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new xd}catch(i){throw i instanceof _s?new Zr:i}throw new Zr}),hi.apply(this,arguments)}var kn;function pn(r,e,t){return(e=Rd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rd(r){var e=Fd(r,"string");return typeof e=="symbol"?e:e+""}function Fd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var $d="table_",Is="column_",Hd=new Set(["in","not","i","ii","k"]),Bd=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"]),Ud=/[^a-zA-Z0-9_$\-+@]/g,Wd=/[^A-Za-z0-9_$]/g,Vd=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,Kd=/[^a-zA-Z0-9_]/g;function zd(r){return r.replace(/[ -]/g,"_")}function Gd(r){return r.replace(/\s/g,"_")}class _t{}kn=_t;pn(_t,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Hd.has(a)||Bd.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});pn(_t,"legalizeTableName",r=>kn.legalize(r,Gd,$d,Ud,!1,0));pn(_t,"makeVariableName",r=>kn.legalizeTableName(r).replace(Kd,"_"));pn(_t,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=kn.legalizeColumnName(t,n);e.includes(i)&&(i=Is+n),e.push(i)}),e});pn(_t,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return kn.legalize(r,zd,Is,Wd,!0,e)});pn(_t,"isValidTableName",r=>Vd.test(r));pn(_t,"isValidColumnName",r=>kn.legalizeColumnName(r)===r);class Ds 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 eo),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof eo}static isTimedOut(e){return e instanceof os}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function io(r,e,t){return(e=qd(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qd(r){var e=Xd(r,"string");return typeof e=="symbol"?e:e+""}function Xd(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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(){io(this,"pending",[]),io(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 yy(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*Cy(r,e){for(var t=r;t<=e;++t)yield t}var Sy=" ";class Ns{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=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)}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 Qd(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=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)}class Vn extends Error{constructor(){super(...arguments),Qd(this,"isInvalid",!0)}}function Ms(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}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 th(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)})}}var nh=U.module("useAsyncInterval");function rh(r,e){var t=Ms(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(th(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(c){nh.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),h=Math.max(0,e-u);n.current=window.setTimeout(a,h)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function 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 ih(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(()=>mn(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 oh(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function ah(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>Ar(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 ks(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var sh=3500,lh=U.module("useCopyToClipboard");function uh(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{xs(i).then(()=>{e(!0)}).catch(o=>lh.error("Unable to copy ".concat(i),`
3
3
  `,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),r&&(t.current=setTimeout(()=>{e(!1)},sh)),()=>{t.current&&clearTimeout(t.current)}),[r]),[r,n]}var dh=["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 hh(r){return typeof r=="string"&&dh.includes(r)}function ch(r){return r!=null&&hh(r)?"var(--dh-color-".concat(r,")"):r}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 Rt(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){En(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 En(r,e,t){return(e=mh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mh(r){var e=vh(r,"string");return typeof e=="symbol"?e:e+""}function vh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 so="popper",ph={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(r,e)=>{var t,n,i=(t=ts.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 Rr extends m.Component{constructor(e){super(e),En(this,"element",void 0),En(this,"container",void 0),En(this,"nodeRef",R.createRef()),En(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=R.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props,{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?ph:{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 h=this.getVisibleElement(this.container.current);h==null&&(h=this.container.current);var c=new ts(o||h,this.element,u);c.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(i){var v=this.element.querySelector(".".concat(so));v instanceof HTMLElement&&!v.contains(document.activeElement)&&v.focus()}}),si.flushSync(()=>{this.setState({popper:c})})}}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(),si.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(as,{isPortal:!0,children:d.jsx(ns,{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(so,{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&&Lr.createPortal(this.renderContent(),this.element)})}}En(Rr,"defaultProps",{options:{},className:"",timeout:ss.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,referenceObject:null,"data-testid":void 0});var ci;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 fh(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){ft(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 ft(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)}var yh=U.module("Tooltip");class he extends m.Component{static handleHidden(){he.shownTooltipCount-=1,he.shownTooltipCount===0&&(he.lastHiddenTime=Date.now())}static handleShown(){he.shownTooltipCount+=1}constructor(e){super(e),ft(this,"container",void 0),ft(this,"popper",void 0),ft(this,"parent",void 0),ft(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=R.createRef(),this.popper=R.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:n}=t,{isShown:i}=this.state;i!==n&&(i?he.handleShown():he.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&he.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){yh.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,n=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,n=e;(he.shownTooltipCount>0||Date.now()-he.lastHiddenTime<he.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),si.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=fh({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Rr,{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]})})})}}ci=he;ft(he,"defaultTimeout",500);ft(he,"defaultReshowTimeout",100);ft(he,"triggerReshowThreshold",300);ft(he,"shownTooltipCount",0);ft(he,"lastHiddenTime",Date.now());ft(he,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:ci.defaultReshowTimeout,timeout:ci.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var Ch=U.module("ThemeProvider"),Oi=m.createContext(null);Oi.displayName="ThemeContext";function wy(r){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:n=wu,children:i}=r,o=m.useMemo(()=>Eu(),[]),[a,s]=m.useState(null),[l,u]=m.useState(Pu),h=m.useMemo(()=>e==null?null:Tu(l,{base:o,custom:e??[]}),[o,l,e]),c=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(h==null||e==null)){_u(n);var p=Ou(n);Ch.debug2("updateThemePreloadData:",{active:h.map(f=>f.themeKey),custom:e.map(f=>f.themeKey),preloadStyleContent:p,selectedThemeKey:l}),xu({themeKey:l,preloadStyleContent:p})}},[h,l,e,n]),m.useEffect(()=>{s({activeThemes:h,selectedThemeKey:l,themes:c,setSelectedThemeKey:u})},[h,l,c]),t&&h==null?null:d.jsxs(d.Fragment,{children:[h==null?null:d.jsx(d.Fragment,{children:h.map(v=>d.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:d.jsx(Oi.Provider,{value:a,children:d.jsx(as,{children:i})})]})}function js(){return er(Oi,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var Sh=["color","UNSAFE_style"];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 ur(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){wh(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 wh(r,e,t){return(e=Eh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eh(r){var e=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)}function Th(r,e){if(r==null)return{};var t,n,i=_h(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 _h(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 As=m.forwardRef((r,e)=>{var{color:t,UNSAFE_style:n}=r,i=Th(r,Sh),o=m.useMemo(()=>ur(ur({},n),{},{color:ch(t)}),[t,n]);return d.jsx(du,ur(ur({},i),{},{ref:e,UNSAFE_style:o}))});As.displayName="Heading";function Oh(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 xh=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function ho(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function co(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ho(Object(t),!0).forEach(function(n){Ih(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 Ih(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=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 Mh(r,e){if(r==null)return{};var t,n,i=kh(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 kh(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 jh(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 Ah(r){switch(r){case"group-end":return q("pl-2","pr-3")}}var ie=R.forwardRef((r,e)=>{var{kind:t,variant:n,type:i="button",tooltip:o,icon:a,disabled:s=!1,active:l,onClick:u,onContextMenu:h,onMouseDown:c,onMouseUp:v,onMouseEnter:p,onMouseLeave:f,onKeyDown:g,className:y,style:w,children:T,tabIndex:P,"data-testid":$,"aria-label":X}=r,re=Mh(r,xh),{UNSAFE_className:Y}=hu({},"button"),k;n&&(k=Ah(n));var F;a&&(F=R.isValidElement(a)?a:d.jsx(ve,{icon:a}));var ee=F!=null&&T==null,z=jh(t,ee),j;o!==void 0&&(j=typeof o=="string"?d.jsx(he,{children:o}):o);var G=X;X===void 0&&ee&&o!=null&&typeof o=="string"&&(G=o);var W=d.jsxs("button",co(co({"data-testid":$,ref:e,type:i,className:q("btn",z,k,{active:l},y,Y),onClick:u,onContextMenu:h,onMouseUp:v,onMouseDown:c,onMouseEnter:p,onMouseLeave:f,onKeyDown:g,style:w,disabled:s,tabIndex:P,"aria-label":G},re),{},{children:[a&&F,T,o!=null&&!s&&j]}));return s&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[W,j]}):W});ie.displayName="Button";function Ls(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:h="Discard",isConfirmDanger:c=!1,children:v,"data-testid":p}=r,f=m.useRef(null),g=m.useRef(null),y=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),w=m.useCallback(()=>{var P;(P=f.current)===null||P===void 0||P.focus()},[]),T="";return e&&(T=typeof n=="function"?n():n),d.jsxs(ls,{isOpen:e,onOpened:w,children:[d.jsx(us,{closeButton:!1,children:t}),d.jsx(ds,{children:T}),d.jsxs(Ls,{children:[s&&d.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[d.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),d.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&d.jsx(ie,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:h}),i&&d.jsx(ie,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),d.jsxs(Oh,{children:[d.jsx(ie,{kind:c?"danger":"primary",onClick:y,ref:f,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:u}),v]})]})]})}function Lh(r,e,t){return(e=Rh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rh(r){var e=Fh(r,"string");return typeof e=="symbol"?e:e+""}function Fh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Yr(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}}Lh(Ee,"actionsDisabled",!1);var mo=U.module("GlobalContextAction");class $h 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),mo.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;mo.debug("Global hotkey matched!",e),(n=t.action)===null||n===void 0||n.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class Hh 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($h,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));n.push(s)}}return n}}function Rs(r,e,t){return(e=Bh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bh(r){var e=Uh(r,"string");return typeof e=="symbol"?e:e+""}function Uh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 dr=U.module("ContextActions");class te extends m.Component{static triggerMenu(e,t,n,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),Rs(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=R.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!Yr(i)&&typeof i!="function"&&i.isGlobal),n=e.actions.filter(i=>!Yr(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0){for(var n=e.target,i=function(){var{classList:u}=n,h=t.find(c=>u.contains(c));if(h!==void 0)return dr.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};n=n.parentElement},o;n!=null;)if(o=i(),o)return o.v}if(Ee.isContextActionEvent(e)||(e.contextActions=[]),!!Ee.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>Yr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}dr.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;dr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),dr.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(Hh,{actions:t})})}}Rs(te,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var Fs=R.forwardRef((r,e)=>{var t,n,{closeMenu:i,children:o,menuItem:a,onMenuItemClick:s,onMenuItemMouseMove:l,onMenuItemContextMenu:u,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":v}=r,p=m.useCallback(z=>{s(a,z)},[a,s]),f=m.useCallback(z=>{l(a,z)},[a,l]),g=m.useCallback(z=>{u(a,z)},[a,u]);function y(z,j,G){if(typeof z.type=="string")return z;var W={menuItem:a,closeMenu:i,isKeyboardSelected:h,isMouseSelected:c,iconElement:j,displayShortcut:G,"data-testid":v};return R.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(),T=null;if(a.icon){var P=a.icon;if(R.isValidElement(P))T=P;else{var $;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&($={color:a.iconColor}),T=d.jsx(ve,{icon:P,style:$})}}var X=null,re=!!o;a.actions&&(X=d.jsx(ve,{icon:Iu}));var Y=null;if(a.menuElement)Y=d.jsx("div",{className:"custom-menu-item",onMouseMove:f,children:y(a.menuElement,T,w)});else{var k,F=a.disabled,ee=a.iconOutline;Y=d.jsx("button",{type:"button",className:q("btn-context-menu",{disabled:F},{active:(re||c)&&(F===void 0||!F)},{"keyboard-active":h&&(F===void 0||!F)}),onClick:p,onMouseMove:f,onContextMenu:g,title:(k=a.description)!==null&&k!==void 0?k:"",children:d.jsxs("div",{className:"btn-context-menu-wrapper",children:[d.jsx("span",{className:q("icon",{outline:ee}),children:T}),d.jsx("span",{className:"title",children:a.title}),w!==void 0&&d.jsx("span",{className:"shortcut",children:w}),X&&d.jsx("span",{className:q("submenu-indicator",{disabled:F}),children:X})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,Y]})});Fs.displayName="ContextMenuItem";var $s=R.forwardRef((r,e)=>{var{checked:t=!1,children:n,className:i,disabled:o=!1,inputClassName:a,isInvalid:s=!1,labelClassName:l,name:u,onChange:h,"data-testid":c}=r,[v]=m.useState(Et()),p=ks(e);m.useEffect(function(){p.current&&(p.current.indeterminate=t===null)},[p,t]);var f=m.useCallback(g=>{p.current&&(p.current.indeterminate=t===null),h&&h(g)},[p,t,h]);return d.jsxs("div",{className:q("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:p,checked:t??!1,className:q("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:u,onChange:f,"data-testid":c}),d.jsx("label",{className:q("custom-control-label",l),htmlFor:v,children:n})]})});$s.displayName="Checkbox";function _r(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function Hs(r){return _r(r)&&Hs(r.WrappedComponent)?!0:r.prototype!=null&&r.prototype.isReactComponent!=null}function Wh(r){return!_r(r)&&"$$typeof"in r&&r.$$typeof===cu.ForwardRef}function Bs(r){return Hs(r)||Wh(r)}function Vh(r){var{copy:e,kind:t="ghost",tooltip:n="Copy",className:i,style:o,"data-testid":a,children:s}=r,[l,u]=uh();return d.jsx(ie,{kind:t,className:i,style:o,"data-testid":a,icon:l?Du:hs,tooltip:l?"Copied":n,onClick:()=>{u(typeof e=="function"?e():e)},children:s})}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 Kh(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){Kn(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 Kn(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)}class Us 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=R.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:n}=e,i=(t=n.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Ee.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:Ee.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),i=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=Ee.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Ee.getNextMenuItem(i??0,1,t)),n!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(d.jsx("hr",{},"".concat(a,".separator")));var l=d.jsx(Fs,{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:Kh({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Kn(Us,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function po(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?po(Object(t),!0).forEach(function(n){Pn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):po(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pn(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=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 tr extends m.PureComponent{constructor(e){super(e),Pn(this,"container",void 0),Pn(this,"parent",void 0),Pn(this,"popper",void 0),Pn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=R.createRef(),this.parent=null,this.popper=R.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=fo({placement:"bottom"},s),a=fo({separateKeyboardMouse:!0},a),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Rr,{ref:this.popper,options:s,className:q("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(Us,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}Pn(tr,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Ut(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=Yh(r,"string");return typeof e=="symbol"?e:e+""}function Yh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var go=U.module("Shortcut"),D=function(r){return r.CTRL="MODIFIER_CTRL",r.CMD="MODIFIER_CMD",r.ALT="MODIFIER_ALT",r.OPTION="MODIFIER_OPTION",r.SHIFT="MODIFIER_SHIFT",r}({}),O=function(r){return r.A="A",r.B="B",r.C="C",r.D="D",r.E="E",r.F="F",r.G="G",r.H="H",r.I="I",r.J="J",r.K="K",r.L="L",r.M="M",r.N="N",r.O="O",r.P="P",r.Q="Q",r.R="R",r.S="S",r.T="T",r.U="U",r.V="V",r.W="W",r.X="X",r.Y="Y",r.Z="Z",r.ZERO="0",r.ONE="1",r.TWO="2",r.THREE="3",r.FOUR="4",r.FIVE="5",r.SIX="6",r.SEVEN="7",r.EIGHT="8",r.NINE="9",r.BACKSPACE="Backspace",r.ESCAPE="Escape",r.ENTER="Enter",r.DELETE="Delete",r.SLASH="/",r.QUESTION_MARK="?",r.BACKSLASH="\\",r.PIPE="|",r.MINUS="-",r.UNDERSCORE="_",r.EQUALS="=",r.PLUS="+",r.BACKTICK="`",r.TILDE="~",r.COMMA=",",r.LEFT_CHEVRON="<",r.PERIOD=".",r.RIGHT_CHEVRON=">",r.SEMICOLON=";",r.COLON=":",r.SINGLE_QUOTE="'",r.DOUBLE_QUOTE='"',r.LEFT_BRACKET="[",r.RIGHT_BRACKET="]",r.LEFT_CURLY="{",r.RIGHT_CURLY="}",r.F1="F1",r.F2="F2",r.F3="F3",r.F4="F4",r.F5="F5",r.F6="F6",r.F7="F7",r.F8="F8",r.F9="F9",r.F10="F10",r.F11="F11",r.F12="F12",r}({}),Qh=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 rs{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||Qh.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)?(go.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Ds("onUpdate",{detail:this}))):go.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 bo(r,e,t){return(e=Jh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jh(r){var e=ec(r,"string");return typeof e=="symbol"?e:e+""}function ec(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 yo=U.module("ShortcutRegistry");class tc extends rs{constructor(){super(...arguments),bo(this,"shortcutMap",new Map),bo(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 yo.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;yo.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new Ds("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 tc),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 mi(r,e,t){return(e=nc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nc(r){var e=rc(r,"string");return typeof e=="symbol"?e:e+""}function rc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Fr extends m.PureComponent{constructor(e){super(e),mi(this,"inputField",void 0),mi(this,"searchChangeSelection",void 0),this.inputField=R.createRef(),this.searchChangeSelection=R.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var n=t.getBoundingClientRect().width;e.style.paddingRight="".concat(n,"px")}}render(){var{value:e,placeholder:t,endPlaceholder:n,onBlur:i,onChange:o,className:a,disabled:s,matchCount:l,id:u,onKeyDown:h,"data-testid":c,cursor:v}=this.props,p,f=[{action:()=>v==null?void 0:v.next("forward"),shortcut:zt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:zt.PREVIOUS}];return v&&l>1?p=d.jsxs(d.Fragment,{children:[d.jsx(ie,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:cs,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(ie,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("forward")},icon:Nu,tooltip:"Next match (".concat(zt.NEXT.getDisplayText(),")")})]}):p=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:h,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:u,"data-testid":c}),l!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:p}),d.jsx(te,{actions:f})]}):d.jsxs("span",{className:"search-end-content",children:[(n??"")!==""&&e===""&&d.jsx("span",{className:"search-end-placeholder",children:n}),d.jsx(ve,{icon:Mu})]})]})}}mi(Fr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function Ws(r,e,t){return(e=ic(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ic(r){var e=oc(r,"string");return typeof e=="symbol"?e:e+""}function oc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Vs extends m.PureComponent{constructor(e){super(e),Ws(this,"searchInput",void 0),this.searchInput=R.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=mn(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(Fr,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":o})}}Ws(Vs,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function Ks(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=sc(r,"string");return typeof e=="symbol"?e:e+""}function sc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 lc=U.module("ItemListItem");class $r extends m.Component{static handleKeyDown(){return lc.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Ks(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=R.createRef()}handleBlur(e){var{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){var{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){var{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){var{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){var{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:n,style:i,children:o,"data-testid":a}=this.props;return d.jsx("div",{className:q("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:$r.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})}}Ks($r,"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 Er;function Co(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function So(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(t),!0).forEach(function(n){ht(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 ht(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)}var wo=U.module("ItemList"),Eo=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),ht(this,"list",void 0),ht(this,"listContainer",void 0),ht(this,"getItemSelected",wn((i,o)=>vt.isSelected(o,i),{max:bt.CACHE_SIZE})),ht(this,"getCachedItem",wn((i,o,a,s,l,u,h,c)=>{var v=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:h});return d.jsx($r,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:h,children:v},o)},{max:bt.CACHE_SIZE})),ht(this,"getOuterElement",wn(i=>{var o=R.forwardRef((a,s)=>d.jsx("div",So({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),ht(this,"getInnerElement",wn(()=>{var i=R.forwardRef((o,a)=>d.jsx("div",So({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),ht(this,"getItemData",wn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=R.createRef(),this.listContainer=R.createRef();var{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:n,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:u}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==u)this.setSelectedRanges(n);else if(u!==t.selectedRanges){var{onSelectionChange:h}=this.props;h(u)}if(o!==t.focusIndex){var{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-n;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var n=this.getElement(e);n instanceof HTMLElement&&n.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:n}=this.state,i=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){wo.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){wo.debug2("item focus",e,t.target),this.setState(n=>{var{focusIndex:i}=n;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:n,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:u}=this.state;if(!(a==null||o)){var h=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(u??0));h>Eo&&c>Eo&&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 h=i[t-o];return this.getCachedItem(t,t,h,t===l&&!s,this.getItemSelected(t,u),a,n,s)}render(){var{items:e,itemCount:t,overscanCount:n,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return d.jsx(mu,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:h,height:c}=u;return d.jsx(vu,{className:"item-list-scroll-pane",height:c,width:h,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":a,children:this.renderInnerElement})}})}}Er=bt;ht(bt,"CACHE_SIZE",1e3);ht(bt,"DEFAULT_ROW_HEIGHT",20);ht(bt,"DEFAULT_OVERSCAN",10);ht(bt,"defaultProps",{offset:0,items:[],rowHeight:Er.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Er.DEFAULT_OVERSCAN,renderItem:Er.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var hc=U.module("ErrorBoundary");class cc 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;hc.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(vn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function mc(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 vc=["classNames","timeout","children","onEnter"];function Po(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function To(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Po(Object(t),!0).forEach(function(n){pc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Po(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pc(r,e,t){return(e=fc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fc(r){var e=gc(r,"string");return typeof e=="symbol"?e:e+""}function gc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 bc(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}var Cc={display:"contents"};function Ey(r){var{classNames:e,timeout:t=ss.transitionMs,children:n,onEnter:i}=r,o=bc(r,vc),a=m.useRef(null),s=m.useCallback(u=>{var h=a.current;h&&(i==null||i(h,u))},[i]),l=m.useCallback(u=>{a.current=u==null?void 0:u.firstElementChild},[]);return d.jsx(ns,To(To({nodeRef:a,timeout:t,classNames:q("fade",e),onEnter:s},o),{},{children:d.jsx("div",{ref:l,style:Cc,children:n})}))}var Sc=["children","className","isInvalid","onChange","data-testid"];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){wc(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 wc(r,e,t){return(e=Ec(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ec(r){var e=Pc(r,"string");return typeof e=="symbol"?e:e+""}function Pc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Tc(r,e){if(r==null)return{};var t,n,i=_c(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 _c(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 zs=R.forwardRef((r,e)=>{var{children:t,className:n,isInvalid:i,onChange:o,"data-testid":a}=r,s=Tc(r,Sc),l=ks(e),u=m.useCallback(h=>{o(h.target.value)},[o]);return d.jsx("select",Oo(Oo({ref:l,className:q("custom-select",n,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});zs.displayName="Select";var xi=R.createContext(new Map);xi.displayName="XComponentMapContext";var Py=xi.Provider;function Oc(r){var e,t=m.useContext(xi);return(e=t.get(r))!==null&&e!==void 0?e:r.Original}function xo(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 Qr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xo(Object(t),!0).forEach(function(n){xc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xc(r,e,t){return(e=Ic(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ic(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)}function Gs(r){var e,t;function n(i,o){var a=Oc(t);return Bs(r)?d.jsx(a,Qr(Qr({},i),{},{ref:o})):d.jsx(a,Qr({},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 Nc(){return er(ku,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function qs(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function Xs(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function Ty(r){return qs(r)||Xs(r)}var Zs=m.createContext(null);Zs.displayName="ObjectFetcherContext";function _y(r){if(Xs(r))return{id:r.id,type:r.type};if(qs(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function Mc(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 Oy(){return er(Zs,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function Io(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 kc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Io(Object(t),!0).forEach(function(n){jc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Io(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function jc(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 Ii=Object.freeze({}),Rc=new Map,xy=r=>r.api,Iy=r=>r.user,Ys=r=>r.storage,Qs=r=>Ys(r).commandHistoryStorage,Js=r=>Ys(r).fileStorage,Fc=r=>r.defaultWorkspaceSettings,el=r=>{var{workspace:e}=r;return e},Re=pu(r=>{for(var e,t,n=(e=(t=el(r))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=kc({},Fc(r)),o=Object.keys(n),a=0;a<o.length;a+=1){var s=o[a];n[s]!==void 0&&(i[s]=n[s])}return i}),Dy=r=>r.defaultWorkspaceSettings,Ny=r=>Re(r).defaultDateTimeFormat,My=r=>{var e;return(e=Re(r).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Ii},ky=r=>{var e;return(e=Re(r).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Ii},jy=r=>{var e;return(e=Re(r).formatter)!==null&&e!==void 0?e:[]},$c=r=>Re(r).timeZone,Ay=r=>Re(r).showTimeZone,Ly=r=>Re(r).showTSeparator,Ry=r=>Re(r).truncateNumbersWithPound,Fy=r=>Re(r).showEmptyStrings,$y=r=>Re(r).showNullStrings,Hy=r=>Re(r).showExtraGroupColumn,By=r=>Re(r).shortcutOverrides,Uy=r=>Re(r).webgl,Wy=r=>Re(r).webglEditable,tl=r=>{var e;return(e=Re(r).notebookSettings)!==null&&e!==void 0?e:Ii},Vy=r=>r.activeTool,Hc=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:Rc};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 Mt(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){Bc(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 Bc(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=Wc(r,"string");return typeof e=="symbol"?e:e+""}function Wc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ky=r=>({type:Hu,payload:r}),zy=r=>({type:Lu,payload:r}),nl=r=>({type:Uu,payload:r}),Gy=r=>({type:Wu,payload:r}),qy=r=>({type:Bu,payload:r}),Xy=r=>({type:Fu,payload:r}),Zy=r=>({type:$u,payload:r}),Vc=r=>(e,t)=>{e(nl(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i==null?void 0:i.save(r)},Kc=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n??{},o=Mt(Mt({},n),{},{data:Mt(Mt(Mt({},i),r),{},{settings:Mt(Mt({},i==null?void 0:i.settings),r.settings)})});return e(Vc(o))},zc=r=>(e,t)=>{var{notebookSettings:n}=Re(t()),i=Mt(Mt({},n),r);return e(Gc({notebookSettings:i}))},Gc=r=>e=>e(Kc({settings:r})),Yy=r=>({type:ju,payload:r}),Qy=r=>({type:Au,payload:r}),Jy=r=>({type:Ru,payload:r});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){qc(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 qc(r,e,t){return(e=Xc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Xc(r){var e=Zc(r,"string");return typeof e=="symbol"?e:e+""}function Zc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Yc(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:Mo(Mo({},n),{},{[o]:a})}default:return n}}}function rl(r){var{type:e}=r,t=Nc();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:Ku});case t.VariableType.FIGURE:return d.jsx(ve,{icon:vs});case t.VariableType.PANDAS:return d.jsx(ve,{icon:Vu});default:return d.jsx(ve,{icon:ms})}}function ko(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(n,i)}function Qc(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ko(o,n,i,a,s,"next",l)}function s(l){ko(o,n,i,a,s,"throw",l)}a(void 0)})}}function il(r){var{children:e,language:t}=r,[n,i]=m.useState(null),{activeThemes:o}=js();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=Qc(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 ol{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Or{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)?[]:fu.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 Or.isTableType(e,t)||Or.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function Jc(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 vi(r,e,t){return(e=em(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function em(r){var e=tm(r,"string");return typeof e=="symbol"?e:e+""}function tm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class al extends m.Component{constructor(e){super(e),vi(this,"timer",void 0),vi(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(ps,{className:"ml-2"}),"Running... ",ze.formatElapsedTime(n)," ",d.jsx(ie,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:zu,tooltip:"Cancel",onClick:t,disabled:e})]})})}}vi(al,"defaultProps",{disabled:!1});function zn(r,e,t){return(e=nm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nm(r){var e=rm(r,"string");return typeof e=="symbol"?e:e+""}function rm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 On 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)>=On.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=On.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?li:Gu,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(On,"defaultProps",{message:""});zn(On,"mouseDragThreshold",5);var sl=m.memo(r=>{var{item:e}=r,{startTime:t,serverStartTime:n,serverEndTime:i}=e,o=m.useMemo(()=>{var h;return(h=e.endTime)!==null&&h!==void 0?h: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(As,{children:"Execution Info"}),d.jsx(gu,{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})]})]})})]})});sl.displayName="ConsoleHistoryItemTooltip";var im=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)},ll=m.memo(r=>{var e,{item:t,onCommandSubmit:n,handleTooltipVisible:i}=r,o=m.useMemo(()=>im(t),[t]);return d.jsxs("div",{className:q("console-history-actions",o),children:[d.jsx(Vh,{copy:(e=t.command)!==null&&e!==void 0?e:"",kind:"inline"}),d.jsx(ie,{icon:qu,kind:"inline",onClick:()=>{var a;return n((a=t.command)!==null&&a!==void 0?a:"")},tooltip:"Rerun",children:null}),d.jsx(bu,{variant:"info",onOpenChange:i,UNSAFE_className:"console-history-item-contextual-help",children:d.jsx(sl,{item:t})})]})});ll.displayName="ConsoleHistoryItemActions";function om(r,e,t){return(e=am(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function am(r){var e=sm(r,"string");return typeof e=="symbol"?e:e+""}function sm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 jo=U.module("ConsoleHistoryItem");class ul 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){jo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(jo.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!=="",h=null;u&&(h=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(il,{language:i,children:n.command}),d.jsx(ll,{item:n,onCommandSubmit:a,handleTooltipVisible:k=>this.setState({isTooltipVisible:k})})]})]}));var c=[],v=!1;if(l){var{error:p,message:f,changes:g}=l;if(g){var{created:y,updated:w}=g;[...y,...w].forEach(k=>{v=!0;var{title:F}=k,ee="".concat(F),z=t===void 0||t||(s??[]).indexOf(ee)>=0,j=d.jsx(ie,{kind:"primary",onClick:()=>this.handleObjectClick(k),className:"btn-console-object",disabled:z,icon:o(k.type),children:F},ee);c.push(j)})}if(p!=null&&!u){var T,P="".concat((T=p.message)!==null&&T!==void 0?T:p);P||(P=p);var $=d.jsx(On,{message:P},"result-error");c.push($)}if(f!==void 0&&f!==""){var X=d.jsx("div",{className:"log-message",children:f},"log-message");c.push(X)}}else{v=!0;var re=d.jsx(al,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");c.push(re)}var Y=null;return c.length>0&&(Y=d.jsx(Jc,{children:c})),d.jsxs("div",{className:q("console-command-result",{"console-result-buttons":v}),children:[h,Y]})}}om(ul,"defaultProps",{disabled:!1});function lm(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var um=R.forwardRef(function(e,t){for(var{disabled:n=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l,onCommandSubmit:u}=e,h=[],c=0;c<i.length;c+=1){var v=i[c],p=d.jsx(ul,{disabled:n,item:v,openObject:a,language:o,supportsType:s,iconForType:l,onCommandSubmit:u},lm(c,v));h.push(p)}return d.jsx("div",{ref:t,className:"container-fluid console-history",children:h})}),dm={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]})},hm={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]})},cm={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:dm,COMMAND_HISTORY:hm,NOTEBOOK:cm};const xe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),mm="var(--dh-color-editor-bg)",vm="var(--dh-color-editor-fg)",pm="var(--dh-color-editor-string)",fm="var(--dh-color-editor-delimiter)",gm="var(--dh-color-editor-predefined)",bm="var(--dh-color-editor-keyword)",ym="var(--dh-color-editor-storage)",Cm="var(--dh-color-editor-number)",Sm="var(--dh-color-editor-operator)",wm="var(--dh-color-editor-identifier)",Em="var(--dh-color-editor-comment)",pi={"error-foreground":"var(--dh-color-editor-error-fg)",background:mm,foreground:vm,"line-height":"19px",string:pm,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:fm,predefined:gm,keyword:bm,storage:ym,number:Cm,operator:Sm,identifier:wm,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Em,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)"};var Pm="python",Tm={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/}}},_m={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},Om={id:Pm,conf:Tm,language:_m},xm="groovy",Im={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/}}},Dm={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"]]}},Nm={id:xm,conf:Im,language:Dm},Mm="scala",km={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"]]}},Am={id:Mm,conf:km,language:jm},Lm="deephavenDb",Rm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Fm={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},$m={id:Lm,conf:Rm,language:Fm},Hm="log",Bm={},Um={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"}]]}},Wm={id:Hm,conf:Bm,language:Um},Vm={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 Ao(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 Km(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ao(o,n,i,a,s,"next",l)}function s(l){Ao(o,n,i,a,s,"throw",l)}a(void 0)})}}function Yt(r,e,t){return(e=zm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zm(r){var e=Gm(r,"string");return typeof e=="symbol"?e:e+""}function Gm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var st=U.module("MonacoCompletionProvider");class H extends m.PureComponent{static initRuff(){return Km(function*(){if(H.isRuffEnabled)return H.initRuffPromise||(H.initRuffPromise=yu({}).then(()=>{st.debug("Initialized Ruff",zi.version()),H.isRuffInitialized=!0,H.updateRuffWorkspace()})),H.initRuffPromise})()}static updateRuffWorkspace(){if(H.isRuffInitialized){var e=console.log;try{console.log=()=>{},H.ruffWorkspace=new zi(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?Qi.Error:Qi.Warning,tags:i?[bd.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 h=new ws(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&h.intersectRanges(t)}),i=n.filter(u=>{var{fix:h}=u;return h!=null}).map(u=>{var h="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?h="".concat(u.code,": ").concat(u.fix.message):h="Fix ".concat(u.code)),{title:h,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(c=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:c.location.row,startColumn:c.location.column,endLineNumber:c.end_location.row,endColumn:c.end_location.column},text:(v=c.content)!==null&&v!==void 0?v:""}}})}:void 0}}),o=new Set,a=new Set;n.forEach(u=>{u.code!=null&&(o.has(u.code)&&a.add(u.code),o.add(u.code))});var s=n.map(u=>{if(u.code==null)return[];var h=e.getLineContent(u.location.row),c=Ie.tokenize(h,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:u.location.row,startColumn:h.length+1,endLineNumber:u.location.row,endColumn:h.length+1},text:" # noqa: ".concat(u.code)};return c!=null&&c.type.startsWith("comment")&&(v.text="# noqa: ".concat(u.code," "),h.startsWith("# noqa:",c.offset)?(v.range.startColumn=c.offset+1,v.range.endColumn=c.offset+9):(v.range.startColumn=c.offset+1,v.range.endColumn=h.startsWith("# ",c.offset)?c.offset+3:c.offset+2)),[{title:"Disable ".concat(u.code," for ").concat(a.has(u.code)?"line ".concat(u.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:v}]}}]}).flat().filter((u,h,c)=>c.find(v=>v.title===u.title)===u),l=[...o].map(u=>({title:"Disable ".concat(u," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(u,`
@@ -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(ie,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:nd,tooltip:"Clear log"}),d.jsx(ie,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:rd,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 wp="var(--dh-color-chart-colorway)",Ep="var(--dh-color-chart-grid)",Pp="var(--dh-color-chart-axis-line)",Tp="var(--dh-color-chart-axis-line-zero)",da={"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:wp,gridcolor:Ep,linecolor:Pp,zerolinecolor:Tp,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)"};var ha=U.module("ChartTheme");function _p(){var r,e=fs(da);return e.colorway=id((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return od.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),ha.debug2("Chart theme:",da),ha.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"]})}function ca(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Op(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(n){xp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xp(r,e,t){return(e=Ip(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ip(r){var e=Dp(r,"string");return typeof e=="symbol"?e:e+""}function Dp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Np=m.lazy(()=>Es(()=>import("./Plot-gzyKAEuz.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function Mp(r){return d.jsx(m.Suspense,{fallback:d.jsx(vn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(Np,Op({},r))})}var ji=m.createContext(null);ji.displayName="ChartThemeContext";function hC(r){var{children:e}=r,{activeThemes:t}=js(),n=m.useMemo(_p,[t]);return d.jsx(ji.Provider,{value:n,children:e})}function kp(){return er(ji,"No ChartThemeContext value found.")}function ma(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 jp(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ma(o,n,i,a,s,"next",l)}function s(l){ma(o,n,i,a,s,"throw",l)}a(void 0)})}}var Ap=U.module("HeapUsage");function Lp(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=kp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),p=Ms(),f=m.useCallback(jp(function*(){try{var A=yield t.getWorkerHeapInfo();if(!p.current)return;if(u(A),o||h){for(var B=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:pe,usages:qe}=v.current;pe.length!==0&&V-pe[0]>a*1.5;)pe.shift(),qe.shift();pe.push(V),qe.push(B)}else v.current={timestamps:[],usages:[]}}catch(ke){Ap.warn("Unable to get heap usage",ke)}}),[t,p,o,h,a]);rh(f,h?i:n);var g=(A,B)=>Math.round(A*10**B)/10**B,y=2,w=1024**3,{freeMemory:T,totalHeapSize:P,maximumHeapSize:$}=l,X=g(T/w,y),re=g(P/w,y),Y=g($/w,y),k=re-X,F=function(B,V){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:q("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:B}),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-T)/$;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-T)/$>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[F("In use:","".concat(k.toFixed(y)," of ").concat(Y.toFixed(y)," GB"),!0),F("Free:","".concat(X.toFixed(y)," GB")),F("Total:","".concat(re.toFixed(y)," GB")),F("Max:","".concat(Y.toFixed(y)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Mp,{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 wl=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 El(r){return r.componentName!==void 0}function Rp(r){return r.component!==void 0}var Pl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Fp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:wl,isGLComponentConfig:El,isReactComponentConfig:Rp,itemDefaultConfig:Pl},Symbol.toStringTag,{value:"Module"}));function Pr(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=Hp(r,"string");return typeof e=="symbol"?e:e+""}function Hp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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(){Pr(this,"_mSubscriptions",void 0),Pr(this,"off",this.unbind),Pr(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(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Ge.ALL_EVENT],u=0;u<l.length;u++){var h=l[u].ctx||{};try{l[u].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,n){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Pr(Ge,"ALL_EVENT","__all");function mt(r,e,t){return(e=Bp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bp(r){var e=Up(r,"string");return typeof e=="symbol"?e:e+""}function Up(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 bi 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=El(e)?e.componentName:"",this.parent=t,this.layoutManager=n,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var n,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",h=u==="height"?t:e,c=((n=this[u])!==null&&n!==void 0?n:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=h/c*100,p=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),f=0;f<a.contentItems.length;f++)if(a.contentItems[f]===s)a.contentItems[f].config[u]=v;else{var g;a.contentItems[f].config[u]=((g=a.contentItems[f].config[u])!==null&&g!==void 0?g:0)+p}return a.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(N.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Wp=Object.freeze(Object.defineProperty({__proto__:null,Container:bi,ItemContainer:bi},Symbol.toStringTag,{value:"Module"}));function Tl(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function _l(r){if(window.location.hash)return Tl(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 Ai(r){return window.requestAnimationFrame(r)}function Vp(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 Nr(){return Et()}function Kp(r,e){var t=r.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function Li(r){return N.trim(r.replace(/(<([^>]+)>)/gi,""))}function Ze(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 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 Cn(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 Ol{constructor(e,t){Cn(this,"_container",void 0),Cn(this,"_reactComponent",null),Cn(this,"_portalComponent",null),Cn(this,"_originalComponentWillUpdate",null),Cn(this,"_initialState",void 0),Cn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Lr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=N.extend(e,this._container._config.props);return R.createElement(this._reactClass,t)}}var Mr=["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"],Zp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ri(r){if(Mr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fi(r,e,"_min"),e}function yi(r){if(Mr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fi(r,e,"_max"),e}function Fi(r,e,t){var n=t==="_min"?Yp:Qp;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,Mr);e[s]=a}Fi(o,a,t)}else{var l=n(o,Zp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=n(i,Mr);e[u]=l}}}}function Yp(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function Qp(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function ni(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=ef(r,"string");return typeof e=="symbol"?e:e+""}function ef(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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{constructor(e,t){ni(this,"name",void 0),ni(this,"origin",void 0),ni(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function cr(r,e,t){return(e=tf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tf(r){var e=nf(r,"string");return typeof e=="symbol"?e:e+""}function nf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 xl=class extends Ge{constructor(e){super(),cr(this,"_layoutManager",void 0),cr(this,"_dontPropagateToParent",void 0),cr(this,"_childEventSource",void 0),cr(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 Il(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function Dl(r){return(e,t)=>Il(e,r,t)}function Nl(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 Ml(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:Dl(r),emit:Nl(r),useListener:Ml(r)}}const rf=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Ci,DragListener:nr,EventEmitter:Ge,EventHub:xl,ReactComponentHandler:Ol,animFrame:Ai,filterXss:Kp,getHashValue:Tl,getQueryStringParam:_l,getUniqueId:Nr,listenForEvent:Il,makeEmitFunction:Nl,makeEventFunctions:Jt,makeListenFunction:Dl,makeUseListenerFunction:Ml,minifyConfig:Ri,removeFromArray:Vp,stripTags:Li,unminifyConfig:yi},Symbol.toStringTag,{value:"Module"}));function $t(r,e,t){return(e=of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function of(r){var e=af(r,"string");return typeof e=="symbol"?e:e+""}function af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kl 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,h,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(n=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&n!==void 0?n:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,n=null;if(this._parentId){var i;if(t=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-"+Nr();e=Ri(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=sf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sf(r){var e=lf(r,"string");return typeof e=="symbol"?e:e+""}function lf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class bn extends Ge{constructor(e,t,n,i,o,a){var s,l,u,h,c,v,p,f;if(super(),_e(this,"_dragListener",void 0),_e(this,"_layoutManager",void 0),_e(this,"_contentItem",void 0),_e(this,"_originalParent",void 0),_e(this,"_area",null),_e(this,"_lastValidArea",null),_e(this,"_minX",void 0),_e(this,"_maxX",void 0),_e(this,"_minY",void 0),_e(this,"_maxY",void 0),_e(this,"_width",void 0),_e(this,"_height",void 0),_e(this,"_sided",void 0),_e(this,"element",void 0),_e(this,"childElementContainer",void 0),_e(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=N(bn._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",Li((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,T;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(h=P==null?void 0:P.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(f=this.element.height())!==null&&f!==void 0?f:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,o,a=(i=n.pageX)!==null&&i!==void 0?i:0,s=(o=n.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}_e(bn,"_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 mr(r,e,t){return(e=uf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uf(r){var e=df(r,"string");return typeof e=="symbol"?e:e+""}function df(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 jl{constructor(e,t,n){mr(this,"_element",void 0),mr(this,"_itemConfig",void 0),mr(this,"_layoutManager",void 0),mr(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 bn(e,t,this._dragListener,this._layoutManager,i,null)}}function vr(r,e,t){return(e=hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hf(r){var e=cf(r,"string");return typeof e=="symbol"?e:e+""}function cf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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,n){vr(this,"_element",N(window)),vr(this,"_itemConfig",void 0),vr(this,"_layoutManager",void 0),vr(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 bn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Ll(r,e,t){return(e=mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mf(r){var e=vf(r,"string");return typeof e=="symbol"?e:e+""}function vf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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(){Ll(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()}}Ll(rr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ri(r,e,t){return(e=pf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pf(r){var e=ff(r,"string");return typeof e=="symbol"?e:e+""}function ff(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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){ri(this,"element",void 0),ri(this,"_header",void 0),ri(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 gf(r,e,t){return(e=bf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bf(r){var e=yf(r,"string");return typeof e=="symbol"?e:e+""}function yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class un extends Error{constructor(e,t){super(),gf(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Cf=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:un},Symbol.toStringTag,{value:"Module"}));function Pe(r,e,t){return(e=Sf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sf(r){var e=wf(r,"string");return typeof e=="symbol"?e:e+""}function wf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 dn(r){return r.isStack}function et(r){return r.isComponent}function Rl(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,dn(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],n=function(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),n(o.contentItems[a])};return n(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&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 Ci(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new un("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(Pl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof Ci&&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,Ai(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Ln(r,e,t){return(e=Ef(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ef(r){var e=Pf(r,"string");return typeof e=="symbol"?e:e+""}function Pf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Fl 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()),Ln(this,"config",void 0),Ln(this,"componentName",void 0),Ln(this,"container",void 0),Ln(this,"parent",void 0),Ln(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 un('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 bi(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=Tf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tf(r){var e=_f(r,"string");return typeof e=="symbol"?e:e+""}function _f(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,n),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(De.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var u,h,c=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[n];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[n]=((u=this.contentItems[l].config[n])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=u.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var p=0;p<n.length;p++){l=n[p];var f=Math.round((l.width-t)*v);a-=f,l.width-=f}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new $l(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,n=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((n=a.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_onSplitterDrag(e,t,n){var i=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,n,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),c=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Ai(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function va(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 pa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(n){Si(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Si(r,e,t){return(e=Of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Of(r){var e=xf(r,"string");return typeof e=="symbol"?e:e+""}function xf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 extends De{constructor(e,t,n){super(e,pa(pa({},t),{},{type:"root"}),null,N('<div class="lm_goldenlayout lm_item lm_root"></div>')),Si(this,"childElementContainer",void 0),Si(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 h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}function fa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(n){tt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tt(r,e,t){return(e=If(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function If(r){var e=Df(r,"string");return typeof e=="symbol"?e:e+""}function Df(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Ei extends De{constructor(e,t,n){var i,o,a,s,l,u,h,c,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 p=e.config;this._side=!1,this._header={show:((i=p.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=p.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=p.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=p.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=p.settings)!==null&&u!==void 0&&u.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(v=p.labels)===null||v===void 0?void 0:v.minimise)!==null&&c!==void 0?c:void 0},p.header&&(this._header=Sn(Sn({},this._header),p.header)),t.header&&(this._header=Sn(Sn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Sn(Sn({},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,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c,v=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,i,o,a,s,l,u,h,c,v,p,f,g,y,w,T=this.header.tabs.length;if(T===0){var P,$,X,re,Y,k,F,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:((X=z==null?void 0:z.left)!==null&&X!==void 0?X:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((k=(F=this.header.element.offset())===null||F===void 0?void 0:F.top)!==null&&k!==void 0?k: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,B;if(!(W.left<e&&e<W.right)){for(var V=0;V<T;V++){var pe;if(A=this.header.tabs[V].element,B=(pe=A.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),B&&B.left<e&&e<B.right){this._dropIndex=V;break}}if(A&&B&&e<B.left+B.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var qe;this._dropIndex=Math.min(((qe=this._dropIndex)!==null&&qe!==void 0?qe:0)+1,T),A.after(this.layoutManager.tabDropPlaceholder)}}var ke=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;ke=Math.max(ke,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var b=ke+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);b=Math.min(b,((u=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&u!==void 0?u:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:ke,x2:b,y1:(p=(f=this.header.element.offset())===null||f===void 0?void 0:f.top)!==null&&p!==void 0?p:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.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 Nf=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:De,Component:Fl,ContentItem:De,Root:wi,RowOrColumn:Zn,Stack:Ei,isComponent:et,isRoot:Rl,isStack:dn},Symbol.toStringTag,{value:"Module"}));function Nt(r,e,t){return(e=Mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mf(r){var e=kf(r,"string");return typeof e=="symbol"?e:e+""}function kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ir{constructor(e,t){var n;Nt(this,"header",void 0),Nt(this,"contentItem",void 0),Nt(this,"element",N(ir._template)),Nt(this,"titleElement",void 0),Nt(this,"closeElement",void 0),Nt(this,"isActive",!1),Nt(this,"_layoutManager",void 0),Nt(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)}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 bn(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()}}Nt(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=jf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jf(r){var e=Af(r,"string");return typeof e=="symbol"?e:e+""}function Af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class 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,h;l.scrollLeft=(u=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,v,p=o||h,f=h-p,g=this.START_SPEED*f+.5*this.ACCELERATION*(f*f);g=Math.min(g,(c=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,p)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),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 h=(s+l+u.length)%u.length;h!==s;){if(u.eq(h).css("display")!=="none")return h;h=(h+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),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(),h=o<s-u.bottom,c=!h&&u.bottom>s*.6,v=Math.min(u.left+(c?u.width:0),l-a.width-this.PADDING),p=c?Math.max(u.top-o,this.PADDING):u.bottom,f=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":f,top:p,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}se(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 Rn(r,e,t){return(e=Lf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lf(r){var e=Rf(r,"string");return typeof e=="symbol"?e:e+""}function Rf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $l{constructor(e,t,n){Rn(this,"_isVertical",void 0),Rn(this,"_size",void 0),Rn(this,"_grabSize",void 0),Rn(this,"_dragListener",void 0),Rn(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 Ff=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:kl,DragProxy:bn,DragSource:jl,DragSourceFromEvent:Al,DropTargetIndicator:rr,Header:jt,HeaderButton:Un,Splitter:$l,Tab:ir},Symbol.toStringTag,{value:"Module"}));var $f={config:Fp,container:Wp,controls:Ff,errors:Cf,items:Nf,utils:rf};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 Ye(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){le(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 le(r,e,t){return(e=Hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hf(r){var e=Bf(r,"string");return typeof e=="symbol"?e:e+""}function Bf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 ba=["column","row","stack","component"];class Br extends Ge{static isLayoutItemConfig(e){return ba.includes(e.type)}static minifyConfig(e){return Ri(e)}static unminifyConfig(e){return yi(e)}constructor(e,t){super(),le(this,"isInitialised",!1),le(this,"_isFullPage",!1),le(this,"_resizeTimeoutId",void 0),le(this,"_components",{"lm-react-component":Ol}),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 xl(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 un("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Br.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+ba.join(","),new un(i);return e.type==="component"&&!(t instanceof Ei)&&t&&!(this.isSubWindow===!0&&t instanceof wi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Nr(),e.type==="stack"?new Ei(this,e,t):e.type==="row"?new Zn(!1,this,e,t):e.type==="column"?new Zn(!0,this,e,t):new Fl(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=Nr();for(var u=e.parent,h=e;((c=u)===null||c===void 0?void 0:c.contentItems.length)===1&&!u.isRoot;){var c;h=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var p,f,g,y=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,T=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:y+T.left,top:w+T.top,width:(f=e.element.width())!==null&&f!==void 0?f:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!n||i===void 0)){var P=new kl(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 jl(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Al(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(dn(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=_l("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=yi(e),localStorage.removeItem(n)),e=N.extend(!0,{},wl,e);var i=function(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?i(l):s==="type"&&l==="react-component"&&(a.type="component",a.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=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=Li((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 un(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new un(t,e);this.root=new wi(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=>{dn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}le(Br,"__lm",$f);const ya={"tab-height":"28px","drag-border-width":"5px"},Ca=Object.freeze({tabHeight:parseInt(ya["tab-height"],10),dragBorderWidth:parseInt(ya["drag-border-width"],10)});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 Dt(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){Hl(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 Hl(r,e,t){return(e=Uf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uf(r){var e=Wf(r,"string");return typeof e=="symbol"?e:e+""}function Wf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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=U.module("LayoutUtils");function Bl(r){return r.componentName!==void 0}function Kt(r){var e=r;return(Bl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function pr(r){return r.focus!==void 0}function wa(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(Rl(e)){var n={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(n);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(n);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,h,c=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(h=s.config)===null||h===void 0?void 0:h.width},e);e.replaceChild(s,c),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(n=>n.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=x.getAllStackContainers(e),n=x.getFocusedStackIndex(t);return t[n]}static getStackById(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&dn(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(dn(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&&dn(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&&qi(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&&qi(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?(wa(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);wa(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,h=Dt({},t);if(h.id==null&&(h.id=Et()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};L(e);var v=n??(a?x.addStack(e):x.getStackForRoot(e,c));L(v);var p=x.getContentItemInStack(v,c);if(s!=null){var f=y=>{Ht.debug("Component created, focusing element",s),v.off("componentCreated",f);var{element:w}=y.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",f)}if(i&&p){var g=v.contentItems.indexOf(p);v.addChild(h,g+1),v.removeChild(p),v.setActiveContentItem(v.contentItems[g])}else v.addChild(h);s==null&&u&&pr(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&&pr(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)&&pr(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(Bl(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:Ca.tabHeight,borderWidth:Ca.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:(pr(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)})}}Hl(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Vf=R.forwardRef((r,e)=>{var t=x.getComponentNameFromPanel({props:r});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Vf.displayName="PanelPlaceholder";var oe=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:mC,emit:Kf,useListener:vC}=Jt(oe.OPEN),Ur=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:zf,emit:pC,useListener:fC}=Jt(Ur.CYCLE_TO_NEXT_STACK),{listen:Gf,emit:gC,useListener:bC}=Jt(Ur.CYCLE_TO_PREVIOUS_STACK),{listen:qf,emit:yC,useListener:CC}=Jt(Ur.CYCLE_TO_NEXT_TAB),{listen:Xf,emit:SC,useListener:wC}=Jt(Ur.CYCLE_TO_PREVIOUS_TAB);function Zf(r){return typeof r.id=="string"&&r.layout instanceof Br&&r.panelManager instanceof $i&&typeof r.registerComponent=="function"}function Yf(r){if(!Zf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function Ea(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Pa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(n){kt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kt(r,e,t){return(e=Qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qf(r){var e=Jf(r,"string");return typeof e=="symbol"?e:e+""}function Jf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var dt=U.module("PanelManager"),an=function(r){return r[r.Next=0]="Next",r[r.Previous=1]="Previous",r}(an||{});class $i{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]:()=>{};kt(this,"layout",void 0),kt(this,"hydrateComponent",void 0),kt(this,"dehydrateComponent",void 0),kt(this,"onPanelsUpdated",void 0),kt(this,"closed",void 0),kt(this,"openedMap",void 0),kt(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(oe.FOCUS,this.handleFocus),e.on(oe.MOUNT,this.handleMount),e.on(oe.UNMOUNT,this.handleUnmount),e.on(oe.REOPEN,this.handleReopen),e.on(oe.REOPEN_LAST,this.handleReopenLast),e.on(oe.DELETE,this.handleDeleted),e.on(oe.CLOSED,this.handleClosed),e.on(oe.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(zf(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Gf(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(qf(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Xf(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(oe.FOCUS,this.handleFocus),e.off(oe.MOUNT,this.handleMount),e.off(oe.UNMOUNT,this.handleUnmount),e.off(oe.REOPEN,this.handleReopen),e.off(oe.REOPEN_LAST,this.handleReopenLast),e.off(oe.DELETE,this.handleDeleted),e.off(oe.CLOSED,this.handleClosed),e.off(oe.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=>_r(n)&&t instanceof n.WrappedComponent||!_r(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===an.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,h=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(h,!0)}}handleCycleToNextStack(){this.cycleStack(an.Next)}handleCycleToPreviousStack(){this.cycleStack(an.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===an.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(an.Next)}handleCycleToPreviousTab(){this.cycleTab(an.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=Pa(Pa({},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)})}}kt($i,"MAX_CLOSED_PANEL_COUNT",100);var eg=U.module("PanelErrorBoundary");class tg 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);eg.debug("componentWillUnmount",n),t.emit(oe.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(vn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Ta(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function kr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(n){ng(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ng(r,e,t){return(e=rg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rg(r){var e=ig(r,"string");return typeof e=="symbol"?e:e+""}function ig(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ul(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),kr(kr({},r),{},{componentState:null,props:o,type:"react-component"})}function Wl(r,e){return kr(kr({},r),{},{localDashboardId:e})}const og={dehydrate:Ul,hydrate:Wl};var Vl=R.createContext(void 0);Vl.displayName="LayoutManagerContext";var ag=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}),Kl=be.shape({on:be.func,off:be.func,emit:be.func}),sg=be.shape({registerComponent:be.func,root:be.shape({addChild:be.func}),on:be.func,off:be.func,eventHub:Kl}),EC=Object.freeze({Container:ag,EventHub:Kl,Layout:sg});function Fn(r,e,t,n){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");R.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Ae(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var zl="SET_DASHBOARD_DATA";const lg=Yc(zl,{},!1),ug={dashboardData:lg};var dg=new Map,Gl=Object.freeze({}),hg=Object.freeze([]),PC=_i,cg=is,TC=Su,mg=r=>r.dashboardData,Fe=(r,e)=>{var t;return(t=mg(r)[e])!==null&&t!==void 0?t:Gl},_C=(r,e)=>{var t;return(t=Fe(r,e).closed)!==null&&t!==void 0?t:hg},OC=(r,e)=>{var t;return(t=Fe(r,e).openedMap)!==null&&t!==void 0?t:dg},ql=(r,e)=>{var t;return(t=Fe(r,e).pluginDataMap)!==null&&t!==void 0?t:Gl},xC=(r,e,t)=>ql(r,e)[t];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 Tn(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){vg(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 vg(r,e,t){return(e=pg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pg(r){var e=fg(r,"string");return typeof e=="symbol"?e:e+""}function fg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Xl=(r,e)=>({type:zl,id:r,payload:e}),en=(r,e)=>(t,n)=>t(Xl(r,Tn(Tn({},Fe(n(),r)),e))),IC=(r,e,t)=>(n,i)=>n(Xl(r,Tn(Tn({},Fe(i(),r)),{},{pluginDataMap:Tn(Tn({},ql(i(),r)),{},{[e]:t})})));Object.entries(ug).map(r=>{var[e,t]=r;return ad.register(e,t)});function gg(r){var{children:e}=r;return d.jsx(d.Fragment,{children:e})}var Hi=m.createContext(null);Hi.displayName="PanelIdContext";function bg(){return m.useContext(Hi)}function Oa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $n(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(n){yg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yg(r,e,t){return(e=Cg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cg(r){var e=Sg(r,"string");return typeof e=="symbol"?e:e+""}function Sg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fr=U.module("DashboardLayout"),wg=Object.freeze({}),Eg=[],xa=()=>{},Pg=1e3,Ia=r=>r;function DC(r){var e,t,{id:n,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=Eg,onLayoutChange:l=xa,onLayoutInitialized:u=xa,hydrate:h=Wl,dehydrate:c=Ul,panelWrapper:v=gg}=r,p=_i(),f=(e=is(b=>Fe(b,n)))!==null&&e!==void 0?e:wg,[g,y]=m.useState(!1),[w,T]=m.useState(!1),[P,$]=m.useState(),[X]=m.useState((t=f==null?void 0:f.closed)!==null&&t!==void 0?t:[]),[re,Y]=m.useState(a.getReactChildren()),k=m.useMemo(()=>new Map,[]),F=m.useMemo(()=>new Map,[]),ee=m.useCallback(function(b,S){var _,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;fr.debug2("registerComponent",b,S,K,ne);function at(Z,ae){var ce=S,$e=v,Ot=Bs(ce),{glContainer:Ct,glEventHub:qr}=Z,An=x.getIdFromContainer(Ct);return d.jsx(tg,{glContainer:Ct,glEventHub:qr,children:d.jsx(Hi.Provider,{value:An,children:d.jsx($e,$n($n({},Z),{},{children:Ot?d.jsx(ce,$n($n({},Z),{},{ref:ae})):d.jsx(ce,$n({},Z))}))})})}at.displayName="DashboardWrapper(".concat((_=S.displayName)!==null&&_!==void 0?_:b,")");var I=a.registerComponent(b,R.forwardRef(at));return k.set(b,K),F.set(b,ne),I},[h,c,k,F,a,v]),z=m.useCallback((b,S)=>{var _;return((_=k.get(b))!==null&&_!==void 0?_:Ia)(S,n)},[k,n]),j=m.useCallback((b,S)=>{var _;return((_=F.get(b))!==null&&_!==void 0?_:Ia)(S,n)},[F,n]),G=m.useMemo(()=>new $i(a,z,j,new Map,X,b=>{var{closed:S,openedMap:_}=b;p(en(n,{closed:S,openedMap:_}))}),[j,p,z,n,X,a]),W=ah(b=>{var S=P==null||!x.isEqual(P,b);fr.debug("handleLayoutStateChanged",S,b),S&&(y(a.root.contentItems.length===0),$(b),l(b),Y(a.getReactChildren()))},Pg,{flushOnUnmount:!0});m.useEffect(()=>()=>W.flush(),[W]);var A=m.useCallback(()=>{if(!w){var b=a.toConfig(),S=b.content,_=x.dehydrateLayoutConfig(S,j);W(_)}},[j,w,a,W]),B=m.useCallback(b=>{var S=x.getIdFromContainer(b);a.eventHub.emit(oe.DRAGGING,S),T(!0)},[a.eventHub]),V=m.useCallback(b=>{var S=x.getIdFromContainer(b);a.eventHub.emit(oe.DROPPED,S),T(!1)},[a.eventHub]),pe=m.useCallback(b=>{if(fr.debug2("handleComponentCreated",b),!(b==null||b.config==null||!Kt(b.config)||b.config.component==null||b.element==null)){var S=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),_="".concat(S,"-component");b.element.addClass(_)}},[]),qe=m.useCallback(()=>{Y(a.getReactChildren())},[a]);Ae(a,"stateChanged",A),Ae(a,"itemPickedUp",B),Ae(a,"itemDropped",V),Ae(a,"componentCreated",pe),Ae(a.eventHub,oe.TITLE_CHANGED,A),Ae(a,"reactChildrenChanged",qe);var ke=oh(s);return m.useEffect(function(){if(ke!==s&&s!==P){fr.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[_]);y(a.root.contentItems.length===0)}},[z,a,s,P,G,ke]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,re,R.Children.map(i,b=>b!=null?d.jsx(cc,{fallback:[],children:R.cloneElement(b,{id:n,layout:a,panelManager:G,registerComponent:ee})}):null)]})}var Zl=m.createContext(null);Zl.displayName="DashboardIdContext";function NC(){var r=m.useContext(Zl);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function Tg(r,e,t){return(e=_g(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _g(r){var e=Og(r,"string");return typeof e=="symbol"?e:e+""}function Og(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Yl(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=Yl(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 Bi=xg(m.createContext(null));Bi.displayName="FiberContext";class MC extends m.Component{constructor(){super(...arguments),Tg(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Bi.Provider,{value:this._reactInternals,children:e})}}function Ig(){var r=m.useContext(Bi);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=Yl(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 kC="default",Dg="CREATE_DASHBOARD",Ng="CLOSE_DASHBOARD",{listen:jC,emit:AC,useListener:LC}=Jt(Dg),{listen:RC,emit:Mg,useListener:FC}=Jt(Ng);function kg(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)}class Ql 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(oe.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})}}kg(Ql,"defaultProps",{additionalActions:[]});var Lg=r=>({workspace:el(r)}),Rg=Mn(Lg,{setWorkspace:nl})(Ql);function Jl(r,e,t){return(e=Fg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fg(r){var e=$g(r,"string");return typeof e=="symbol"?e:e+""}function $g(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 eu extends m.PureComponent{constructor(e){super(e),Jl(this,"renameInputRef",void 0),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=R.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:o}=this.state;return d.jsxs("form",{className: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(ie,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(ie,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Rr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Jl(eu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var gr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Da(r,e,t){return(e=Hg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hg(r){var e=Bg(r,"string");return typeof e=="symbol"?e:e+""}function Bg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ug=U.module("Panel");class Wg extends m.PureComponent{constructor(e){super(e),Da(this,"ref",void 0),Da(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=R.createRef();var{glContainer:t}=this.props;this.state={title:x.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,{componentPanel:t,glContainer:n,glEventHub:i}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),i.on(gr.focus,this.handleTabFocus),i.on(gr.blur,this.handleTabBlur),i.emit(oe.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(gr.focus,this.handleTabFocus),n.off(gr.blur,this.handleTabBlur),n.emit(oe.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(oe.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){Ug.error("Could not get component config from container",e);return}var o=x.cloneComponent(n,i);o!==null&&t.emit(oe.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=Ps,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:v}=i,{showRenameDialog:p,title:f,isWithinPanel:g}=this.state;return d.jsxs("div",{className:q("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(vn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Lr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Rg,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,h,c)}),c&&d.jsx(eu,{isShown:p,value:f,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var Vg=Gs(Wg),Kg=U.module("useDhId"),ii="__dhId";function $C(){var r,e,t=(r=(e=Ig())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[ii],i=bg();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(ii," to be a string, but got ").concat(typeof n));return n}return i??(Kg.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ii," prop. Defaulting to null.")),null)}function or(r,e,t){return(e=zg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zg(r){var e=Gg(r,"string");return typeof e=="symbol"?e:e+""}function Gg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Me{}or(Me,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");or(Me,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");or(Me,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");or(Me,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");or(Me,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function tn(r,e,t){return(e=qg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qg(r){var e=Xg(r,"string");return typeof e=="symbol"?e:e+""}function Xg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 HC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Lt(r,e,t){return(e=Zg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zg(r){var e=Yg(r,"string");return typeof e=="symbol"?e:e+""}function Yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}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 Qg=["children"];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 Ma(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){Jg(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 Jg(r,e,t){return(e=eb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eb(r){var e=tb(r,"string");return typeof e=="symbol"?e:e+""}function tb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function nb(r,e){if(r==null)return{};var t,n,i=rb(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 rb(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 ib extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(Me.SESSION_CLOSED,this.handleSessionClosed),e.on(Me.SESSION_OPENED,this.handleSessionOpened),e.on(Tt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.SESSION_CLOSED,this.handleSessionClosed),e.off(Me.SESSION_OPENED,this.handleSessionOpened),e.off(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=nb(e,Qg);return d.jsx(Vg,Ma(Ma({},n),{},{children:t}))}}var ar=Gs(ib);const BC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var ob=Object.freeze({}),ab=new Map,Wr=Object.freeze([]),UC=(r,e)=>{var t;return(t=Fe(r,e).columns)!==null&&t!==void 0?t:Wr},WC=(r,e)=>{var t;return(t=Fe(r,e).filterSets)!==null&&t!==void 0?t:Wr},VC=(r,e)=>{var t;return(t=Fe(r,e).filters)!==null&&t!==void 0?t:Wr},KC=(r,e)=>{var t;return(t=Fe(r,e).tableMap)!==null&&t!==void 0?t:ab},zC=(r,e)=>Fe(r,e).isolatedLinkerPanelId,tu=(r,e)=>{var t;return(t=Fe(r,e).links)!==null&&t!==void 0?t:Wr},GC=(r,e)=>Fe(r,e).columnSelectionValidator,qC=(r,e)=>{var t;return(t=Fe(r,e).consoleSettings)!==null&&t!==void 0?t:ob},XC=(r,e)=>Fe(r,e).connection,sr=(r,e)=>Fe(r,e).sessionWrapper,ZC=(r,e)=>t=>t(en(r,{connection:e})),YC=(r,e)=>t=>t(en(r,{sessionWrapper:e})),nu=(r,e)=>t=>t(en(r,{links:e})),QC=(r,e)=>(t,n)=>{var i=tu(n(),r),o=e.filter(a=>i.findIndex(s=>Gn(s.start,a.start)&&Gn(s.end,a.end))<0);return t(nu(r,i.concat(o)))},JC=(r,e)=>(t,n)=>{var i=tu(n(),r),o=i.filter(a=>!e.includes(a.id));return t(nu(r,o))},e0=(r,e)=>t=>t(en(r,{isolatedLinkerPanelId:e})),t0=(r,e)=>t=>t(en(r,{columnSelectionValidator:e})),sb=(r,e)=>t=>t(en(r,{consoleSettings:e})),n0=(r,e)=>t=>t(en(r,{filterSets:e}));function jr(r,e,t){return(e=lb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lb(r){var e=ub(r,"string");return typeof e=="symbol"?e:e+""}function ub(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 br=U.module("CommandHistoryPanel");class lr extends m.Component{static handleError(e){br.error(e)}constructor(e){super(e),jr(this,"container",void 0),jr(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=R.createRef(),this.pending=new 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(Me.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:n,language:i}=this.state;if(br.debug("handleSendToNotebook",n,e),!n){br.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;br.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Me.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;L(t),L(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(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})]})]})}}jr(lr,"COMPONENT","CommandHistoryPanel");jr(lr,"TITLE","Command History");var db=(r,e)=>{var t=Qs(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}},hb=Mn(db,null,null,{forwardRef:!0})(lr),ru=m.createContext(null);ru.displayName="PluginsContext";var jn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function cb(r){return"DashboardPlugin"in r}function mb(r){return"AuthPlugin"in r}function vb(r){return"TablePlugin"in r}function r0(r){return cb(r)||mb(r)||vb(r)}function pb(r){return"type"in r&&r.type===jn.DASHBOARD_PLUGIN}function Ui(r){return"type"in r&&r.type===jn.WIDGET_PLUGIN}function fb(r){return"type"in r&&r.type===jn.TABLE_PLUGIN}function gb(r){return"type"in r&&r.type===jn.AUTH_PLUGIN}function iu(r){return"type"in r&&r.type===jn.THEME_PLUGIN}function ou(r){return"type"in r&&r.type===jn.ELEMENT_PLUGIN}function i0(r){return pb(r)||gb(r)||fb(r)||iu(r)||Ui(r)||ou(r)}var au=U.module("@deephaven/plugin.PluginUtils");function ka(r,e){return r==null||!Ui(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function bb(r){var e=d.jsx(ve,{icon:ms});if(!Ui(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function o0(r){var e=[...r.entries()].filter(t=>iu(t[1]));return au.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:sd(n,s),name:s,styleContent:u}})}).flat()}function a0(r){var e=[...r.entries()].filter(t=>ou(t[1])&&t[1].mapping!=null);return au.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function s0(){return er(ru,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var su=m.createContext(null);su.displayName="PersistentStateContext";function l0(r){var{initialState:e,onChange:t,children:n}=r,[i,o]=R.useState(0),a=m.useRef({initial:e,initialStateMap:new Map,state:new Map,isTracking:!0}),s=m.useCallback((v,p)=>{a.current.isTracking&&a.current.state.set(v,p)},[]),l=m.useCallback(()=>{a.current.isTracking||(a.current.isTracking=!0,a.current.state=new Map,o(v=>v+1))},[]),u=m.useRef(a.current.initial[Symbol.iterator]()),h=m.useCallback(function(p){var f=a.current.initialStateMap.get(p);if(f)return f;var{value:g,done:y}=u.current.next(),w={value:g,done:y??!1};return a.current.initialStateMap.set(p,w),w},[]);m.useEffect(function(){a.current.isTracking&&(t([...a.current.state.values()]),a.current.isTracking=!1)},[i,t]);var c=m.useMemo(()=>({addState:s,scheduleStateUpdate:l,getInitialState:h,updateId:i}),[s,h,l,i]);return d.jsx(su.Provider,{value:c,children:n})}function ja(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(n){hn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hn(r,e,t){return(e=yb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yb(r){var e=Cb(r,"string");return typeof e=="symbol"?e:e+""}function Cb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Cr=U.module("ConsolePanel"),Sb=500,wb=Object.freeze({consoleSettings:{},itemIds:[]});class Vr extends m.PureComponent{constructor(e){super(e),hn(this,"consoleRef",void 0),hn(this,"objectSubscriptionCleanup",void 0),hn(this,"savePanelState",mn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Cr.debug("Saving panel state",l),this.setState({panelState:l})},Sb)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=R.createRef();var{panelState:t}=e,n=yr(yr({},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(oe.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(oe.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=>{Cr.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,u=[...a,...l],h=new Map(o);u.forEach(v=>{var{title:p}=v;p!==void 0&&h.delete(p)});var c=[...a,...s];return c.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,i=n.get(e);return i==null&&t&&(i=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(Me.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;L(this.context);var{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(oe.CLOSE,n),Mg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Cr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Me.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;L(n);var{config:i,session:o}=n,{title:a=e.name}=e;L(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:yr(yr({},Mc(e)),{},{sessionId:i.id})};Cr.debug("openWidget",l),Kf(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(oe.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=>ka(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>ka(i,e));return n!=null?bb(n):d.jsx(rl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(vn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:h,session:c,connection:v,details:p={},dh:f}=i,{workerName:g,processInfoId:y}=p,{id:w,type:T}=h;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:c!=null&&d.jsx(qt,{dh:f,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:T,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:ol.LANGUAGE_MAP.get(T)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),y!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),y,d.jsx("div",{children:"•"})]}),d.jsx(Lp,{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(Vr,"COMPONENT","ConsolePanel");hn(Vr,"TITLE","Console");hn(Vr,"contextType",Vl);var Eb=(r,e)=>({commandHistoryStorage:Qs(r),sessionWrapper:sr(r,e.localDashboardId),timeZone:$c(r),plugins:Hc(r)}),oi=Mn(Eb,null,null,{forwardRef:!0})(Vr);function u0(r){return r==="file"||r==="directory"}function gt(r){return r.type==="directory"}function Pb(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=_b(r,"string");return typeof e=="symbol"?e:e+""}function _b(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 extends Error{constructor(){super("No file exists at the path specified"),Pb(this,"isFileNotFound",!0)}}function Aa(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 La(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Aa(o,n,i,a,s,"next",l)}function s(l){Aa(o,n,i,a,s,"throw",l)}a(void 0)})}}var sn=function(r){return r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN="",r}({});class M{static fileExists(e,t){return La(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Wi))throw n;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!M.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getUniqueCopyFileName(e,t){return La(function*(){for(var n=M.getCopyFileName(t);yield M.fileExists(e,n);)n=M.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return sn.GROOVY;case"py":return sn.PYTHON;case"pyc":return sn.PYTHON_COMPILED;case"scala":return sn.SCALA;case"txt":return sn.PLAIN_TEXT;default:return sn.UNKNOWN}}static getParent(e){if(!M.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!M.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,o=M.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new 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=>M.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}var Vi=26;function Pi(r){return gt(r)?M.makePath(r.filename):M.getPath(r.filename)}function Ra(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=Pi(e);if(r.some(n=>{var{filename:i}=n;return M.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>gt(n)&&t.startsWith(M.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function Ob(r){if(gt(r))return r.isExpanded?ld:ud;var e=M.getMimeType(r.basename);switch(e){case sn.PYTHON:return hd;default:return dd}}function Ti(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:h,onDragOver:c,onDragEnd:v,onDragExit:p,onDrop:f}=r,g=(e=n==null?void 0:n.some(k=>k.id===s.id))!==null&&e!==void 0?e:!1,y=Pi(s),w=i&&u?Pi(u):null,T=i&&o&&gt(s)&&w===y,P=i&&o&&w===y,$=i&&!o&&w===y,X=Ob(s),re=M.getDepth(s.filename),Y=Array(re).fill(null).map((k,F)=>d.jsx("span",{className:"file-list-depth-line"},F));return d.jsxs("div",{className:q("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":T,"is-in-drop-target":P,"is-invalid-drop-target":$,"is-selected":a}),onDragStart:k=>h(l,k),onDragOver:k=>c(l,k),onDragEnd:k=>v(l,k),onDragExit:p,onDrop:k=>f(l,k),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:X,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function Fa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(n){xb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xb(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 He=U.module("FileList"),Nb=500,$a="item-list-scroll-pane";function Mb(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Ti,rowHeight:l=Vi,overscanCount:u=bt.DEFAULT_OVERSCAN}=r,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,p]=m.useState({top:0,bottom:0}),[f,g]=m.useState(),[y,w]=m.useState(),[T,P]=m.useState(),[$,X]=m.useState([]),re=m.useRef(),Y=m.useRef(null),k=m.useRef(null),F=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var Z=[],ae=0;ae<I.length;ae+=1)for(var ce=I[ae],$e=ce[0];$e<=ce[1];$e+=1)$e>=h.offset&&$e<h.offset+h.items.length&&Z.push(h.items[$e-h.offset]);return Z},[h]),ee=m.useCallback(I=>{var Z=F([[I,I]]);if(Z.length>0)return Z[0]},[F]),z=m.useCallback(()=>{var I=vt.count($);if(I===0)return null;if(I===1){var Z=$[0][0],ae=ee(Z);if(ae!=null)return ae.filename}return"".concat(I," items")},[ee,$]),j=m.useCallback(I=>{if(!(!y||!f)){He.debug("dropItems",y,"to",I);try{var{files:Z,targetPath:ae}=Ra(y,f);if(i==null||i(Z,ae),I!=null){var ce;X([[I,I]]),(ce=Y.current)===null||ce===void 0||ce.focusItem(I)}}catch($e){He.error("Unable to complete move",$e)}}},[y,f,i]),G=m.useCallback((I,Z)=>{var ae=h.items[I-h.offset];ae!==void 0&&(He.debug("handleItemClick",ae),o(ae,Z),gt(ae)&&(t==null||t.setExpanded(ae.filename,!ae.isExpanded)))},[h,o,t]),W=m.useCallback((I,Z)=>{var ae,ce;He.debug2("handleItemDragStart",I,$);var $e=$;vt.isSelected($,I)||($e=[[I,I]],X($e)),w(F($e)),(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=(ce=z())!==null&&ce!==void 0?ce:"",Ot.appendChild(Ct),Ot.className="file-list-dnd-placeholder",document.body.appendChild(Ot),Z.dataTransfer.setDragImage(Ot,0,0),Z.dataTransfer.effectAllowed="move",P(Ot)},[z,F,$]),A=m.useCallback((I,Z)=>{Z.preventDefault(),He.debug2("handleItemDragOver",Z),g(ee(I))},[ee]),B=m.useCallback((I,Z)=>{He.debug("handleItemDragEnd",I),T==null||T.remove(),w(void 0),g(void 0),P(void 0)},[T]),V=m.useCallback((I,Z)=>{j(I)},[j]),pe=m.useCallback(()=>{He.debug2("handleItemDragExit"),g(void 0)},[]),qe=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains($a)&&(I.preventDefault(),He.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),ke=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains($a)&&(He.debug("handleListDrop"),j())},[j]),b=m.useCallback(function(I){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(He.debug2("handleSelectionChange",I),Z===!0||I!==$){X(I);var ae=F(I);a(ae)}},[F,a,$]),S=m.useCallback(I=>{if(He.debug2("handleFocusChange",I),I!=null){var[Z]=F([[I,I]]);n(Z)}else n();re.current=I},[F,n]),_=m.useCallback((I,Z)=>{He.debug("handleViewportChange",I,Z),(I!==v.top||Z!==v.bottom)&&p({top:I,bottom:Z})},[v]),K=m.useMemo(()=>{if(!y||!f)return!1;try{return Ra(y,f),He.debug("handleValidateDropTarget true"),!0}catch{return He.debug("handleValidateDropTarget false"),!1}},[y,f]),{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 Z=t.onUpdate(ae=>{c({items:ae.items.map(ce=>Sr(Sr({},ce),{},{itemName:ce.basename})),offset:ae.offset,itemCount:t.size})});return()=>{Z()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),$.length>0&&b($,!0)},[h,S,b,$]),m.useEffect(function(){if(f!=null&&gt(f)&&f.filename!=="/"){var Z=setTimeout(()=>{f.isExpanded||t==null||t.setExpanded(f.filename,!0)},Nb);return()=>clearTimeout(Z)}},[f,t]);var at=m.useCallback(I=>s(Sr(Sr({},I),{},{isDragInProgress:y!=null,dropTargetItem:f,draggedItems:y,isDropTargetValid:K,onDragStart:W,onDragEnd:B,onDragOver:A,onDragExit:pe,onDrop:V})),[B,pe,A,W,V,y,f,K,s]);return d.jsx("div",{ref:k,className:q("file-list",{"is-dragging":y!=null}),onDragOver:qe,onDrop:ke,children:d.jsx(bt,{ref:Y,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:S,onSelect:G,onSelectionChange:b,onViewportChange:_,selectedRanges:$,renderItem:at,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var kb={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 Ha={FILE_EXPLORER:kb};var Ba=U.module("FileListItemEditor"),jb=()=>Promise.resolve();function Ab(r){var{item:e,onCancel:t,onSubmit:n,validate:i=jb}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[h,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var T;(T=o.current)===null||T===void 0||T.focus()},[o]),p=m.useCallback(T=>T.stopPropagation(),[]),f=m.useCallback(()=>{h.then(()=>{n(a)}).catch(T=>Ba.info("Unable to validate name",T))},[n,a,h]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>u(void 0)).catch($=>{Te.isCanceled($)||u($)}),c(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{Ba.debug2("handleBlur"),f()},[f]),y=m.useCallback(T=>{var{value:P}=T.target;s(P)},[]),w=m.useCallback(T=>{T.stopPropagation();var{key:P}=T;switch(P){case"Enter":{f();break}case"Escape":{t();break}}},[t,f]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:q("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:y,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Ua(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 ai(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ua(Object(t),!0).forEach(function(n){Lb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ua(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Lb(r,e,t){return(e=Rb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rb(r){var e=Fb(r,"string");return typeof e=="symbol"?e:e+""}function Fb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function lu(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:h,onSelectionChange:c,table:v,rowHeight:p=Vi,validateRename:f=()=>Promise.resolve()}=r,[g,y]=m.useState(),[w,T]=m.useState([]),[P,$]=m.useState(),X=m.useCallback(V=>{T(V),c==null||c(V)},[c]),re=m.useCallback(V=>{$(V)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),k=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),F=m.useCallback(()=>{i==null||i()},[i]),ee=m.useCallback(()=>{P&&(o==null||o(M.getPath(P.filename)))},[P,o]),z=m.useCallback(()=>{P&&y(P)},[P]),j=m.useCallback(()=>{y(void 0)},[]),G=m.useCallback(V=>{g&&(u==null||u(g,V),y(void 0))},[u,g]),W=m.useMemo(()=>{if(g)return[];var V=[];return i&&V.push({title:"New File",description:"Create new file",action:F,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:Ha.FILE_EXPLORER.DELETE,action:k,group:te.groups.low}),u&&V.push({title:"Rename",description:"Rename",shortcut:Ha.FILE_EXPLORER.RENAME,action:z,group:te.groups.low,disabled:P==null}),V},[Y,k,F,ee,z,P,a,i,o,s,u,w,g]),A=m.useCallback(V=>(L(g),f(g,V)),[g,f]),B=m.useCallback(V=>{var{item:pe}=V;return g&&g.filename===pe.filename?d.jsx(Ti,ai(ai({},V),{},{children:d.jsx(Ab,{item:pe,validate:A,onSubmit:G,onCancel:j})})):d.jsx(Ti,ai({},V))},[j,G,g,A]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(Mb,{onMove:l,onSelect:h,onSelectionChange:X,onFocusChange:re,renderItem:B,rowHeight:p,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(te,{actions:W})]})}lu.displayName="FileListContainer";function Wa(r,e,t){return(e=$b(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $b(r){var e=Hb(r,"string");return typeof e=="symbol"?e:e+""}function Hb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Vn{constructor(e){super("Name already exists"),Wa(this,"isExistingFile",!0),Wa(this,"info",void 0),this.info=e}}function Va(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 Ka(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Va(o,n,i,a,s,"next",l)}function s(l){Va(o,n,i,a,s,"throw",l)}a(void 0)})}}var St=U.module("FileExplorer");function Ki(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:h,rowHeight:c=Vi}=r,[v,p]=m.useState([]),[f,g]=m.useState();m.useEffect(function(){var G;function W(){return A.apply(this,arguments)}function A(){return A=Ka(function*(){St.debug("initTable"),G=Te.makeCancelable(e.getTable(),B=>B.close());try{g(yield G)}catch(B){Te.isCanceled(B)||St.error("Unable to initialize table",B)}}),A.apply(this,arguments)}return W(),()=>{G.cancel()}},[e]);var y=m.useCallback(j=>{Te.isCanceled(j)||St.error(j)},[]),w=m.useCallback(()=>{St.debug("handleCreateFile"),s()},[s]),T=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),p(j)},[]),X=m.useCallback(()=>{St.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(gt(j)?M.makePath(j.filename):j.filename)),o(v),p([])},[v,o,e]),re=m.useCallback(()=>{St.debug("handleDeleteCancel"),p([])},[]),Y=m.useCallback((j,G)=>{var W=M.reducePaths(j.map(A=>gt(A)?M.makePath(A.filename):A.filename));W.forEach(A=>{var B=M.isPath(A)?"".concat(G).concat(M.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(G).concat(M.getBaseName(A));e.moveFile(A,B).then(()=>{a(A,B)}).catch(y)})},[y,a,e]),k=m.useCallback((j,G)=>{var W=j.filename,A=gt(j);A&&!W.endsWith("/")&&(W="".concat(W,"/"));var B="".concat(M.getParent(W)).concat(G);A&&!B.endsWith("/")&&(B="".concat(B,"/")),St.debug2("handleRename",W,B),e.moveFile(W,B).catch(y),a(W,B)},[y,a,e]),F=m.useCallback(function(){var j=Ka(function*(G,W){if(W!==G.basename){M.validateName(W);var A="".concat(M.getPath(G.filename)).concat(W);try{var B=yield e.info(A);throw new Tr(B)}catch(V){if(!(V instanceof Wi))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:[f&&d.jsx(lu,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:T,onCreateFile:w,onMove:Y,onDelete:$,onRename:k,onSelect:u,onSelectionChange:h,rowHeight:c,table:f,validateRename:F}),d.jsx(qn,{isOpen:ee,headerText:z,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:X,confirmButtonText:"Delete"})]})}Ki.displayName="FileExplorer";function za(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 Bb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){za(o,n,i,a,s,"next",l)}function s(l){za(o,n,i,a,s,"throw",l)}a(void 0)})}}function ln(r,e,t){return(e=Ub(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ub(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)}var nn=U.module("NewItemModal");class cn extends m.PureComponent{static getValidationMessage(e){return e instanceof Tr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||nn.error(e)}constructor(e){super(e),ln(this,"inputRef",R.createRef()),ln(this,"cancelableValidatePromise",void 0),ln(this,"cancelableExistingItemPromise",void 0),ln(this,"pending",new Qn),ln(this,"pathMap",new Map),ln(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,n=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Te.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return Bb(function*(){M.validateName(t);var{defaultValue:o,storage:a}=i.props;if(n){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Tr(l)}catch(u){if(!(u instanceof Wi))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(cn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(nn.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,n=M.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof Vn))throw e;nn.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;nn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){nn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=M.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){nn.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;nn.debug("submitModal",n,i);var l=M.getExtension(i);return a&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(u=>{if(u instanceof Tr&&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(cn.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((n,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(n,"/"),d.jsxs(R.Fragment,{children:[d.jsx(ie,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:cd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:h,validationError:c,value:v,prevExtension:p,newExtension:f}=this.state,g=a==="directory",y=M.fileExtensionToString(p),w=M.fileExtensionToString(f),T=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(ls,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(us,{toggle:n,children:o}),d.jsx(ds,{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":c}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:cn.getValidationMessage(c)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(Ki,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Ls,{children:[d.jsx(ie,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(ie,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:T})]})]}),d.jsx(qn,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(qn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}ln(cn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function Vb(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(ie,{kind:"ghost",icon:Ss,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(ie,{kind:"ghost",icon:md,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(Vs,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Ga(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 Kb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ga(o,n,i,a,s,"next",l)}function s(l){Ga(o,n,i,a,s,"throw",l)}a(void 0)})}}function uu(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)}var rn=U.module("FileExplorerPanel"),qb=(r,e)=>{var t=Js(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}},Xb=Mn(qb,null,null,{forwardRef:!0});function Zb(r){var e=r;return e!=null&&typeof e.button=="number"}class Nn extends R.Component{static handleError(e){rn.error(e)}static isFocusEvent(e){return Zb(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:""};rn.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){rn.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){rn.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Nn.handleError)}handleCopyFile(e){var t=this;return Kb(function*(){var{fileStorage:n}=t.props;if(gt(e)){rn.error("Invalid item in handleCopyItem",e);return}var i=yield M.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(J.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(rn.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;rn.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(Vb,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Ki,{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(cn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}uu(Nn,"COMPONENT","FileExplorerPanel");uu(Nn,"TITLE","File Explorer");var Yb=Xb(Nn);function Yn(r,e,t){return(e=Qb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qb(r){var e=Jb(r,"string");return typeof e=="symbol"?e:e+""}function Jb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 qa=U.module("LogPanel");class Kr 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){qa.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){qa.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(Kr,"defaultProps",{session:null});Yn(Kr,"COMPONENT","LogPanel");Yn(Kr,"TITLE","Log");var ey=(r,e)=>{var t;return{session:(t=sr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},ty=Mn(ey,null,null,{forwardRef:!0})(Kr);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 wr(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)})}}function Za(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Qe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Za(Object(t),!0).forEach(function(n){Le(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Za(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Le(r,e,t){return(e=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=ry(r,"string");return typeof e=="symbol"?e:e+""}function ry(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 iy=m.lazy(()=>Es(()=>import("./MarkdownNotebook-Bw-fDcJ8.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=U.module("NotebookPanel"),Ya=400;class Oe extends m.Component{static handleError(e){Te.isCanceled(e)||ue.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Oe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Oe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Le(this,"pending",void 0),Le(this,"debouncedSavePanelState",void 0),Le(this,"debouncedLoad",void 0),Le(this,"notebook",void 0),Le(this,"tabTitleElement",void 0),Le(this,"tabInitOnce",void 0),Le(this,"editor",void 0),Le(this,"getSettings",Xt((v,p)=>Qe(Qe({},v),{},{minimap:{enabled:p}}))),Le(this,"getOverflowActions",Xt((v,p,f)=>{var g=[{title:"Find",icon:fd,action:this.handleFind,group:te.groups.high,shortcut:We.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:hs,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:gd,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:gs,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?_n:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:We.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?_n:void 0,action:this.handleWordWrapChange,group:te.groups.low,shortcut:We.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:te.groups.low,order:10}),g.push({title:"Format on Save",icon:f?_n: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=mn(this.savePanelState.bind(this),Ya),this.debouncedLoad=mn(this.load.bind(this),Ya),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var u=s!=null&&M.hasPath(s.itemName),h=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},ue.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(J.RENAME_FILE,this.handleRenameFile),t.on(oe.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(oe.DROPPED,this.handlePanelDropped),t.off(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(J.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);L(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){ue.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){ue.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(J.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:o}=i;n.emit(J.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(J.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;L(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(o=>{var a;ue.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:h}=u;this.renameTab(h,M.getBaseName(s))}var c=Qe(Qe({},t),{},{language:(a=Oe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){ue.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;ue.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:n,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,u=Qe(Qe({},a),{},{value:s}),h=Qe(Qe({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return ue.debug("Saving panel state",c),{settings:u,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(J.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return wr(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;L(o);var{language:s}=a,{itemName:l}=o,u=yield M.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var h={id:u,itemName:u},c={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return wr(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:o}=e.state;ue.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(M.hasPath(o.itemName)&&(yield M.fileExists(t,o.itemName))?(i.emit(J.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){ue.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:n-1,savedChangeCount:i}:!a&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};n(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings: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 wr(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&&M.hasPath(s.itemName)&&s.itemName!==i.itemName&&(ue.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(Oe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Te.isCanceled(e)||(this.setState({savedChangeCount:0}),ue.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),ue.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(o)!==M.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?me.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return wr(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(Me.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:n}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",n??!1)}render(){var e,t,n,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:h,error:c,isDashboardActive:v,isLoaded:p,isLoading:f,isPreview:g,fileMetadata:y,session:w,sessionLanguage:T,settings:P,showCloseModal:$,showDeleteModal:X,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,k=(e=y==null?void 0:y.itemName)!==null&&e!==void 0?e:Oe.DEFAULT_NAME,F=k.endsWith(".md"),ee=(y==null?void 0:y.id)!=null,z=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),j=w!=null,G=T===z.language,W=!p||!j||!G,A=!p,B=[{action:this.handleSave,shortcut:zt.SAVE},{action:this.handleMinimapChange,shortcut:We.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:We.NOTEBOOK.WORDWRAP}],V=gi.getDisabledRunTooltip(j,G,"Notebook extension","Run"),pe=gi.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}],ke=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[ke!=null&&Lr.createPortal(d.jsx("span",{className:q(Oe.UNSAVED_INDICATOR_CLASS_NAME,{[Oe.UNSAVED_STATUS_CLASS_NAME]:u!==h})}),ke),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:()=>k,children:[!F&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:W,icon:d.jsx(ve,{icon:Cs,transform:"grow-4"}),tooltip:"Run ".concat(We.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&d.jsx(he,{children:V})]}),d.jsxs("span",{children:[d.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:W,icon:d.jsx(ve,{icon:vd,transform:"grow-4"}),tooltip:"Run Selected ".concat(We.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(ie,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:pd,tooltip:"Save ".concat(zt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(ie,{kind:"ghost",className:"btn-overflow",disabled:A,icon:ys,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(tr,{actions:this.getDropdownOverflowActions,popperOptions:Oe.POPPER_OPTIONS})})]}),d.jsx(Cl,{isLoaded:p,isLoading:f,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:T,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:z,focusOnMount:Y,ref:b=>{this.notebook=b}})]}),F&&d.jsx(m.Suspense,{fallback:d.jsx(vn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(iy,{content:(n=z.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(cn,{isOpen:re,type:"file",defaultValue:k,title:ee?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(qn,{isOpen:X,headerText:'Are you sure you want to delete "'.concat(k,'"?'),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(k,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),d.jsx(te,{actions:B})]})]})}}Le(Oe,"COMPONENT","NotebookPanel");Le(Oe,"POPPER_OPTIONS",{placement:"bottom-end"});Le(Oe,"DEFAULT_NAME","Untitled");Le(Oe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Le(Oe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Le(Oe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var oy=(r,e)=>{var t=Js(r),n=tl(r),i=sr(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},on=Mn(oy,{updateNotebookSettings:zc},null,{forwardRef:!0})(Oe);function ay(){var{python:{linter:r={}}={}}=cg(tl),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function Qa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ja(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qa(Object(t),!0).forEach(function(n){sy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sy(r,e,t){return(e=ly(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ly(r){var e=uy(r,"string");return typeof e=="symbol"?e:e+""}function uy(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ge=U.module("ConsolePlugin");function es(r){return r.notebook!==void 0}function dy(r){Yf(r)}function d0(r){dy(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:o,notebooksUrl:a}=r,s=m.useRef(0),[l,u]=m.useState(new Map),[h,c]=m.useState(new Map);ay();var v=_i(),p=m.useCallback(()=>i.getLastUsedPanelOfType(oi),[i]),f=m.useCallback((b,S)=>{u(_=>new Map(_.set(b,S)))},[u]),g=m.useCallback(b=>{u(S=>(S.delete(b),new Map(S)))},[u]),y=m.useCallback((b,S)=>{c(_=>new Map(_.set(b,S)))},[c]),w=m.useCallback(b=>{c(S=>(S.delete(b),new Map(S)))},[c]),T=m.useCallback(function(b){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,K=b&&b.trim();if(!K)ge.info("Ignoring empty code");else{var ne=p();if(!ne||!(ne instanceof oi.WrappedComponent)){ge.error("Console panel not found");return}ge.debug("Send command: ",b,S,_),ne.addCommand(b,S,_)}},[p]),P=m.useCallback(b=>{v(sb(e,b))},[v,e]),$=m.useCallback(b=>{var{language:S}=b,_=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},[]),X=m.useCallback(function(b){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:_}=b;if(_!=null&&l.has(_))return l.get(_);if(_!=null&&h.has(_))return h.get(_);if(S)return Et()},[l,h]),re=m.useCallback((b,S)=>{x.renameComponent(n.root,{id:b},S)},[n.root]),Y=m.useCallback((b,S)=>{ge.debug("Rename file panel",b,S);var _;if(l.has(b)&&(_=l.get(b),g(b),_!=null&&f(S,_)),h.has(b)&&(_=h.get(b),w(b),_!=null&&y(S,_)),_===void 0){ge.debug2("File ".concat(b," isn't open, no need to rename the tab"));return}re(_,M.getBaseName(S))},[l,h,re,f,y,g,w]),k=m.useCallback(b=>{var S=X(b,!1);if(S==null){ge.error("Could not find panel id for file metadata",b);return}x.activateTab(n.root,{id:S})},[X,n.root]),F=m.useCallback((b,S,_)=>{if(ge.debug("registerFilePanel",b,S,_),S==null||S.id==null){ge.debug("Ignore empty file id",S);return}var{id:K}=S;if(_){y(K,b);return}if(l.has(K)){var ne=l.get(K);if(b===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}f(K,b),h.has(K)&&w(K)},[l,h,Y,f,y,w]),ee=m.useCallback((b,S)=>{if(ge.debug("unregisterFileTab",b,S),b==null||b.id==null){ge.debug("Ignore empty file id",b);return}var{id:_}=b;if(S){w(_);return}g(_)},[g,w]),z=m.useCallback((b,S)=>{ge.debug("closeFilePanel",b);var{id:_}=b;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(h.has(_))K=h.get(_),ne=!0;else{ge.debug("File ".concat(_," isn't open, ignore close event"));return}ee(b,ne),x.closeComponent(n.root,{id:K},S)},[n.root,l,h,ee]),j=m.useCallback(b=>{var{itemName:S}=b;return M.getBaseName(S)},[]),G=m.useCallback(b=>{var{id:S}=b;return ge.debug("fileIsOpen",b,S,l),S!=null&&l.has(S)},[l]),W=m.useCallback(b=>{var{id:S}=b;return ge.debug("fileIsOpenAsPreview",b,S,h),S!=null&&h.has(S)},[h]),A=m.useCallback(b=>{if(b!=null){var S=i.getOpenedPanelById(b);S&&es(S)&&S.focus()}},[i]),B=m.useCallback(b=>{var{id:S,settings:_,fileMetadata:K,session:ne,sessionLanguage:at,isPreview:I=!1}=b,Z={settings:_,fileMetadata:K},ae=j(K);return{type:"react-component",component:on.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ne,sessionLanguage:at,panelState:Z,isPreview:I,notebooksUrl:a},title:ae,id:S}},[j,e,a]),V=m.useCallback(function(b,S,_){var K=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:$(_)},ne=X(K);if(G(K)&&ne!=null){ge.debug("File is already open, focus panel"),k(K),A(ne);return}if(ne==null){ge.error("Panel ID for file metadata is null");return}var at=x.getStackForComponentTypes(n.root,[on.COMPONENT]),I=B({id:ne,settings:_,fileMetadata:K,session:b,sessionLanguage:S});ge.debug("createNotebook",I,l),x.openComponentInStack(at,I)},[G,A,$,X,n.root,B,l,k]),pe=m.useCallback(function(b,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),[Z]=[...h.values()],ae=!ne,ce=ae&&Z?Z:X(K);if(ce==null||ce==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(K)));if(at||I)k(K);else{var $e=x.getStackForComponentTypes(n.root,[on.COMPONENT]),Ot=B({id:ce,settings:_,fileMetadata:K,session:b,sessionLanguage:S,isPreview:ae});x.openComponentInStack($e,Ot)}if(I&&ne){var Ct=K.id,qr=x.getStackForConfig(n.root,{component:on.COMPONENT,id:ce}),An=x.getContentItemInStack(qr,{component:on.COMPONENT,id:ce});Ct!=null&&An&&et(An)&&(An.container.emit(J.PROMOTE_FROM_PREVIEW),w(Ct),f(Ct,ce))}ne&&A(ce)},[k,G,W,A,X,n.root,B,h,w,f]),qe=m.useCallback(function(b,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(on);ne&&es(ne)?_!=null&&_.value!=null&&ne.notebook!=null&&ne.notebook.append(_.value):K&&V(b,S,_)},[V,i]),ke=m.useCallback((b,S)=>og.hydrate(Ja(Ja({},b),{},{notebooksUrl:a}),S),[a]);return Fn(o,oi,t),Fn(o,hb),Fn(o,Yb),Fn(o,ty),Fn(o,on,ke),Ae(n.eventHub,Me.SEND_COMMAND,T),Ae(n.eventHub,Me.SETTINGS_CHANGED,P),Ae(n.eventHub,J.CLOSE_FILE,z),Ae(n.eventHub,J.CREATE_NOTEBOOK,V),Ae(n.eventHub,J.SELECT_NOTEBOOK,pe),Ae(n.eventHub,J.RENAME,re),Ae(n.eventHub,J.RENAME_FILE,Y),Ae(n.eventHub,J.SEND_TO_NOTEBOOK,qe),Ae(n.eventHub,J.REGISTER_FILE,F),Ae(n.eventHub,J.UNREGISTER_FILE,ee),null}function zr(r,e,t){return(e=hy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hy(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)}class Gr{}zr(Gr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");zr(Gr,"INPUT_FILTER","ControlType.INPUT_FILTER");zr(Gr,"MARKDOWN","ControlType.MARKDOWN");zr(Gr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{Iy as $,Uy as A,ie as B,$s as C,Ke as D,Wy as E,pl as F,js as G,As as H,Pt as I,Re as J,O as K,tl as L,zc as M,H as N,Xn as O,Te as P,zt as Q,Vm as R,zs as S,E as T,Vh as U,Gr as V,BC as W,tr as X,rl as Y,Fr as Z,el as _,pt as a,Ls as a$,sr as a0,XC as a1,Hc as a2,Fe as a3,mg as a4,Vy as a5,Kc as a6,en as a7,IC as a8,Xl as a9,Jy as aA,Xy as aB,Zy as aC,ZC as aD,YC as aE,Ky as aF,qy as aG,nl as aH,Gy as aI,me as aJ,Cy as aK,rh as aL,er as aM,uh as aN,ih as aO,ks as aP,Ms as aQ,oh as aR,ah as aS,vt as aT,bt as aU,dh as aV,Fs as aW,Vs as aX,cc as aY,$r as aZ,D as a_,Yy as aa,kC as ab,og as ac,Ed as ad,xs as ae,J as af,Tt as ag,pC as ah,gC as ai,yC as aj,SC as ak,oe as al,HC as am,jC as an,RC as ao,on as ap,Kf as aq,Mc as ar,Ps as as,Rr as at,d0 as au,te as av,qn as aw,s0 as ax,Qy as ay,zy as az,_t as b,dl as b$,Oh as b0,Oi as b1,wy as b2,mc as b3,xi as b4,Py as b5,Bs as b6,ch as b7,Gs as b8,Hs as b9,Tv as bA,sC as bB,lC as bC,Nv as bD,Mv as bE,dC as bF,uC as bG,ji as bH,hC as bI,Mp as bJ,_p as bK,kp as bL,qt as bM,il as bN,Ue as bO,Dr as bP,vp as bQ,Sl as bR,ol as bS,um as bT,ul as bU,Jc as bV,On as bW,al as bX,xn as bY,Jv as bZ,Or as b_,hh as ba,Wh as bb,_r as bc,Oc as bd,Zs as be,Xs as bf,qs as bg,Ty as bh,_y as bi,Oy as bj,dv as bk,hv as bl,we as bm,gv as bn,Dv as bo,Q as bp,Sv as bq,Ne as br,eC as bs,ml as bt,vl as bu,rC as bv,aC as bw,tC as bx,nC as by,iC as bz,C as c,cb as c$,Lp as c0,Se as c1,pi as c2,We as c3,Cl as c4,gi as c5,Ts as c6,x as c7,Fn as c8,vC as c9,Xf as cA,mC as cB,ug as cC,PC as cD,TC as cE,FC as cF,LC as cG,fC as cH,CC as cI,bC as cJ,wC as cK,NC as cL,$C as cM,Ae as cN,bg as cO,o0 as cP,Ui as cQ,a0 as cR,su as cS,l0 as cT,jn as cU,ru as cV,bb as cW,gb as cX,pb as cY,ou as cZ,mb as c_,xC as ca,Vg as cb,Ng as cc,Dg as cd,ii as ce,Zl as cf,DC as cg,EC as ch,Vl as ci,tg as cj,Hi as ck,$i as cl,zl as cm,gr as cn,Yf as co,Ul as cp,Mg as cq,AC as cr,_C as cs,OC as ct,ql as cu,Wl as cv,Zf as cw,zf as cx,qf as cy,Gf as cz,ze as d,r0 as d0,vb as d1,i0 as d2,fb as d3,iu as d4,ka as d5,yy as d6,eo as d7,Vf as d8,Br as d9,JC as dA,QC as dB,nu as dC,Me as dD,qC as dE,sb as dF,ay as dG,gy as dH,Sy as dI,by as dJ,Zr as dK,xd as dL,Xr as dM,oC as dN,Vn as dO,MC as da,M as db,Wi as dc,u0 as dd,oi as de,ty as df,hb as dg,Yb as dh,Ds as di,fy as dj,ar as dk,Ns as dl,Jt as dm,e0 as dn,KC as dp,zC as dq,tu as dr,VC as ds,GC as dt,Qn as du,UC as dv,n0 as dw,WC as dx,gt as dy,t0 as dz,$c as e,Hy as f,Dy as g,$y as h,Fy as i,Ry as j,Ly as k,Ay as l,xy as m,ky as n,My as o,Ny as p,Gc as q,Ce as r,de as s,he as t,Nc as u,Ee as v,By as w,jy as x,Ey as y,cg as z};
25
- //# sourceMappingURL=ControlType-lgZLQmfY.js.map
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(ie,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:nd,tooltip:"Clear log"}),d.jsx(ie,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:rd,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 wp="var(--dh-color-chart-colorway)",Ep="var(--dh-color-chart-grid)",Pp="var(--dh-color-chart-axis-line)",Tp="var(--dh-color-chart-axis-line-zero)",da={"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:wp,gridcolor:Ep,linecolor:Pp,zerolinecolor:Tp,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)"};var ha=U.module("ChartTheme");function _p(){var r,e=fs(da);return e.colorway=id((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return od.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),ha.debug2("Chart theme:",da),ha.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"]})}function ca(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Op(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(n){xp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xp(r,e,t){return(e=Ip(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ip(r){var e=Dp(r,"string");return typeof e=="symbol"?e:e+""}function Dp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Np=m.lazy(()=>Es(()=>import("./Plot-gzyKAEuz.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function Mp(r){return d.jsx(m.Suspense,{fallback:d.jsx(vn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(Np,Op({},r))})}var ji=m.createContext(null);ji.displayName="ChartThemeContext";function hC(r){var{children:e}=r,{activeThemes:t}=js(),n=m.useMemo(_p,[t]);return d.jsx(ji.Provider,{value:n,children:e})}function kp(){return er(ji,"No ChartThemeContext value found.")}function ma(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 jp(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ma(o,n,i,a,s,"next",l)}function s(l){ma(o,n,i,a,s,"throw",l)}a(void 0)})}}var Ap=U.module("HeapUsage");function Lp(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=kp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),p=Ms(),f=m.useCallback(jp(function*(){try{var A=yield t.getWorkerHeapInfo();if(!p.current)return;if(u(A),o||h){for(var B=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:pe,usages:qe}=v.current;pe.length!==0&&V-pe[0]>a*1.5;)pe.shift(),qe.shift();pe.push(V),qe.push(B)}else v.current={timestamps:[],usages:[]}}catch(ke){Ap.warn("Unable to get heap usage",ke)}}),[t,p,o,h,a]);rh(f,h?i:n);var g=(A,B)=>Math.round(A*10**B)/10**B,y=2,w=1024**3,{freeMemory:T,totalHeapSize:P,maximumHeapSize:$}=l,X=g(T/w,y),re=g(P/w,y),Y=g($/w,y),k=re-X,F=function(B,V){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:q("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:B}),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-T)/$;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-T)/$>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[F("In use:","".concat(k.toFixed(y)," of ").concat(Y.toFixed(y)," GB"),!0),F("Free:","".concat(X.toFixed(y)," GB")),F("Total:","".concat(re.toFixed(y)," GB")),F("Max:","".concat(Y.toFixed(y)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Mp,{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 wl=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 El(r){return r.componentName!==void 0}function Rp(r){return r.component!==void 0}var Pl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Fp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:wl,isGLComponentConfig:El,isReactComponentConfig:Rp,itemDefaultConfig:Pl},Symbol.toStringTag,{value:"Module"}));function Pr(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=Hp(r,"string");return typeof e=="symbol"?e:e+""}function Hp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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(){Pr(this,"_mSubscriptions",void 0),Pr(this,"off",this.unbind),Pr(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(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Ge.ALL_EVENT],u=0;u<l.length;u++){var h=l[u].ctx||{};try{l[u].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,n){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Pr(Ge,"ALL_EVENT","__all");function mt(r,e,t){return(e=Bp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bp(r){var e=Up(r,"string");return typeof e=="symbol"?e:e+""}function Up(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 bi 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=El(e)?e.componentName:"",this.parent=t,this.layoutManager=n,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var n,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",h=u==="height"?t:e,c=((n=this[u])!==null&&n!==void 0?n:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=h/c*100,p=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),f=0;f<a.contentItems.length;f++)if(a.contentItems[f]===s)a.contentItems[f].config[u]=v;else{var g;a.contentItems[f].config[u]=((g=a.contentItems[f].config[u])!==null&&g!==void 0?g:0)+p}return a.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(N.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Wp=Object.freeze(Object.defineProperty({__proto__:null,Container:bi,ItemContainer:bi},Symbol.toStringTag,{value:"Module"}));function Tl(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function _l(r){if(window.location.hash)return Tl(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 Ai(r){return window.requestAnimationFrame(r)}function Vp(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 Nr(){return Et()}function Kp(r,e){var t=r.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function Li(r){return N.trim(r.replace(/(<([^>]+)>)/gi,""))}function Ze(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 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 Cn(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 Ol{constructor(e,t){Cn(this,"_container",void 0),Cn(this,"_reactComponent",null),Cn(this,"_portalComponent",null),Cn(this,"_originalComponentWillUpdate",null),Cn(this,"_initialState",void 0),Cn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Lr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=N.extend(e,this._container._config.props);return R.createElement(this._reactClass,t)}}var Mr=["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"],Zp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ri(r){if(Mr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fi(r,e,"_min"),e}function yi(r){if(Mr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fi(r,e,"_max"),e}function Fi(r,e,t){var n=t==="_min"?Yp:Qp;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,Mr);e[s]=a}Fi(o,a,t)}else{var l=n(o,Zp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=n(i,Mr);e[u]=l}}}}function Yp(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function Qp(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function ni(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=ef(r,"string");return typeof e=="symbol"?e:e+""}function ef(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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{constructor(e,t){ni(this,"name",void 0),ni(this,"origin",void 0),ni(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function cr(r,e,t){return(e=tf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tf(r){var e=nf(r,"string");return typeof e=="symbol"?e:e+""}function nf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 xl=class extends Ge{constructor(e){super(),cr(this,"_layoutManager",void 0),cr(this,"_dontPropagateToParent",void 0),cr(this,"_childEventSource",void 0),cr(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 Il(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function Dl(r){return(e,t)=>Il(e,r,t)}function Nl(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 Ml(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:Dl(r),emit:Nl(r),useListener:Ml(r)}}const rf=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Ci,DragListener:nr,EventEmitter:Ge,EventHub:xl,ReactComponentHandler:Ol,animFrame:Ai,filterXss:Kp,getHashValue:Tl,getQueryStringParam:_l,getUniqueId:Nr,listenForEvent:Il,makeEmitFunction:Nl,makeEventFunctions:Jt,makeListenFunction:Dl,makeUseListenerFunction:Ml,minifyConfig:Ri,removeFromArray:Vp,stripTags:Li,unminifyConfig:yi},Symbol.toStringTag,{value:"Module"}));function $t(r,e,t){return(e=of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function of(r){var e=af(r,"string");return typeof e=="symbol"?e:e+""}function af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class kl 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,h,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(n=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&n!==void 0?n:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,n=null;if(this._parentId){var i;if(t=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-"+Nr();e=Ri(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=sf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sf(r){var e=lf(r,"string");return typeof e=="symbol"?e:e+""}function lf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class bn extends Ge{constructor(e,t,n,i,o,a){var s,l,u,h,c,v,p,f;if(super(),_e(this,"_dragListener",void 0),_e(this,"_layoutManager",void 0),_e(this,"_contentItem",void 0),_e(this,"_originalParent",void 0),_e(this,"_area",null),_e(this,"_lastValidArea",null),_e(this,"_minX",void 0),_e(this,"_maxX",void 0),_e(this,"_minY",void 0),_e(this,"_maxY",void 0),_e(this,"_width",void 0),_e(this,"_height",void 0),_e(this,"_sided",void 0),_e(this,"element",void 0),_e(this,"childElementContainer",void 0),_e(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=N(bn._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",Li((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,T;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(h=P==null?void 0:P.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(f=this.element.height())!==null&&f!==void 0?f:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,o,a=(i=n.pageX)!==null&&i!==void 0?i:0,s=(o=n.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}_e(bn,"_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 mr(r,e,t){return(e=uf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uf(r){var e=df(r,"string");return typeof e=="symbol"?e:e+""}function df(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 jl{constructor(e,t,n){mr(this,"_element",void 0),mr(this,"_itemConfig",void 0),mr(this,"_layoutManager",void 0),mr(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 bn(e,t,this._dragListener,this._layoutManager,i,null)}}function vr(r,e,t){return(e=hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hf(r){var e=cf(r,"string");return typeof e=="symbol"?e:e+""}function cf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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,n){vr(this,"_element",N(window)),vr(this,"_itemConfig",void 0),vr(this,"_layoutManager",void 0),vr(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 bn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Ll(r,e,t){return(e=mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mf(r){var e=vf(r,"string");return typeof e=="symbol"?e:e+""}function vf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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(){Ll(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()}}Ll(rr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ri(r,e,t){return(e=pf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pf(r){var e=ff(r,"string");return typeof e=="symbol"?e:e+""}function ff(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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){ri(this,"element",void 0),ri(this,"_header",void 0),ri(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 gf(r,e,t){return(e=bf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bf(r){var e=yf(r,"string");return typeof e=="symbol"?e:e+""}function yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class un extends Error{constructor(e,t){super(),gf(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Cf=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:un},Symbol.toStringTag,{value:"Module"}));function Pe(r,e,t){return(e=Sf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Sf(r){var e=wf(r,"string");return typeof e=="symbol"?e:e+""}function wf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 dn(r){return r.isStack}function et(r){return r.isComponent}function Rl(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,dn(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],n=function(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),n(o.contentItems[a])};return n(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&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 Ci(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new un("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(Pl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof Ci&&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,Ai(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Ln(r,e,t){return(e=Ef(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ef(r){var e=Pf(r,"string");return typeof e=="symbol"?e:e+""}function Pf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Fl 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()),Ln(this,"config",void 0),Ln(this,"componentName",void 0),Ln(this,"container",void 0),Ln(this,"parent",void 0),Ln(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 un('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 bi(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=Tf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tf(r){var e=_f(r,"string");return typeof e=="symbol"?e:e+""}function _f(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,n),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(De.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var u,h,c=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[n];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[n]=((u=this.contentItems[l].config[n])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=u.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var p=0;p<n.length;p++){l=n[p];var f=Math.round((l.width-t)*v);a-=f,l.width-=f}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new $l(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,n=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((n=a.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_onSplitterDrag(e,t,n){var i=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,n,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),c=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Ai(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function va(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 pa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(n){Si(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Si(r,e,t){return(e=Of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Of(r){var e=xf(r,"string");return typeof e=="symbol"?e:e+""}function xf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 extends De{constructor(e,t,n){super(e,pa(pa({},t),{},{type:"root"}),null,N('<div class="lm_goldenlayout lm_item lm_root"></div>')),Si(this,"childElementContainer",void 0),Si(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 h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}function fa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(n){tt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tt(r,e,t){return(e=If(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function If(r){var e=Df(r,"string");return typeof e=="symbol"?e:e+""}function Df(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Ei extends De{constructor(e,t,n){var i,o,a,s,l,u,h,c,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 p=e.config;this._side=!1,this._header={show:((i=p.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=p.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=p.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=p.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=p.settings)!==null&&u!==void 0&&u.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(v=p.labels)===null||v===void 0?void 0:v.minimise)!==null&&c!==void 0?c:void 0},p.header&&(this._header=Sn(Sn({},this._header),p.header)),t.header&&(this._header=Sn(Sn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Sn(Sn({},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,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c,v=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,i,o,a,s,l,u,h,c,v,p,f,g,y,w,T=this.header.tabs.length;if(T===0){var P,$,X,re,Y,k,F,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:((X=z==null?void 0:z.left)!==null&&X!==void 0?X:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((k=(F=this.header.element.offset())===null||F===void 0?void 0:F.top)!==null&&k!==void 0?k: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,B;if(!(W.left<e&&e<W.right)){for(var V=0;V<T;V++){var pe;if(A=this.header.tabs[V].element,B=(pe=A.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),B&&B.left<e&&e<B.right){this._dropIndex=V;break}}if(A&&B&&e<B.left+B.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var qe;this._dropIndex=Math.min(((qe=this._dropIndex)!==null&&qe!==void 0?qe:0)+1,T),A.after(this.layoutManager.tabDropPlaceholder)}}var ke=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;ke=Math.max(ke,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var b=ke+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);b=Math.min(b,((u=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&u!==void 0?u:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:ke,x2:b,y1:(p=(f=this.header.element.offset())===null||f===void 0?void 0:f.top)!==null&&p!==void 0?p:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.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 Nf=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:De,Component:Fl,ContentItem:De,Root:wi,RowOrColumn:Zn,Stack:Ei,isComponent:et,isRoot:Rl,isStack:dn},Symbol.toStringTag,{value:"Module"}));function Nt(r,e,t){return(e=Mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mf(r){var e=kf(r,"string");return typeof e=="symbol"?e:e+""}function kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ir{constructor(e,t){var n;Nt(this,"header",void 0),Nt(this,"contentItem",void 0),Nt(this,"element",N(ir._template)),Nt(this,"titleElement",void 0),Nt(this,"closeElement",void 0),Nt(this,"isActive",!1),Nt(this,"_layoutManager",void 0),Nt(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)}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 bn(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()}}Nt(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=jf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jf(r){var e=Af(r,"string");return typeof e=="symbol"?e:e+""}function Af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class 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,h;l.scrollLeft=(u=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,v,p=o||h,f=h-p,g=this.START_SPEED*f+.5*this.ACCELERATION*(f*f);g=Math.min(g,(c=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,p)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),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 h=(s+l+u.length)%u.length;h!==s;){if(u.eq(h).css("display")!=="none")return h;h=(h+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),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(),h=o<s-u.bottom,c=!h&&u.bottom>s*.6,v=Math.min(u.left+(c?u.width:0),l-a.width-this.PADDING),p=c?Math.max(u.top-o,this.PADDING):u.bottom,f=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":f,top:p,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}se(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 Rn(r,e,t){return(e=Lf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lf(r){var e=Rf(r,"string");return typeof e=="symbol"?e:e+""}function Rf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $l{constructor(e,t,n){Rn(this,"_isVertical",void 0),Rn(this,"_size",void 0),Rn(this,"_grabSize",void 0),Rn(this,"_dragListener",void 0),Rn(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 Ff=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:kl,DragProxy:bn,DragSource:jl,DragSourceFromEvent:Al,DropTargetIndicator:rr,Header:jt,HeaderButton:Un,Splitter:$l,Tab:ir},Symbol.toStringTag,{value:"Module"}));var $f={config:Fp,container:Wp,controls:Ff,errors:Cf,items:Nf,utils:rf};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 Ye(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){le(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 le(r,e,t){return(e=Hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hf(r){var e=Bf(r,"string");return typeof e=="symbol"?e:e+""}function Bf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 ba=["column","row","stack","component"];class Br extends Ge{static isLayoutItemConfig(e){return ba.includes(e.type)}static minifyConfig(e){return Ri(e)}static unminifyConfig(e){return yi(e)}constructor(e,t){super(),le(this,"isInitialised",!1),le(this,"_isFullPage",!1),le(this,"_resizeTimeoutId",void 0),le(this,"_components",{"lm-react-component":Ol}),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 xl(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 un("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Br.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+ba.join(","),new un(i);return e.type==="component"&&!(t instanceof Ei)&&t&&!(this.isSubWindow===!0&&t instanceof wi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Nr(),e.type==="stack"?new Ei(this,e,t):e.type==="row"?new Zn(!1,this,e,t):e.type==="column"?new Zn(!0,this,e,t):new Fl(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=Nr();for(var u=e.parent,h=e;((c=u)===null||c===void 0?void 0:c.contentItems.length)===1&&!u.isRoot;){var c;h=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var p,f,g,y=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,T=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:y+T.left,top:w+T.top,width:(f=e.element.width())!==null&&f!==void 0?f:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!n||i===void 0)){var P=new kl(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 jl(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Al(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(dn(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=_l("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=yi(e),localStorage.removeItem(n)),e=N.extend(!0,{},wl,e);var i=function(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?i(l):s==="type"&&l==="react-component"&&(a.type="component",a.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=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=Li((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 un(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new un(t,e);this.root=new wi(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=>{dn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}le(Br,"__lm",$f);const ya={"tab-height":"28px","drag-border-width":"5px"},Ca=Object.freeze({tabHeight:parseInt(ya["tab-height"],10),dragBorderWidth:parseInt(ya["drag-border-width"],10)});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 Dt(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){Hl(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 Hl(r,e,t){return(e=Uf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uf(r){var e=Wf(r,"string");return typeof e=="symbol"?e:e+""}function Wf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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=U.module("LayoutUtils");function Bl(r){return r.componentName!==void 0}function Kt(r){var e=r;return(Bl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function pr(r){return r.focus!==void 0}function wa(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(Rl(e)){var n={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(n);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(n);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,h,c=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(h=s.config)===null||h===void 0?void 0:h.width},e);e.replaceChild(s,c),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(n=>n.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=x.getAllStackContainers(e),n=x.getFocusedStackIndex(t);return t[n]}static getStackById(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&dn(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(dn(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&&dn(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&&qi(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&&qi(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?(wa(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);wa(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,h=Dt({},t);if(h.id==null&&(h.id=Et()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};L(e);var v=n??(a?x.addStack(e):x.getStackForRoot(e,c));L(v);var p=x.getContentItemInStack(v,c);if(s!=null){var f=y=>{Ht.debug("Component created, focusing element",s),v.off("componentCreated",f);var{element:w}=y.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",f)}if(i&&p){var g=v.contentItems.indexOf(p);v.addChild(h,g+1),v.removeChild(p),v.setActiveContentItem(v.contentItems[g])}else v.addChild(h);s==null&&u&&pr(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&&pr(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)&&pr(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(Bl(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:Ca.tabHeight,borderWidth:Ca.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:(pr(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)})}}Hl(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Vf=R.forwardRef((r,e)=>{var t=x.getComponentNameFromPanel({props:r});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Vf.displayName="PanelPlaceholder";var oe=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:mC,emit:Kf,useListener:vC}=Jt(oe.OPEN),Ur=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:zf,emit:pC,useListener:fC}=Jt(Ur.CYCLE_TO_NEXT_STACK),{listen:Gf,emit:gC,useListener:bC}=Jt(Ur.CYCLE_TO_PREVIOUS_STACK),{listen:qf,emit:yC,useListener:CC}=Jt(Ur.CYCLE_TO_NEXT_TAB),{listen:Xf,emit:SC,useListener:wC}=Jt(Ur.CYCLE_TO_PREVIOUS_TAB);function Zf(r){return typeof r.id=="string"&&r.layout instanceof Br&&r.panelManager instanceof $i&&typeof r.registerComponent=="function"}function Yf(r){if(!Zf(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function Ea(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Pa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(n){kt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kt(r,e,t){return(e=Qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qf(r){var e=Jf(r,"string");return typeof e=="symbol"?e:e+""}function Jf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var dt=U.module("PanelManager"),an=function(r){return r[r.Next=0]="Next",r[r.Previous=1]="Previous",r}(an||{});class $i{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]:()=>{};kt(this,"layout",void 0),kt(this,"hydrateComponent",void 0),kt(this,"dehydrateComponent",void 0),kt(this,"onPanelsUpdated",void 0),kt(this,"closed",void 0),kt(this,"openedMap",void 0),kt(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(oe.FOCUS,this.handleFocus),e.on(oe.MOUNT,this.handleMount),e.on(oe.UNMOUNT,this.handleUnmount),e.on(oe.REOPEN,this.handleReopen),e.on(oe.REOPEN_LAST,this.handleReopenLast),e.on(oe.DELETE,this.handleDeleted),e.on(oe.CLOSED,this.handleClosed),e.on(oe.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(zf(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Gf(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(qf(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Xf(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(oe.FOCUS,this.handleFocus),e.off(oe.MOUNT,this.handleMount),e.off(oe.UNMOUNT,this.handleUnmount),e.off(oe.REOPEN,this.handleReopen),e.off(oe.REOPEN_LAST,this.handleReopenLast),e.off(oe.DELETE,this.handleDeleted),e.off(oe.CLOSED,this.handleClosed),e.off(oe.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=>_r(n)&&t instanceof n.WrappedComponent||!_r(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===an.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,h=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(h,!0)}}handleCycleToNextStack(){this.cycleStack(an.Next)}handleCycleToPreviousStack(){this.cycleStack(an.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===an.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(an.Next)}handleCycleToPreviousTab(){this.cycleTab(an.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=Pa(Pa({},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)})}}kt($i,"MAX_CLOSED_PANEL_COUNT",100);var eg=U.module("PanelErrorBoundary");class tg 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);eg.debug("componentWillUnmount",n),t.emit(oe.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(vn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Ta(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function kr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(n){ng(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ng(r,e,t){return(e=rg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rg(r){var e=ig(r,"string");return typeof e=="symbol"?e:e+""}function ig(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ul(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),kr(kr({},r),{},{componentState:null,props:o,type:"react-component"})}function Wl(r,e){return kr(kr({},r),{},{localDashboardId:e})}const og={dehydrate:Ul,hydrate:Wl};var Vl=R.createContext(void 0);Vl.displayName="LayoutManagerContext";var ag=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}),Kl=be.shape({on:be.func,off:be.func,emit:be.func}),sg=be.shape({registerComponent:be.func,root:be.shape({addChild:be.func}),on:be.func,off:be.func,eventHub:Kl}),EC=Object.freeze({Container:ag,EventHub:Kl,Layout:sg});function Fn(r,e,t,n){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");R.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Ae(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var zl="SET_DASHBOARD_DATA";const lg=Yc(zl,{},!1),ug={dashboardData:lg};var dg=new Map,Gl=Object.freeze({}),hg=Object.freeze([]),PC=_i,cg=is,TC=Su,mg=r=>r.dashboardData,Fe=(r,e)=>{var t;return(t=mg(r)[e])!==null&&t!==void 0?t:Gl},_C=(r,e)=>{var t;return(t=Fe(r,e).closed)!==null&&t!==void 0?t:hg},OC=(r,e)=>{var t;return(t=Fe(r,e).openedMap)!==null&&t!==void 0?t:dg},ql=(r,e)=>{var t;return(t=Fe(r,e).pluginDataMap)!==null&&t!==void 0?t:Gl},xC=(r,e,t)=>ql(r,e)[t];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 Tn(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){vg(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 vg(r,e,t){return(e=pg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pg(r){var e=fg(r,"string");return typeof e=="symbol"?e:e+""}function fg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Xl=(r,e)=>({type:zl,id:r,payload:e}),en=(r,e)=>(t,n)=>t(Xl(r,Tn(Tn({},Fe(n(),r)),e))),IC=(r,e,t)=>(n,i)=>n(Xl(r,Tn(Tn({},Fe(i(),r)),{},{pluginDataMap:Tn(Tn({},ql(i(),r)),{},{[e]:t})})));Object.entries(ug).map(r=>{var[e,t]=r;return ad.register(e,t)});function gg(r){var{children:e}=r;return d.jsx(d.Fragment,{children:e})}var Hi=m.createContext(null);Hi.displayName="PanelIdContext";function bg(){return m.useContext(Hi)}function Oa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $n(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(n){yg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yg(r,e,t){return(e=Cg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cg(r){var e=Sg(r,"string");return typeof e=="symbol"?e:e+""}function Sg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fr=U.module("DashboardLayout"),wg=Object.freeze({}),Eg=[],xa=()=>{},Pg=1e3,Ia=r=>r;function DC(r){var e,t,{id:n,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=Eg,onLayoutChange:l=xa,onLayoutInitialized:u=xa,hydrate:h=Wl,dehydrate:c=Ul,panelWrapper:v=gg}=r,p=_i(),f=(e=is(b=>Fe(b,n)))!==null&&e!==void 0?e:wg,[g,y]=m.useState(!1),[w,T]=m.useState(!1),[P,$]=m.useState(),[X]=m.useState((t=f==null?void 0:f.closed)!==null&&t!==void 0?t:[]),[re,Y]=m.useState(a.getReactChildren()),k=m.useMemo(()=>new Map,[]),F=m.useMemo(()=>new Map,[]),ee=m.useCallback(function(b,S){var _,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;fr.debug2("registerComponent",b,S,K,ne);function at(Z,ae){var ce=S,$e=v,Ot=Bs(ce),{glContainer:Ct,glEventHub:qr}=Z,An=x.getIdFromContainer(Ct);return d.jsx(tg,{glContainer:Ct,glEventHub:qr,children:d.jsx(Hi.Provider,{value:An,children:d.jsx($e,$n($n({},Z),{},{children:Ot?d.jsx(ce,$n($n({},Z),{},{ref:ae})):d.jsx(ce,$n({},Z))}))})})}at.displayName="DashboardWrapper(".concat((_=S.displayName)!==null&&_!==void 0?_:b,")");var I=a.registerComponent(b,R.forwardRef(at));return k.set(b,K),F.set(b,ne),I},[h,c,k,F,a,v]),z=m.useCallback((b,S)=>{var _;return((_=k.get(b))!==null&&_!==void 0?_:Ia)(S,n)},[k,n]),j=m.useCallback((b,S)=>{var _;return((_=F.get(b))!==null&&_!==void 0?_:Ia)(S,n)},[F,n]),G=m.useMemo(()=>new $i(a,z,j,new Map,X,b=>{var{closed:S,openedMap:_}=b;p(en(n,{closed:S,openedMap:_}))}),[j,p,z,n,X,a]),W=ah(b=>{var S=P==null||!x.isEqual(P,b);fr.debug("handleLayoutStateChanged",S,b),S&&(y(a.root.contentItems.length===0),$(b),l(b),Y(a.getReactChildren()))},Pg,{flushOnUnmount:!0});m.useEffect(()=>()=>W.flush(),[W]);var A=m.useCallback(()=>{if(!w){var b=a.toConfig(),S=b.content,_=x.dehydrateLayoutConfig(S,j);W(_)}},[j,w,a,W]),B=m.useCallback(b=>{var S=x.getIdFromContainer(b);a.eventHub.emit(oe.DRAGGING,S),T(!0)},[a.eventHub]),V=m.useCallback(b=>{var S=x.getIdFromContainer(b);a.eventHub.emit(oe.DROPPED,S),T(!1)},[a.eventHub]),pe=m.useCallback(b=>{if(fr.debug2("handleComponentCreated",b),!(b==null||b.config==null||!Kt(b.config)||b.config.component==null||b.element==null)){var S=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),_="".concat(S,"-component");b.element.addClass(_)}},[]),qe=m.useCallback(()=>{Y(a.getReactChildren())},[a]);Ae(a,"stateChanged",A),Ae(a,"itemPickedUp",B),Ae(a,"itemDropped",V),Ae(a,"componentCreated",pe),Ae(a.eventHub,oe.TITLE_CHANGED,A),Ae(a,"reactChildrenChanged",qe);var ke=oh(s);return m.useEffect(function(){if(ke!==s&&s!==P){fr.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[_]);y(a.root.contentItems.length===0)}},[z,a,s,P,G,ke]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,re,R.Children.map(i,b=>b!=null?d.jsx(cc,{fallback:[],children:R.cloneElement(b,{id:n,layout:a,panelManager:G,registerComponent:ee})}):null)]})}var Zl=m.createContext(null);Zl.displayName="DashboardIdContext";function NC(){var r=m.useContext(Zl);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function Tg(r,e,t){return(e=_g(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _g(r){var e=Og(r,"string");return typeof e=="symbol"?e:e+""}function Og(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Yl(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=Yl(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 Bi=xg(m.createContext(null));Bi.displayName="FiberContext";class MC extends m.Component{constructor(){super(...arguments),Tg(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Bi.Provider,{value:this._reactInternals,children:e})}}function Ig(){var r=m.useContext(Bi);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=Yl(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 kC="default",Dg="CREATE_DASHBOARD",Ng="CLOSE_DASHBOARD",{listen:jC,emit:AC,useListener:LC}=Jt(Dg),{listen:RC,emit:Mg,useListener:FC}=Jt(Ng);function kg(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)}class Ql 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(oe.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})}}kg(Ql,"defaultProps",{additionalActions:[]});var Lg=r=>({workspace:el(r)}),Rg=Mn(Lg,{setWorkspace:nl})(Ql);function Jl(r,e,t){return(e=Fg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fg(r){var e=$g(r,"string");return typeof e=="symbol"?e:e+""}function $g(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 eu extends m.PureComponent{constructor(e){super(e),Jl(this,"renameInputRef",void 0),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=R.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:o}=this.state;return d.jsxs("form",{className: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(ie,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(ie,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Rr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Jl(eu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var gr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Da(r,e,t){return(e=Hg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hg(r){var e=Bg(r,"string");return typeof e=="symbol"?e:e+""}function Bg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ug=U.module("Panel");class Wg extends m.PureComponent{constructor(e){super(e),Da(this,"ref",void 0),Da(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=R.createRef();var{glContainer:t}=this.props;this.state={title:x.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,{componentPanel:t,glContainer:n,glEventHub:i}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),i.on(gr.focus,this.handleTabFocus),i.on(gr.blur,this.handleTabBlur),i.emit(oe.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(gr.focus,this.handleTabFocus),n.off(gr.blur,this.handleTabBlur),n.emit(oe.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(oe.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){Ug.error("Could not get component config from container",e);return}var o=x.cloneComponent(n,i);o!==null&&t.emit(oe.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=Ps,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:v}=i,{showRenameDialog:p,title:f,isWithinPanel:g}=this.state;return d.jsxs("div",{className:q("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(vn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Lr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Rg,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,h,c)}),c&&d.jsx(eu,{isShown:p,value:f,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var Vg=Gs(Wg),Kg=U.module("useDhId"),ii="__dhId";function $C(){var r,e,t=(r=(e=Ig())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[ii],i=bg();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(ii," to be a string, but got ").concat(typeof n));return n}return i??(Kg.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ii," prop. Defaulting to null.")),null)}function or(r,e,t){return(e=zg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zg(r){var e=Gg(r,"string");return typeof e=="symbol"?e:e+""}function Gg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Me{}or(Me,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");or(Me,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");or(Me,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");or(Me,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");or(Me,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function tn(r,e,t){return(e=qg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qg(r){var e=Xg(r,"string");return typeof e=="symbol"?e:e+""}function Xg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 HC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Lt(r,e,t){return(e=Zg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zg(r){var e=Yg(r,"string");return typeof e=="symbol"?e:e+""}function Yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}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 Qg=["children"];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 Ma(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){Jg(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 Jg(r,e,t){return(e=eb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eb(r){var e=tb(r,"string");return typeof e=="symbol"?e:e+""}function tb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function nb(r,e){if(r==null)return{};var t,n,i=rb(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 rb(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 ib extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(Me.SESSION_CLOSED,this.handleSessionClosed),e.on(Me.SESSION_OPENED,this.handleSessionOpened),e.on(Tt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.SESSION_CLOSED,this.handleSessionClosed),e.off(Me.SESSION_OPENED,this.handleSessionOpened),e.off(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=nb(e,Qg);return d.jsx(Vg,Ma(Ma({},n),{},{children:t}))}}var ar=Gs(ib);const BC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var ob=Object.freeze({}),ab=new Map,Wr=Object.freeze([]),UC=(r,e)=>{var t;return(t=Fe(r,e).columns)!==null&&t!==void 0?t:Wr},WC=(r,e)=>{var t;return(t=Fe(r,e).filterSets)!==null&&t!==void 0?t:Wr},VC=(r,e)=>{var t;return(t=Fe(r,e).filters)!==null&&t!==void 0?t:Wr},KC=(r,e)=>{var t;return(t=Fe(r,e).tableMap)!==null&&t!==void 0?t:ab},zC=(r,e)=>Fe(r,e).isolatedLinkerPanelId,tu=(r,e)=>{var t;return(t=Fe(r,e).links)!==null&&t!==void 0?t:Wr},GC=(r,e)=>Fe(r,e).columnSelectionValidator,qC=(r,e)=>{var t;return(t=Fe(r,e).consoleSettings)!==null&&t!==void 0?t:ob},XC=(r,e)=>Fe(r,e).connection,sr=(r,e)=>Fe(r,e).sessionWrapper,ZC=(r,e)=>t=>t(en(r,{connection:e})),YC=(r,e)=>t=>t(en(r,{sessionWrapper:e})),nu=(r,e)=>t=>t(en(r,{links:e})),QC=(r,e)=>(t,n)=>{var i=tu(n(),r),o=e.filter(a=>i.findIndex(s=>Gn(s.start,a.start)&&Gn(s.end,a.end))<0);return t(nu(r,i.concat(o)))},JC=(r,e)=>(t,n)=>{var i=tu(n(),r),o=i.filter(a=>!e.includes(a.id));return t(nu(r,o))},e0=(r,e)=>t=>t(en(r,{isolatedLinkerPanelId:e})),t0=(r,e)=>t=>t(en(r,{columnSelectionValidator:e})),sb=(r,e)=>t=>t(en(r,{consoleSettings:e})),n0=(r,e)=>t=>t(en(r,{filterSets:e}));function jr(r,e,t){return(e=lb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lb(r){var e=ub(r,"string");return typeof e=="symbol"?e:e+""}function ub(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 br=U.module("CommandHistoryPanel");class lr extends m.Component{static handleError(e){br.error(e)}constructor(e){super(e),jr(this,"container",void 0),jr(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=R.createRef(),this.pending=new 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(Me.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Me.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:n,language:i}=this.state;if(br.debug("handleSendToNotebook",n,e),!n){br.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;br.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Me.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;L(t),L(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(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})]})]})}}jr(lr,"COMPONENT","CommandHistoryPanel");jr(lr,"TITLE","Command History");var db=(r,e)=>{var t=Qs(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}},hb=Mn(db,null,null,{forwardRef:!0})(lr),ru=m.createContext(null);ru.displayName="PluginsContext";var jn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function cb(r){return"DashboardPlugin"in r}function mb(r){return"AuthPlugin"in r}function vb(r){return"TablePlugin"in r}function r0(r){return cb(r)||mb(r)||vb(r)}function pb(r){return"type"in r&&r.type===jn.DASHBOARD_PLUGIN}function Ui(r){return"type"in r&&r.type===jn.WIDGET_PLUGIN}function fb(r){return"type"in r&&r.type===jn.TABLE_PLUGIN}function gb(r){return"type"in r&&r.type===jn.AUTH_PLUGIN}function iu(r){return"type"in r&&r.type===jn.THEME_PLUGIN}function ou(r){return"type"in r&&r.type===jn.ELEMENT_PLUGIN}function i0(r){return pb(r)||gb(r)||fb(r)||iu(r)||Ui(r)||ou(r)}var au=U.module("@deephaven/plugin.PluginUtils");function ka(r,e){return r==null||!Ui(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function bb(r){var e=d.jsx(ve,{icon:ms});if(!Ui(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function o0(r){var e=[...r.entries()].filter(t=>iu(t[1]));return au.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:sd(n,s),name:s,styleContent:u}})}).flat()}function a0(r){var e=[...r.entries()].filter(t=>ou(t[1])&&t[1].mapping!=null);return au.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function s0(){return er(ru,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var su=m.createContext(null);su.displayName="PersistentStateContext";function l0(r){var{initialState:e,onChange:t,children:n}=r,[i,o]=R.useState(0),a=m.useRef({initial:e,initialStateMap:new Map,state:new Map,isTracking:!0}),s=m.useCallback((v,p)=>{a.current.isTracking&&a.current.state.set(v,p)},[]),l=m.useCallback(()=>{a.current.isTracking||(a.current.isTracking=!0,a.current.state=new Map,o(v=>v+1))},[]),u=m.useRef(a.current.initial[Symbol.iterator]()),h=m.useCallback(function(p){var f=a.current.initialStateMap.get(p);if(f)return f;var{value:g,done:y}=u.current.next(),w={value:g,done:y??!1};return a.current.initialStateMap.set(p,w),w},[]);m.useEffect(function(){a.current.isTracking&&(t([...a.current.state.values()]),a.current.isTracking=!1)},[i,t]);var c=m.useMemo(()=>({addState:s,scheduleStateUpdate:l,getInitialState:h,updateId:i}),[s,h,l,i]);return d.jsx(su.Provider,{value:c,children:n})}function ja(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(n){hn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hn(r,e,t){return(e=yb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yb(r){var e=Cb(r,"string");return typeof e=="symbol"?e:e+""}function Cb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Cr=U.module("ConsolePanel"),Sb=500,wb=Object.freeze({consoleSettings:{},itemIds:[]});class Vr extends m.PureComponent{constructor(e){super(e),hn(this,"consoleRef",void 0),hn(this,"objectSubscriptionCleanup",void 0),hn(this,"savePanelState",mn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Cr.debug("Saving panel state",l),this.setState({panelState:l})},Sb)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=R.createRef();var{panelState:t}=e,n=yr(yr({},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(oe.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(oe.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=>{Cr.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,u=[...a,...l],h=new Map(o);u.forEach(v=>{var{title:p}=v;p!==void 0&&h.delete(p)});var c=[...a,...s];return c.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,i=n.get(e);return i==null&&t&&(i=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(Me.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;L(this.context);var{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(oe.CLOSE,n),Mg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Cr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Me.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;L(n);var{config:i,session:o}=n,{title:a=e.name}=e;L(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:yr(yr({},Mc(e)),{},{sessionId:i.id})};Cr.debug("openWidget",l),Kf(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(oe.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=>ka(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>ka(i,e));return n!=null?bb(n):d.jsx(rl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(vn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:h,session:c,connection:v,details:p={},dh:f}=i,{workerName:g,processInfoId:y}=p,{id:w,type:T}=h;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:c!=null&&d.jsx(qt,{dh:f,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:T,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:ol.LANGUAGE_MAP.get(T)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),y!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),y,d.jsx("div",{children:"•"})]}),d.jsx(Lp,{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(Vr,"COMPONENT","ConsolePanel");hn(Vr,"TITLE","Console");hn(Vr,"contextType",Vl);var Eb=(r,e)=>({commandHistoryStorage:Qs(r),sessionWrapper:sr(r,e.localDashboardId),timeZone:$c(r),plugins:Hc(r)}),oi=Mn(Eb,null,null,{forwardRef:!0})(Vr);function u0(r){return r==="file"||r==="directory"}function gt(r){return r.type==="directory"}function Pb(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=_b(r,"string");return typeof e=="symbol"?e:e+""}function _b(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 extends Error{constructor(){super("No file exists at the path specified"),Pb(this,"isFileNotFound",!0)}}function Aa(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 La(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Aa(o,n,i,a,s,"next",l)}function s(l){Aa(o,n,i,a,s,"throw",l)}a(void 0)})}}var sn=function(r){return r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN="",r}({});class M{static fileExists(e,t){return La(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Wi))throw n;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!M.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getUniqueCopyFileName(e,t){return La(function*(){for(var n=M.getCopyFileName(t);yield M.fileExists(e,n);)n=M.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return sn.GROOVY;case"py":return sn.PYTHON;case"pyc":return sn.PYTHON_COMPILED;case"scala":return sn.SCALA;case"txt":return sn.PLAIN_TEXT;default:return sn.UNKNOWN}}static getParent(e){if(!M.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!M.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,o=M.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new 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=>M.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}var Vi=26;function Pi(r){return gt(r)?M.makePath(r.filename):M.getPath(r.filename)}function Ra(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=Pi(e);if(r.some(n=>{var{filename:i}=n;return M.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>gt(n)&&t.startsWith(M.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function Ob(r){if(gt(r))return r.isExpanded?ld:ud;var e=M.getMimeType(r.basename);switch(e){case sn.PYTHON:return hd;default:return dd}}function Ti(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:h,onDragOver:c,onDragEnd:v,onDragExit:p,onDrop:f}=r,g=(e=n==null?void 0:n.some(k=>k.id===s.id))!==null&&e!==void 0?e:!1,y=Pi(s),w=i&&u?Pi(u):null,T=i&&o&&gt(s)&&w===y,P=i&&o&&w===y,$=i&&!o&&w===y,X=Ob(s),re=M.getDepth(s.filename),Y=Array(re).fill(null).map((k,F)=>d.jsx("span",{className:"file-list-depth-line"},F));return d.jsxs("div",{className:q("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":T,"is-in-drop-target":P,"is-invalid-drop-target":$,"is-selected":a}),onDragStart:k=>h(l,k),onDragOver:k=>c(l,k),onDragEnd:k=>v(l,k),onDragExit:p,onDrop:k=>f(l,k),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:X,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function Fa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(n){xb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function xb(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 He=U.module("FileList"),Nb=500,$a="item-list-scroll-pane";function Mb(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Ti,rowHeight:l=Vi,overscanCount:u=bt.DEFAULT_OVERSCAN}=r,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,p]=m.useState({top:0,bottom:0}),[f,g]=m.useState(),[y,w]=m.useState(),[T,P]=m.useState(),[$,X]=m.useState([]),re=m.useRef(),Y=m.useRef(null),k=m.useRef(null),F=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var Z=[],ae=0;ae<I.length;ae+=1)for(var ce=I[ae],$e=ce[0];$e<=ce[1];$e+=1)$e>=h.offset&&$e<h.offset+h.items.length&&Z.push(h.items[$e-h.offset]);return Z},[h]),ee=m.useCallback(I=>{var Z=F([[I,I]]);if(Z.length>0)return Z[0]},[F]),z=m.useCallback(()=>{var I=vt.count($);if(I===0)return null;if(I===1){var Z=$[0][0],ae=ee(Z);if(ae!=null)return ae.filename}return"".concat(I," items")},[ee,$]),j=m.useCallback(I=>{if(!(!y||!f)){He.debug("dropItems",y,"to",I);try{var{files:Z,targetPath:ae}=Ra(y,f);if(i==null||i(Z,ae),I!=null){var ce;X([[I,I]]),(ce=Y.current)===null||ce===void 0||ce.focusItem(I)}}catch($e){He.error("Unable to complete move",$e)}}},[y,f,i]),G=m.useCallback((I,Z)=>{var ae=h.items[I-h.offset];ae!==void 0&&(He.debug("handleItemClick",ae),o(ae,Z),gt(ae)&&(t==null||t.setExpanded(ae.filename,!ae.isExpanded)))},[h,o,t]),W=m.useCallback((I,Z)=>{var ae,ce;He.debug2("handleItemDragStart",I,$);var $e=$;vt.isSelected($,I)||($e=[[I,I]],X($e)),w(F($e)),(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=(ce=z())!==null&&ce!==void 0?ce:"",Ot.appendChild(Ct),Ot.className="file-list-dnd-placeholder",document.body.appendChild(Ot),Z.dataTransfer.setDragImage(Ot,0,0),Z.dataTransfer.effectAllowed="move",P(Ot)},[z,F,$]),A=m.useCallback((I,Z)=>{Z.preventDefault(),He.debug2("handleItemDragOver",Z),g(ee(I))},[ee]),B=m.useCallback((I,Z)=>{He.debug("handleItemDragEnd",I),T==null||T.remove(),w(void 0),g(void 0),P(void 0)},[T]),V=m.useCallback((I,Z)=>{j(I)},[j]),pe=m.useCallback(()=>{He.debug2("handleItemDragExit"),g(void 0)},[]),qe=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains($a)&&(I.preventDefault(),He.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),ke=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains($a)&&(He.debug("handleListDrop"),j())},[j]),b=m.useCallback(function(I){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(He.debug2("handleSelectionChange",I),Z===!0||I!==$){X(I);var ae=F(I);a(ae)}},[F,a,$]),S=m.useCallback(I=>{if(He.debug2("handleFocusChange",I),I!=null){var[Z]=F([[I,I]]);n(Z)}else n();re.current=I},[F,n]),_=m.useCallback((I,Z)=>{He.debug("handleViewportChange",I,Z),(I!==v.top||Z!==v.bottom)&&p({top:I,bottom:Z})},[v]),K=m.useMemo(()=>{if(!y||!f)return!1;try{return Ra(y,f),He.debug("handleValidateDropTarget true"),!0}catch{return He.debug("handleValidateDropTarget false"),!1}},[y,f]),{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 Z=t.onUpdate(ae=>{c({items:ae.items.map(ce=>Sr(Sr({},ce),{},{itemName:ce.basename})),offset:ae.offset,itemCount:t.size})});return()=>{Z()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),$.length>0&&b($,!0)},[h,S,b,$]),m.useEffect(function(){if(f!=null&&gt(f)&&f.filename!=="/"){var Z=setTimeout(()=>{f.isExpanded||t==null||t.setExpanded(f.filename,!0)},Nb);return()=>clearTimeout(Z)}},[f,t]);var at=m.useCallback(I=>s(Sr(Sr({},I),{},{isDragInProgress:y!=null,dropTargetItem:f,draggedItems:y,isDropTargetValid:K,onDragStart:W,onDragEnd:B,onDragOver:A,onDragExit:pe,onDrop:V})),[B,pe,A,W,V,y,f,K,s]);return d.jsx("div",{ref:k,className:q("file-list",{"is-dragging":y!=null}),onDragOver:qe,onDrop:ke,children:d.jsx(bt,{ref:Y,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:S,onSelect:G,onSelectionChange:b,onViewportChange:_,selectedRanges:$,renderItem:at,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var kb={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 Ha={FILE_EXPLORER:kb};var Ba=U.module("FileListItemEditor"),jb=()=>Promise.resolve();function Ab(r){var{item:e,onCancel:t,onSubmit:n,validate:i=jb}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[h,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var T;(T=o.current)===null||T===void 0||T.focus()},[o]),p=m.useCallback(T=>T.stopPropagation(),[]),f=m.useCallback(()=>{h.then(()=>{n(a)}).catch(T=>Ba.info("Unable to validate name",T))},[n,a,h]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>u(void 0)).catch($=>{Te.isCanceled($)||u($)}),c(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{Ba.debug2("handleBlur"),f()},[f]),y=m.useCallback(T=>{var{value:P}=T.target;s(P)},[]),w=m.useCallback(T=>{T.stopPropagation();var{key:P}=T;switch(P){case"Enter":{f();break}case"Escape":{t();break}}},[t,f]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:q("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:y,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Ua(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 ai(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ua(Object(t),!0).forEach(function(n){Lb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ua(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Lb(r,e,t){return(e=Rb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rb(r){var e=Fb(r,"string");return typeof e=="symbol"?e:e+""}function Fb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function lu(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:h,onSelectionChange:c,table:v,rowHeight:p=Vi,validateRename:f=()=>Promise.resolve()}=r,[g,y]=m.useState(),[w,T]=m.useState([]),[P,$]=m.useState(),X=m.useCallback(V=>{T(V),c==null||c(V)},[c]),re=m.useCallback(V=>{$(V)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),k=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),F=m.useCallback(()=>{i==null||i()},[i]),ee=m.useCallback(()=>{P&&(o==null||o(M.getPath(P.filename)))},[P,o]),z=m.useCallback(()=>{P&&y(P)},[P]),j=m.useCallback(()=>{y(void 0)},[]),G=m.useCallback(V=>{g&&(u==null||u(g,V),y(void 0))},[u,g]),W=m.useMemo(()=>{if(g)return[];var V=[];return i&&V.push({title:"New File",description:"Create new file",action:F,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:Ha.FILE_EXPLORER.DELETE,action:k,group:te.groups.low}),u&&V.push({title:"Rename",description:"Rename",shortcut:Ha.FILE_EXPLORER.RENAME,action:z,group:te.groups.low,disabled:P==null}),V},[Y,k,F,ee,z,P,a,i,o,s,u,w,g]),A=m.useCallback(V=>(L(g),f(g,V)),[g,f]),B=m.useCallback(V=>{var{item:pe}=V;return g&&g.filename===pe.filename?d.jsx(Ti,ai(ai({},V),{},{children:d.jsx(Ab,{item:pe,validate:A,onSubmit:G,onCancel:j})})):d.jsx(Ti,ai({},V))},[j,G,g,A]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(Mb,{onMove:l,onSelect:h,onSelectionChange:X,onFocusChange:re,renderItem:B,rowHeight:p,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(te,{actions:W})]})}lu.displayName="FileListContainer";function Wa(r,e,t){return(e=$b(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $b(r){var e=Hb(r,"string");return typeof e=="symbol"?e:e+""}function Hb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 Vn{constructor(e){super("Name already exists"),Wa(this,"isExistingFile",!0),Wa(this,"info",void 0),this.info=e}}function Va(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 Ka(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Va(o,n,i,a,s,"next",l)}function s(l){Va(o,n,i,a,s,"throw",l)}a(void 0)})}}var St=U.module("FileExplorer");function Ki(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:h,rowHeight:c=Vi}=r,[v,p]=m.useState([]),[f,g]=m.useState();m.useEffect(function(){var G;function W(){return A.apply(this,arguments)}function A(){return A=Ka(function*(){St.debug("initTable"),G=Te.makeCancelable(e.getTable(),B=>B.close());try{g(yield G)}catch(B){Te.isCanceled(B)||St.error("Unable to initialize table",B)}}),A.apply(this,arguments)}return W(),()=>{G.cancel()}},[e]);var y=m.useCallback(j=>{Te.isCanceled(j)||St.error(j)},[]),w=m.useCallback(()=>{St.debug("handleCreateFile"),s()},[s]),T=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),p(j)},[]),X=m.useCallback(()=>{St.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(gt(j)?M.makePath(j.filename):j.filename)),o(v),p([])},[v,o,e]),re=m.useCallback(()=>{St.debug("handleDeleteCancel"),p([])},[]),Y=m.useCallback((j,G)=>{var W=M.reducePaths(j.map(A=>gt(A)?M.makePath(A.filename):A.filename));W.forEach(A=>{var B=M.isPath(A)?"".concat(G).concat(M.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(G).concat(M.getBaseName(A));e.moveFile(A,B).then(()=>{a(A,B)}).catch(y)})},[y,a,e]),k=m.useCallback((j,G)=>{var W=j.filename,A=gt(j);A&&!W.endsWith("/")&&(W="".concat(W,"/"));var B="".concat(M.getParent(W)).concat(G);A&&!B.endsWith("/")&&(B="".concat(B,"/")),St.debug2("handleRename",W,B),e.moveFile(W,B).catch(y),a(W,B)},[y,a,e]),F=m.useCallback(function(){var j=Ka(function*(G,W){if(W!==G.basename){M.validateName(W);var A="".concat(M.getPath(G.filename)).concat(W);try{var B=yield e.info(A);throw new Tr(B)}catch(V){if(!(V instanceof Wi))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:[f&&d.jsx(lu,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:T,onCreateFile:w,onMove:Y,onDelete:$,onRename:k,onSelect:u,onSelectionChange:h,rowHeight:c,table:f,validateRename:F}),d.jsx(qn,{isOpen:ee,headerText:z,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:X,confirmButtonText:"Delete"})]})}Ki.displayName="FileExplorer";function za(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 Bb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){za(o,n,i,a,s,"next",l)}function s(l){za(o,n,i,a,s,"throw",l)}a(void 0)})}}function ln(r,e,t){return(e=Ub(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ub(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)}var nn=U.module("NewItemModal");class cn extends m.PureComponent{static getValidationMessage(e){return e instanceof Tr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||nn.error(e)}constructor(e){super(e),ln(this,"inputRef",R.createRef()),ln(this,"cancelableValidatePromise",void 0),ln(this,"cancelableExistingItemPromise",void 0),ln(this,"pending",new Qn),ln(this,"pathMap",new Map),ln(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,n=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Te.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return Bb(function*(){M.validateName(t);var{defaultValue:o,storage:a}=i.props;if(n){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Tr(l)}catch(u){if(!(u instanceof Wi))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(cn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(nn.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,n=M.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof Vn))throw e;nn.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;nn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){nn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=M.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){nn.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;nn.debug("submitModal",n,i);var l=M.getExtension(i);return a&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(u=>{if(u instanceof Tr&&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(cn.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((n,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(n,"/"),d.jsxs(R.Fragment,{children:[d.jsx(ie,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:cd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:h,validationError:c,value:v,prevExtension:p,newExtension:f}=this.state,g=a==="directory",y=M.fileExtensionToString(p),w=M.fileExtensionToString(f),T=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(ls,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(us,{toggle:n,children:o}),d.jsx(ds,{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":c}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:cn.getValidationMessage(c)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(Ki,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Ls,{children:[d.jsx(ie,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(ie,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:T})]})]}),d.jsx(qn,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(qn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}ln(cn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function Vb(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(ie,{kind:"ghost",icon:Ss,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(ie,{kind:"ghost",icon:md,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(Vs,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Ga(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 Kb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ga(o,n,i,a,s,"next",l)}function s(l){Ga(o,n,i,a,s,"throw",l)}a(void 0)})}}function uu(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)}var rn=U.module("FileExplorerPanel"),qb=(r,e)=>{var t=Js(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}},Xb=Mn(qb,null,null,{forwardRef:!0});function Zb(r){var e=r;return e!=null&&typeof e.button=="number"}class Nn extends R.Component{static handleError(e){rn.error(e)}static isFocusEvent(e){return Zb(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:""};rn.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){rn.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){rn.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Nn.handleError)}handleCopyFile(e){var t=this;return Kb(function*(){var{fileStorage:n}=t.props;if(gt(e)){rn.error("Invalid item in handleCopyItem",e);return}var i=yield M.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(J.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(rn.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;rn.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(Vb,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Ki,{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(cn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}uu(Nn,"COMPONENT","FileExplorerPanel");uu(Nn,"TITLE","File Explorer");var Yb=Xb(Nn);function Yn(r,e,t){return(e=Qb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qb(r){var e=Jb(r,"string");return typeof e=="symbol"?e:e+""}function Jb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 qa=U.module("LogPanel");class Kr 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){qa.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){qa.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(Kr,"defaultProps",{session:null});Yn(Kr,"COMPONENT","LogPanel");Yn(Kr,"TITLE","Log");var ey=(r,e)=>{var t;return{session:(t=sr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},ty=Mn(ey,null,null,{forwardRef:!0})(Kr);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 wr(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)})}}function Za(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Qe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Za(Object(t),!0).forEach(function(n){Le(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Za(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Le(r,e,t){return(e=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=ry(r,"string");return typeof e=="symbol"?e:e+""}function ry(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.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 iy=m.lazy(()=>Es(()=>import("./MarkdownNotebook-CsCP6Muy.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=U.module("NotebookPanel"),Ya=400;class Oe extends m.Component{static handleError(e){Te.isCanceled(e)||ue.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Oe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Oe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Le(this,"pending",void 0),Le(this,"debouncedSavePanelState",void 0),Le(this,"debouncedLoad",void 0),Le(this,"notebook",void 0),Le(this,"tabTitleElement",void 0),Le(this,"tabInitOnce",void 0),Le(this,"editor",void 0),Le(this,"getSettings",Xt((v,p)=>Qe(Qe({},v),{},{minimap:{enabled:p}}))),Le(this,"getOverflowActions",Xt((v,p,f)=>{var g=[{title:"Find",icon:fd,action:this.handleFind,group:te.groups.high,shortcut:We.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:hs,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:gd,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:gs,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?_n:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:We.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?_n:void 0,action:this.handleWordWrapChange,group:te.groups.low,shortcut:We.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:te.groups.low,order:10}),g.push({title:"Format on Save",icon:f?_n: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=mn(this.savePanelState.bind(this),Ya),this.debouncedLoad=mn(this.load.bind(this),Ya),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var u=s!=null&&M.hasPath(s.itemName),h=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},ue.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(J.RENAME_FILE,this.handleRenameFile),t.on(oe.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(oe.DROPPED,this.handlePanelDropped),t.off(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(J.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);L(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){ue.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){ue.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(J.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:o}=i;n.emit(J.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(J.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;L(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(o=>{var a;ue.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:h}=u;this.renameTab(h,M.getBaseName(s))}var c=Qe(Qe({},t),{},{language:(a=Oe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){ue.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;ue.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:n,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,u=Qe(Qe({},a),{},{value:s}),h=Qe(Qe({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return ue.debug("Saving panel state",c),{settings:u,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(J.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return wr(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;L(o);var{language:s}=a,{itemName:l}=o,u=yield M.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var h={id:u,itemName:u},c={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return wr(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:o}=e.state;ue.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(M.hasPath(o.itemName)&&(yield M.fileExists(t,o.itemName))?(i.emit(J.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){ue.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:n-1,savedChangeCount:i}:!a&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};n(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings: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 wr(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&&M.hasPath(s.itemName)&&s.itemName!==i.itemName&&(ue.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(Oe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Te.isCanceled(e)||(this.setState({savedChangeCount:0}),ue.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),ue.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(o)!==M.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?me.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return wr(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(Me.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:n}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",n??!1)}render(){var e,t,n,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:h,error:c,isDashboardActive:v,isLoaded:p,isLoading:f,isPreview:g,fileMetadata:y,session:w,sessionLanguage:T,settings:P,showCloseModal:$,showDeleteModal:X,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,k=(e=y==null?void 0:y.itemName)!==null&&e!==void 0?e:Oe.DEFAULT_NAME,F=k.endsWith(".md"),ee=(y==null?void 0:y.id)!=null,z=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),j=w!=null,G=T===z.language,W=!p||!j||!G,A=!p,B=[{action:this.handleSave,shortcut:zt.SAVE},{action:this.handleMinimapChange,shortcut:We.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:We.NOTEBOOK.WORDWRAP}],V=gi.getDisabledRunTooltip(j,G,"Notebook extension","Run"),pe=gi.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}],ke=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[ke!=null&&Lr.createPortal(d.jsx("span",{className:q(Oe.UNSAVED_INDICATOR_CLASS_NAME,{[Oe.UNSAVED_STATUS_CLASS_NAME]:u!==h})}),ke),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:()=>k,children:[!F&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:W,icon:d.jsx(ve,{icon:Cs,transform:"grow-4"}),tooltip:"Run ".concat(We.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&d.jsx(he,{children:V})]}),d.jsxs("span",{children:[d.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:W,icon:d.jsx(ve,{icon:vd,transform:"grow-4"}),tooltip:"Run Selected ".concat(We.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(ie,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:pd,tooltip:"Save ".concat(zt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(ie,{kind:"ghost",className:"btn-overflow",disabled:A,icon:ys,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(tr,{actions:this.getDropdownOverflowActions,popperOptions:Oe.POPPER_OPTIONS})})]}),d.jsx(Cl,{isLoaded:p,isLoading:f,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:T,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:z,focusOnMount:Y,ref:b=>{this.notebook=b}})]}),F&&d.jsx(m.Suspense,{fallback:d.jsx(vn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(iy,{content:(n=z.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(cn,{isOpen:re,type:"file",defaultValue:k,title:ee?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(qn,{isOpen:X,headerText:'Are you sure you want to delete "'.concat(k,'"?'),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(k,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),d.jsx(te,{actions:B})]})]})}}Le(Oe,"COMPONENT","NotebookPanel");Le(Oe,"POPPER_OPTIONS",{placement:"bottom-end"});Le(Oe,"DEFAULT_NAME","Untitled");Le(Oe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Le(Oe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Le(Oe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var oy=(r,e)=>{var t=Js(r),n=tl(r),i=sr(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},on=Mn(oy,{updateNotebookSettings:zc},null,{forwardRef:!0})(Oe);function ay(){var{python:{linter:r={}}={}}=cg(tl),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function Qa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ja(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qa(Object(t),!0).forEach(function(n){sy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sy(r,e,t){return(e=ly(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ly(r){var e=uy(r,"string");return typeof e=="symbol"?e:e+""}function uy(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ge=U.module("ConsolePlugin");function es(r){return r.notebook!==void 0}function dy(r){Yf(r)}function d0(r){dy(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:o,notebooksUrl:a}=r,s=m.useRef(0),[l,u]=m.useState(new Map),[h,c]=m.useState(new Map);ay();var v=_i(),p=m.useCallback(()=>i.getLastUsedPanelOfType(oi),[i]),f=m.useCallback((b,S)=>{u(_=>new Map(_.set(b,S)))},[u]),g=m.useCallback(b=>{u(S=>(S.delete(b),new Map(S)))},[u]),y=m.useCallback((b,S)=>{c(_=>new Map(_.set(b,S)))},[c]),w=m.useCallback(b=>{c(S=>(S.delete(b),new Map(S)))},[c]),T=m.useCallback(function(b){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,K=b&&b.trim();if(!K)ge.info("Ignoring empty code");else{var ne=p();if(!ne||!(ne instanceof oi.WrappedComponent)){ge.error("Console panel not found");return}ge.debug("Send command: ",b,S,_),ne.addCommand(b,S,_)}},[p]),P=m.useCallback(b=>{v(sb(e,b))},[v,e]),$=m.useCallback(b=>{var{language:S}=b,_=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},[]),X=m.useCallback(function(b){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:_}=b;if(_!=null&&l.has(_))return l.get(_);if(_!=null&&h.has(_))return h.get(_);if(S)return Et()},[l,h]),re=m.useCallback((b,S)=>{x.renameComponent(n.root,{id:b},S)},[n.root]),Y=m.useCallback((b,S)=>{ge.debug("Rename file panel",b,S);var _;if(l.has(b)&&(_=l.get(b),g(b),_!=null&&f(S,_)),h.has(b)&&(_=h.get(b),w(b),_!=null&&y(S,_)),_===void 0){ge.debug2("File ".concat(b," isn't open, no need to rename the tab"));return}re(_,M.getBaseName(S))},[l,h,re,f,y,g,w]),k=m.useCallback(b=>{var S=X(b,!1);if(S==null){ge.error("Could not find panel id for file metadata",b);return}x.activateTab(n.root,{id:S})},[X,n.root]),F=m.useCallback((b,S,_)=>{if(ge.debug("registerFilePanel",b,S,_),S==null||S.id==null){ge.debug("Ignore empty file id",S);return}var{id:K}=S;if(_){y(K,b);return}if(l.has(K)){var ne=l.get(K);if(b===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}f(K,b),h.has(K)&&w(K)},[l,h,Y,f,y,w]),ee=m.useCallback((b,S)=>{if(ge.debug("unregisterFileTab",b,S),b==null||b.id==null){ge.debug("Ignore empty file id",b);return}var{id:_}=b;if(S){w(_);return}g(_)},[g,w]),z=m.useCallback((b,S)=>{ge.debug("closeFilePanel",b);var{id:_}=b;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(h.has(_))K=h.get(_),ne=!0;else{ge.debug("File ".concat(_," isn't open, ignore close event"));return}ee(b,ne),x.closeComponent(n.root,{id:K},S)},[n.root,l,h,ee]),j=m.useCallback(b=>{var{itemName:S}=b;return M.getBaseName(S)},[]),G=m.useCallback(b=>{var{id:S}=b;return ge.debug("fileIsOpen",b,S,l),S!=null&&l.has(S)},[l]),W=m.useCallback(b=>{var{id:S}=b;return ge.debug("fileIsOpenAsPreview",b,S,h),S!=null&&h.has(S)},[h]),A=m.useCallback(b=>{if(b!=null){var S=i.getOpenedPanelById(b);S&&es(S)&&S.focus()}},[i]),B=m.useCallback(b=>{var{id:S,settings:_,fileMetadata:K,session:ne,sessionLanguage:at,isPreview:I=!1}=b,Z={settings:_,fileMetadata:K},ae=j(K);return{type:"react-component",component:on.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ne,sessionLanguage:at,panelState:Z,isPreview:I,notebooksUrl:a},title:ae,id:S}},[j,e,a]),V=m.useCallback(function(b,S,_){var K=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:$(_)},ne=X(K);if(G(K)&&ne!=null){ge.debug("File is already open, focus panel"),k(K),A(ne);return}if(ne==null){ge.error("Panel ID for file metadata is null");return}var at=x.getStackForComponentTypes(n.root,[on.COMPONENT]),I=B({id:ne,settings:_,fileMetadata:K,session:b,sessionLanguage:S});ge.debug("createNotebook",I,l),x.openComponentInStack(at,I)},[G,A,$,X,n.root,B,l,k]),pe=m.useCallback(function(b,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),[Z]=[...h.values()],ae=!ne,ce=ae&&Z?Z:X(K);if(ce==null||ce==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(K)));if(at||I)k(K);else{var $e=x.getStackForComponentTypes(n.root,[on.COMPONENT]),Ot=B({id:ce,settings:_,fileMetadata:K,session:b,sessionLanguage:S,isPreview:ae});x.openComponentInStack($e,Ot)}if(I&&ne){var Ct=K.id,qr=x.getStackForConfig(n.root,{component:on.COMPONENT,id:ce}),An=x.getContentItemInStack(qr,{component:on.COMPONENT,id:ce});Ct!=null&&An&&et(An)&&(An.container.emit(J.PROMOTE_FROM_PREVIEW),w(Ct),f(Ct,ce))}ne&&A(ce)},[k,G,W,A,X,n.root,B,h,w,f]),qe=m.useCallback(function(b,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(on);ne&&es(ne)?_!=null&&_.value!=null&&ne.notebook!=null&&ne.notebook.append(_.value):K&&V(b,S,_)},[V,i]),ke=m.useCallback((b,S)=>og.hydrate(Ja(Ja({},b),{},{notebooksUrl:a}),S),[a]);return Fn(o,oi,t),Fn(o,hb),Fn(o,Yb),Fn(o,ty),Fn(o,on,ke),Ae(n.eventHub,Me.SEND_COMMAND,T),Ae(n.eventHub,Me.SETTINGS_CHANGED,P),Ae(n.eventHub,J.CLOSE_FILE,z),Ae(n.eventHub,J.CREATE_NOTEBOOK,V),Ae(n.eventHub,J.SELECT_NOTEBOOK,pe),Ae(n.eventHub,J.RENAME,re),Ae(n.eventHub,J.RENAME_FILE,Y),Ae(n.eventHub,J.SEND_TO_NOTEBOOK,qe),Ae(n.eventHub,J.REGISTER_FILE,F),Ae(n.eventHub,J.UNREGISTER_FILE,ee),null}function zr(r,e,t){return(e=hy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hy(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)}class Gr{}zr(Gr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");zr(Gr,"INPUT_FILTER","ControlType.INPUT_FILTER");zr(Gr,"MARKDOWN","ControlType.MARKDOWN");zr(Gr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{Iy as $,Uy as A,ie as B,$s as C,Ke as D,Wy as E,pl as F,js as G,As as H,Pt as I,Re as J,O as K,tl as L,zc as M,H as N,Xn as O,Te as P,zt as Q,Vm as R,zs as S,E as T,Vh as U,Gr as V,BC as W,tr as X,rl as Y,Fr as Z,el as _,pt as a,Ls as a$,sr as a0,XC as a1,Hc as a2,Fe as a3,mg as a4,Vy as a5,Kc as a6,en as a7,IC as a8,Xl as a9,Jy as aA,Xy as aB,Zy as aC,ZC as aD,YC as aE,Ky as aF,qy as aG,nl as aH,Gy as aI,me as aJ,Cy as aK,rh as aL,er as aM,uh as aN,ih as aO,ks as aP,Ms as aQ,oh as aR,ah as aS,vt as aT,bt as aU,dh as aV,Fs as aW,Vs as aX,cc as aY,$r as aZ,D as a_,Yy as aa,kC as ab,og as ac,Ed as ad,xs as ae,J as af,Tt as ag,pC as ah,gC as ai,yC as aj,SC as ak,oe as al,HC as am,jC as an,RC as ao,on as ap,Kf as aq,Mc as ar,Ps as as,Rr as at,d0 as au,te as av,qn as aw,s0 as ax,Qy as ay,zy as az,_t as b,dl as b$,Oh as b0,Oi as b1,wy as b2,mc as b3,xi as b4,Py as b5,Bs as b6,ch as b7,Gs as b8,Hs as b9,Tv as bA,sC as bB,lC as bC,Nv as bD,Mv as bE,dC as bF,uC as bG,ji as bH,hC as bI,Mp as bJ,_p as bK,kp as bL,qt as bM,il as bN,Ue as bO,Dr as bP,vp as bQ,Sl as bR,ol as bS,um as bT,ul as bU,Jc as bV,On as bW,al as bX,xn as bY,Jv as bZ,Or as b_,hh as ba,Wh as bb,_r as bc,Oc as bd,Zs as be,Xs as bf,qs as bg,Ty as bh,_y as bi,Oy as bj,dv as bk,hv as bl,we as bm,gv as bn,Dv as bo,Q as bp,Sv as bq,Ne as br,eC as bs,ml as bt,vl as bu,rC as bv,aC as bw,tC as bx,nC as by,iC as bz,C as c,cb as c$,Lp as c0,Se as c1,pi as c2,We as c3,Cl as c4,gi as c5,Ts as c6,x as c7,Fn as c8,vC as c9,Xf as cA,mC as cB,ug as cC,PC as cD,TC as cE,FC as cF,LC as cG,fC as cH,CC as cI,bC as cJ,wC as cK,NC as cL,$C as cM,Ae as cN,bg as cO,o0 as cP,Ui as cQ,a0 as cR,su as cS,l0 as cT,jn as cU,ru as cV,bb as cW,gb as cX,pb as cY,ou as cZ,mb as c_,xC as ca,Vg as cb,Ng as cc,Dg as cd,ii as ce,Zl as cf,DC as cg,EC as ch,Vl as ci,tg as cj,Hi as ck,$i as cl,zl as cm,gr as cn,Yf as co,Ul as cp,Mg as cq,AC as cr,_C as cs,OC as ct,ql as cu,Wl as cv,Zf as cw,zf as cx,qf as cy,Gf as cz,ze as d,r0 as d0,vb as d1,i0 as d2,fb as d3,iu as d4,ka as d5,yy as d6,eo as d7,Vf as d8,Br as d9,JC as dA,QC as dB,nu as dC,Me as dD,qC as dE,sb as dF,ay as dG,gy as dH,Sy as dI,by as dJ,Zr as dK,xd as dL,Xr as dM,oC as dN,Vn as dO,MC as da,M as db,Wi as dc,u0 as dd,oi as de,ty as df,hb as dg,Yb as dh,Ds as di,fy as dj,ar as dk,Ns as dl,Jt as dm,e0 as dn,KC as dp,zC as dq,tu as dr,VC as ds,GC as dt,Qn as du,UC as dv,n0 as dw,WC as dx,gt as dy,t0 as dz,$c as e,Hy as f,Dy as g,$y as h,Fy as i,Ry as j,Ly as k,Ay as l,xy as m,ky as n,My as o,Ny as p,Gc as q,Ce as r,de as s,he as t,Nc as u,Ee as v,By as w,jy as x,Ey as y,cg as z};
25
+ //# sourceMappingURL=ControlType-RBsIk8KS.js.map