@deephaven/code-studio 1.22.1-alpha-pivot-builder.0 → 1.22.1

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 (60) hide show
  1. package/build/assets/{AppRoot-CQYK1da9.js → AppRoot-E7Fqd0WW.js} +6 -6
  2. package/build/assets/{AppRoot-CQYK1da9.js.map → AppRoot-E7Fqd0WW.js.map} +1 -1
  3. package/build/assets/{Chart-BG1WVLsO.js → Chart-BvHar6xm.js} +2 -2
  4. package/build/assets/{Chart-BG1WVLsO.js.map → Chart-BvHar6xm.js.map} +1 -1
  5. package/build/assets/{ControlType-D-mhzKYk.js → ControlType-DQcTi2TW.js} +5 -5
  6. package/build/assets/ControlType-DQcTi2TW.js.map +1 -0
  7. package/build/assets/{FormatterUtils-jDvPfuQx.js → FormatterUtils-DJ5dBmmS.js} +2 -2
  8. package/build/assets/{FormatterUtils-jDvPfuQx.js.map → FormatterUtils-DJ5dBmmS.js.map} +1 -1
  9. package/build/assets/Grid-D_oElZag.js +5 -0
  10. package/build/assets/Grid-D_oElZag.js.map +1 -0
  11. package/build/assets/{GridTokenMouseHandler-OF3gVPpi.js → GridTokenMouseHandler-DRr0KPMt.js} +2 -2
  12. package/build/assets/{GridTokenMouseHandler-OF3gVPpi.js.map → GridTokenMouseHandler-DRr0KPMt.js.map} +1 -1
  13. package/build/assets/IrisGrid-D_d5p1qS.js +3 -0
  14. package/build/assets/IrisGrid-D_d5p1qS.js.map +1 -0
  15. package/build/assets/IrisGridModel-ohR23tzo.js +3 -0
  16. package/build/assets/IrisGridModel-ohR23tzo.js.map +1 -0
  17. package/build/assets/{IrisGridShortcuts-DPeqDoXv.js → IrisGridShortcuts-Dx1r33yu.js} +2 -2
  18. package/build/assets/{IrisGridShortcuts-DPeqDoXv.js.map → IrisGridShortcuts-Dx1r33yu.js.map} +1 -1
  19. package/build/assets/{IrisGridThemeProvider-JoTat46_.js → IrisGridThemeProvider-BjK47p_6.js} +3 -3
  20. package/build/assets/IrisGridThemeProvider-BjK47p_6.js.map +1 -0
  21. package/build/assets/{LocalWorkspaceStorage-btNoh_EI.js → LocalWorkspaceStorage-DcQOhYs6.js} +2 -2
  22. package/build/assets/{LocalWorkspaceStorage-btNoh_EI.js.map → LocalWorkspaceStorage-DcQOhYs6.js.map} +1 -1
  23. package/build/assets/{MarkdownEditor-DS6SS6TE.js → MarkdownEditor-DhNRkvJq.js} +2 -2
  24. package/build/assets/{MarkdownEditor-DS6SS6TE.js.map → MarkdownEditor-DhNRkvJq.js.map} +1 -1
  25. package/build/assets/{MarkdownNotebook-BlE_4mh5.js → MarkdownNotebook-wb8Y8t0p.js} +2 -2
  26. package/build/assets/{MarkdownNotebook-BlE_4mh5.js.map → MarkdownNotebook-wb8Y8t0p.js.map} +1 -1
  27. package/build/assets/MissingPartitionError-WA7eKr_P.js +3 -0
  28. package/build/assets/MissingPartitionError-WA7eKr_P.js.map +1 -0
  29. package/build/assets/{MockChartModel-CYzKJ-5F.js → MockChartModel-CkINJ8zq.js} +2 -2
  30. package/build/assets/{MockChartModel-CYzKJ-5F.js.map → MockChartModel-CkINJ8zq.js.map} +1 -1
  31. package/build/assets/Plot-0FbdKJAa.js +2 -0
  32. package/build/assets/{Plot-DBz8ZKU9.js.map → Plot-0FbdKJAa.js.map} +1 -1
  33. package/build/assets/{Plotly-hd2IlQYB.js → Plotly-DetVXnE1.js} +2 -2
  34. package/build/assets/{Plotly-hd2IlQYB.js.map → Plotly-DetVXnE1.js.map} +1 -1
  35. package/build/assets/{StyleGuideRoot-e3mrIgNS.js → StyleGuideRoot-Bct04mfV.js} +2 -2
  36. package/build/assets/{StyleGuideRoot-e3mrIgNS.js.map → StyleGuideRoot-Bct04mfV.js.map} +1 -1
  37. package/build/assets/{index-BXQL1ePo.js → index-BjxS1hHc.js} +2 -2
  38. package/build/assets/{index-BXQL1ePo.js.map → index-BjxS1hHc.js.map} +1 -1
  39. package/build/assets/{index-Dq1zKa4c.js → index-Cyvh6QNX.js} +3 -3
  40. package/build/assets/{index-Dq1zKa4c.js.map → index-Cyvh6QNX.js.map} +1 -1
  41. package/build/assets/index-qaD5WL1V.js +9 -0
  42. package/build/assets/index-qaD5WL1V.js.map +1 -0
  43. package/build/assets/plotly-C-Edrc1c.js +7 -0
  44. package/build/assets/{plotly-Bi5O4gw4.js.map → plotly-C-Edrc1c.js.map} +1 -1
  45. package/build/index.html +2 -2
  46. package/package.json +31 -31
  47. package/build/assets/ControlType-D-mhzKYk.js.map +0 -1
  48. package/build/assets/Grid-DrT_NhFk.js +0 -5
  49. package/build/assets/Grid-DrT_NhFk.js.map +0 -1
  50. package/build/assets/IrisGrid-BXz7v4u-.js +0 -3
  51. package/build/assets/IrisGrid-BXz7v4u-.js.map +0 -1
  52. package/build/assets/IrisGridModel-Bt5DsPGQ.js +0 -3
  53. package/build/assets/IrisGridModel-Bt5DsPGQ.js.map +0 -1
  54. package/build/assets/IrisGridThemeProvider-JoTat46_.js.map +0 -1
  55. package/build/assets/MissingPartitionError-BjRZq4C4.js +0 -3
  56. package/build/assets/MissingPartitionError-BjRZq4C4.js.map +0 -1
  57. package/build/assets/Plot-DBz8ZKU9.js +0 -2
  58. package/build/assets/index-CqqIpX5D.js +0 -9
  59. package/build/assets/index-CqqIpX5D.js.map +0 -1
  60. package/build/assets/plotly-Bi5O4gw4.js +0 -7
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-DBz8ZKU9.js","./Plotly-hd2IlQYB.js","./plotly-Bi5O4gw4.js","./helpers-BosuxZz1.js","./vendor-B6dPaAcV.js","./vendor-V6ynCsSj.css","./MarkdownNotebook-BlE_4mh5.js","./index-Dq1zKa4c.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-CwMW8ik0.css","./mathjax-CmifxKXU.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
2
- import{r as m,a0 as gn,bG as Br,I as d,bL as Mu,U as A,K as G,bM as ys,ac as vi,L as Cs,R as Wr,bN as ku,bO as ju,M as ve,H as Ot,bP as Lu,a8 as Au,a9 as Ru,G as Ss,a1 as xn,bQ as Fu,bR as $u,bS as Hu,bT as Bu,bJ as Qn,bU as Wu,a6 as Uu,a5 as Vu,bF as ro,bV as Ku,bW as zu,ad as Qt,aw as io,bX as qn,bY as D,bZ as oo,bK as ye,a3 as Ai,af as ws,b_ as Gu,_ as $n}from"./vendor-B6dPaAcV.js";import{aC as Es,L as W,aZ as Ps,W as Ts,$ as qu,ai as Xu,aj as Zu,ah as Yu,ar as Qu,ad as Ju,aw as ed,M as _s,b as Os,c as xs,aK as td,a_ as nd,a$ as Is,b0 as Ds,b1 as rd,b2 as id,N as bn,aA as od,b3 as ad,b4 as sd,b5 as ld,b6 as ud,b7 as dd,b8 as cd,b9 as hd,ba as md,bb as vd,bc as fd,E as Ns,aY as pd,aV as Ms,aW as gd,a3 as ks,k as bd,e as L,d as fi,bd as yd,be as Cd,au as js,bf as ao,bg as Sd,bh as wd,bi as Ed,bj as Pd,f as Ls,aO as As,bk as Td,bl as Rs,bm as Mn,aU as _d,bn as Od,H as so,bo as Fs,q as lo,bp as $s,bq as xd,K as Id,ak as Dd,br as Nd,C as Md,al as kd,bs as jd,bt as Ld,bu as Ad,bv as Rd,bw as Fd,bx as $d,by as Hd,aQ as Bd,bz as Wd,bA as Ud}from"./index-Dq1zKa4c.js";import{e as De,M as Vd,b as uo,l as at,R as Hs,K as ot,c as Jt,d as co,U as Kd,_ as Bs}from"./monaco-DaE0jI-i.js";var Ws=Object.freeze([]),mC=new Map,Us=()=>{};function vC(n){return Array.isArray(n)?n:[n]}function ni(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function zd(n,e,t){return(e=Gd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gd(n){var e=qd(n,"string");return typeof e=="symbol"?e:e+""}function qd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ho extends Error{constructor(){super(...arguments),zd(this,"isCanceled",!0)}}function Xd(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Zd(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function Zd(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Yd(n,e,t){return(e=Qd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qd(n){var e=Jd(n,"string");return typeof e=="symbol"?e:e+""}function Jd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ec extends Error{constructor(){super(...arguments),Yd(this,"isClipboardPermissionsDeniedError",!0)}}function tc(n,e,t){return(e=nc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nc(n){var e=rc(n,"string");return typeof e=="symbol"?e:e+""}function rc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ri extends Error{constructor(){super(...arguments),tc(this,"isClipboardUnavailableError",!0)}}function ic(n,e,t){return(e=oc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oc(n){var e=ac(n,"string");return typeof e=="symbol"?e:e+""}function ac(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vs extends Error{constructor(){super(...arguments),ic(this,"isPermissionUnsupported",!0)}}function mo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function sc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){mo(o,r,i,a,s,"next",l)}function s(l){mo(o,r,i,a,s,"throw",l)}a(void 0)})}}function vo(n){return pi.apply(this,arguments)}function pi(){return pi=sc(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Vs:t}}),pi.apply(this,arguments)}function fo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ks(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){fo(o,r,i,a,s,"next",l)}function s(l){fo(o,r,i,a,s,"throw",l)}a(void 0)})}}function zs(n){return gi.apply(this,arguments)}function gi(){return gi=Ks(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}lc(n)}),gi.apply(this,arguments)}function lc(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function fC(){return bi.apply(this,arguments)}function bi(){return bi=Ks(function*(){try{var{clipboard:n}=navigator;if(n===void 0)throw new ri;var e=yield vo("clipboard-read");if(e==="granted"){var t=yield n.readText();return t}if(e==="prompt"){try{yield n.readText()}catch{}if(e=yield vo("clipboard-read"),e==="granted"){var r=yield n.readText();return r}}if(e==="prompt"||e==="denied")throw new ec}catch(i){throw i instanceof Vs?new ri:i}throw new ri}),bi.apply(this,arguments)}var Hn;function yn(n,e,t){return(e=uc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uc(n){var e=dc(n,"string");return typeof e=="symbol"?e:e+""}function dc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var cc="table_",Gs="column_",hc=new Set(["in","not","i","ii","k"]),mc=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"]),vc=/[^a-zA-Z0-9_$\-+@]/g,fc=/[^A-Za-z0-9_$]/g,pc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,gc=/[^a-zA-Z0-9_]/g;function bc(n){return n.replace(/[ -]/g,"_")}function yc(n){return n.replace(/\s/g,"_")}class Dt{}Hn=Dt;yn(Dt,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(hc.has(a)||mc.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});yn(Dt,"legalizeTableName",n=>Hn.legalize(n,yc,cc,vc,!1,0));yn(Dt,"makeVariableName",n=>Hn.legalizeTableName(n).replace(gc,"_"));yn(Dt,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Hn.legalizeColumnName(t,r);e.includes(i)&&(i=Gs+r),e.push(i)}),e});yn(Dt,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Hn.legalize(n,bc,Gs,fc,!0,e)});yn(Dt,"isValidTableName",n=>pc.test(n));yn(Dt,"isValidColumnName",n=>Hn.legalizeColumnName(n)===n);class qs extends CustomEvent{constructor(e,t){super(e,t)}}class _e{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{r=!0,o(new ho),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof ho}static isTimedOut(e){return e instanceof Es}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function po(n,e,t){return(e=Cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:e+""}function Sc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class rr{constructor(){po(this,"pending",[]),po(this,"resolved",[])}add(e,t){var r=_e.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}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 pC(n){var e=n;n instanceof CustomEvent&&(e=n.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}class pt{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(!pt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(l<=r&&i<=u)return o;r<=u&&l<=i&&(r=Math.min(r,l),i=Math.max(i,u),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,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<r))if(l<r&&i<u){o[a]=[l,r-1],o.splice(a+1,0,[i+1,u]);break}else r<=l&&u<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,u]}return o}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*gC(n,e){for(var t=n;t<=e;++t)yield t}var bC=" ";class Xs{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 r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}static pluralize(e,t,r){return e===1?t:r??"".concat(t,"s")}}var ir;function tn(n,e,t){return(e=wc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wc(n){var e=Ec(n,"string");return typeof e=="symbol"?e:e+""}function Ec(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xe{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),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"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"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(Xe.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),r=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(r,"m ").concat(i,"s"):r>0?"".concat(r,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var r=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(r==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(r==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}ir=Xe;tn(Xe,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");tn(Xe,"MILLIS_PER_SECOND",1e3);tn(Xe,"NANOS_PER_SECOND",1e9);tn(Xe,"NANOS_PER_MIN",60*ir.NANOS_PER_SECOND);tn(Xe,"NANOS_PER_HOUR",60*ir.NANOS_PER_MIN);tn(Xe,"MILLIS_PER_MIN",60*ir.MILLIS_PER_SECOND);tn(Xe,"MILLIS_PER_HOUR",60*ir.MILLIS_PER_MIN);tn(Xe,"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 Pc(n,e,t){return(e=Tc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tc(n){var e=_c(n,"string");return typeof e=="symbol"?e:e+""}function _c(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xn extends Error{constructor(){super(...arguments),Pc(this,"isInvalid",!0)}}function Zs(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function go(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Oc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){go(o,r,i,a,s,"next",l)}function s(l){go(o,r,i,a,s,"throw",l)}a(void 0)})}}var xc=W.module("useAsyncInterval");function Ic(n,e){var t=Zs(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Oc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(h){xc.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),c=Math.max(0,e-u);r.current=window.setTimeout(a,c)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function or(n){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(n);if(t==null)throw new Error(e);return t}function Dc(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:r=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>gn(n,e,o!=null?{leading:r,trailing:i,maxWait:o}:{leading:r,trailing:i}),[n,e,r,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function Nc(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Mc(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Br(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Ys(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var kc=3500,jc=W.module("useCopyToClipboard");function Lc(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{zs(i).then(()=>{e(!0)}).catch(o=>jc.error("Unable to copy ".concat(i),`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-0FbdKJAa.js","./Plotly-DetVXnE1.js","./plotly-C-Edrc1c.js","./helpers-BosuxZz1.js","./vendor-B6dPaAcV.js","./vendor-V6ynCsSj.css","./MarkdownNotebook-wb8Y8t0p.js","./index-Cyvh6QNX.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-CwMW8ik0.css","./mathjax-CmifxKXU.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
2
+ import{r as m,a0 as gn,bG as Br,I as d,bL as Mu,U as A,K as G,bM as ys,ac as vi,L as Cs,R as Wr,bN as ku,bO as ju,M as ve,H as Ot,bP as Lu,a8 as Au,a9 as Ru,G as Ss,a1 as xn,bQ as Fu,bR as $u,bS as Hu,bT as Bu,bJ as Qn,bU as Wu,a6 as Uu,a5 as Vu,bF as ro,bV as Ku,bW as zu,ad as Qt,aw as io,bX as qn,bY as D,bZ as oo,bK as ye,a3 as Ai,af as ws,b_ as Gu,_ as $n}from"./vendor-B6dPaAcV.js";import{aC as Es,L as W,aZ as Ps,W as Ts,$ as qu,ai as Xu,aj as Zu,ah as Yu,ar as Qu,ad as Ju,aw as ed,M as _s,b as Os,c as xs,aK as td,a_ as nd,a$ as Is,b0 as Ds,b1 as rd,b2 as id,N as bn,aA as od,b3 as ad,b4 as sd,b5 as ld,b6 as ud,b7 as dd,b8 as cd,b9 as hd,ba as md,bb as vd,bc as fd,E as Ns,aY as pd,aV as Ms,aW as gd,a3 as ks,k as bd,e as L,d as fi,bd as yd,be as Cd,au as js,bf as ao,bg as Sd,bh as wd,bi as Ed,bj as Pd,f as Ls,aO as As,bk as Td,bl as Rs,bm as Mn,aU as _d,bn as Od,H as so,bo as Fs,q as lo,bp as $s,bq as xd,K as Id,ak as Dd,br as Nd,C as Md,al as kd,bs as jd,bt as Ld,bu as Ad,bv as Rd,bw as Fd,bx as $d,by as Hd,aQ as Bd,bz as Wd,bA as Ud}from"./index-Cyvh6QNX.js";import{e as De,M as Vd,b as uo,l as at,R as Hs,K as ot,c as Jt,d as co,U as Kd,_ as Bs}from"./monaco-DaE0jI-i.js";var Ws=Object.freeze([]),mC=new Map,Us=()=>{};function vC(n){return Array.isArray(n)?n:[n]}function ni(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function zd(n,e,t){return(e=Gd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gd(n){var e=qd(n,"string");return typeof e=="symbol"?e:e+""}function qd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ho extends Error{constructor(){super(...arguments),zd(this,"isCanceled",!0)}}function Xd(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Zd(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function Zd(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Yd(n,e,t){return(e=Qd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qd(n){var e=Jd(n,"string");return typeof e=="symbol"?e:e+""}function Jd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ec extends Error{constructor(){super(...arguments),Yd(this,"isClipboardPermissionsDeniedError",!0)}}function tc(n,e,t){return(e=nc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nc(n){var e=rc(n,"string");return typeof e=="symbol"?e:e+""}function rc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ri extends Error{constructor(){super(...arguments),tc(this,"isClipboardUnavailableError",!0)}}function ic(n,e,t){return(e=oc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oc(n){var e=ac(n,"string");return typeof e=="symbol"?e:e+""}function ac(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vs extends Error{constructor(){super(...arguments),ic(this,"isPermissionUnsupported",!0)}}function mo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function sc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){mo(o,r,i,a,s,"next",l)}function s(l){mo(o,r,i,a,s,"throw",l)}a(void 0)})}}function vo(n){return pi.apply(this,arguments)}function pi(){return pi=sc(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Vs:t}}),pi.apply(this,arguments)}function fo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ks(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){fo(o,r,i,a,s,"next",l)}function s(l){fo(o,r,i,a,s,"throw",l)}a(void 0)})}}function zs(n){return gi.apply(this,arguments)}function gi(){return gi=Ks(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}lc(n)}),gi.apply(this,arguments)}function lc(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function fC(){return bi.apply(this,arguments)}function bi(){return bi=Ks(function*(){try{var{clipboard:n}=navigator;if(n===void 0)throw new ri;var e=yield vo("clipboard-read");if(e==="granted"){var t=yield n.readText();return t}if(e==="prompt"){try{yield n.readText()}catch{}if(e=yield vo("clipboard-read"),e==="granted"){var r=yield n.readText();return r}}if(e==="prompt"||e==="denied")throw new ec}catch(i){throw i instanceof Vs?new ri:i}throw new ri}),bi.apply(this,arguments)}var Hn;function yn(n,e,t){return(e=uc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uc(n){var e=dc(n,"string");return typeof e=="symbol"?e:e+""}function dc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var cc="table_",Gs="column_",hc=new Set(["in","not","i","ii","k"]),mc=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"]),vc=/[^a-zA-Z0-9_$\-+@]/g,fc=/[^A-Za-z0-9_$]/g,pc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,gc=/[^a-zA-Z0-9_]/g;function bc(n){return n.replace(/[ -]/g,"_")}function yc(n){return n.replace(/\s/g,"_")}class Dt{}Hn=Dt;yn(Dt,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(hc.has(a)||mc.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});yn(Dt,"legalizeTableName",n=>Hn.legalize(n,yc,cc,vc,!1,0));yn(Dt,"makeVariableName",n=>Hn.legalizeTableName(n).replace(gc,"_"));yn(Dt,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Hn.legalizeColumnName(t,r);e.includes(i)&&(i=Gs+r),e.push(i)}),e});yn(Dt,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Hn.legalize(n,bc,Gs,fc,!0,e)});yn(Dt,"isValidTableName",n=>pc.test(n));yn(Dt,"isValidColumnName",n=>Hn.legalizeColumnName(n)===n);class qs extends CustomEvent{constructor(e,t){super(e,t)}}class _e{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{r=!0,o(new ho),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof ho}static isTimedOut(e){return e instanceof Es}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function po(n,e,t){return(e=Cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:e+""}function Sc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class rr{constructor(){po(this,"pending",[]),po(this,"resolved",[])}add(e,t){var r=_e.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}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 pC(n){var e=n;n instanceof CustomEvent&&(e=n.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}class pt{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(!pt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(l<=r&&i<=u)return o;r<=u&&l<=i&&(r=Math.min(r,l),i=Math.max(i,u),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,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<r))if(l<r&&i<u){o[a]=[l,r-1],o.splice(a+1,0,[i+1,u]);break}else r<=l&&u<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,u]}return o}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*gC(n,e){for(var t=n;t<=e;++t)yield t}var bC=" ";class Xs{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 r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}static pluralize(e,t,r){return e===1?t:r??"".concat(t,"s")}}var ir;function tn(n,e,t){return(e=wc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wc(n){var e=Ec(n,"string");return typeof e=="symbol"?e:e+""}function Ec(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xe{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),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"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"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(Xe.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),r=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(r,"m ").concat(i,"s"):r>0?"".concat(r,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var r=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(r==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(r==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}ir=Xe;tn(Xe,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");tn(Xe,"MILLIS_PER_SECOND",1e3);tn(Xe,"NANOS_PER_SECOND",1e9);tn(Xe,"NANOS_PER_MIN",60*ir.NANOS_PER_SECOND);tn(Xe,"NANOS_PER_HOUR",60*ir.NANOS_PER_MIN);tn(Xe,"MILLIS_PER_MIN",60*ir.MILLIS_PER_SECOND);tn(Xe,"MILLIS_PER_HOUR",60*ir.MILLIS_PER_MIN);tn(Xe,"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 Pc(n,e,t){return(e=Tc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tc(n){var e=_c(n,"string");return typeof e=="symbol"?e:e+""}function _c(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xn extends Error{constructor(){super(...arguments),Pc(this,"isInvalid",!0)}}function Zs(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function go(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Oc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){go(o,r,i,a,s,"next",l)}function s(l){go(o,r,i,a,s,"throw",l)}a(void 0)})}}var xc=W.module("useAsyncInterval");function Ic(n,e){var t=Zs(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Oc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(h){xc.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),c=Math.max(0,e-u);r.current=window.setTimeout(a,c)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function or(n){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(n);if(t==null)throw new Error(e);return t}function Dc(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:r=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>gn(n,e,o!=null?{leading:r,trailing:i,maxWait:o}:{leading:r,trailing:i}),[n,e,r,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function Nc(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Mc(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Br(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Ys(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var kc=3500,jc=W.module("useCopyToClipboard");function Lc(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{zs(i).then(()=>{e(!0)}).catch(o=>jc.error("Unable to copy ".concat(i),`
3
3
  `,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},kc)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var Ac=["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 Rc(n){return typeof n=="string"&&Ac.includes(n)}function Qs(n){return n!=null&&Rc(n)?"var(--dh-color-".concat(n,")"):n}var Fc=["color","UNSAFE_style"];function bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bo(Object(t),!0).forEach(function(r){$c(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $c(n,e,t){return(e=Hc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hc(n){var e=Bc(n,"string");return typeof e=="symbol"?e:e+""}function Bc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Wc(n,e){if(n==null)return{};var t,r,i=Uc(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Uc(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var Js=m.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=Wc(n,Fc),o=m.useMemo(()=>fr(fr({},r),{},{color:Qs(t)}),[t,r]);return d.jsx(Mu,fr(fr({},i),{},{ref:e,UNSAFE_style:o}))});Js.displayName="Text";function yo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ht(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yo(Object(t),!0).forEach(function(r){In(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):yo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function In(n,e,t){return(e=Vc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vc(n){var e=Kc(n,"string");return typeof e=="symbol"?e:e+""}function Kc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Co="popper",zc="popper-container",Gc={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(n,e)=>{var t,r,i=(t=ys.Defaults.modifiers)===null||t===void 0||(t=t.preventOverflow)===null||t===void 0||(r=t.fn)===null||r===void 0?void 0:r.call(t,n,e);return i==null?n:(i.styles.maxHeight="".concat(document.documentElement.clientHeight-n.offsets.popper.top-2*e.padding,"px"),i??n)}},flip:{enabled:!1}}};class Ur extends m.Component{constructor(e){super(e),In(this,"element",void 0),In(this,"container",void 0),In(this,"nodeRef",A.createRef()),In(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.updateContainerClassName(e.containerClassName,e.isMaximized),this.container=A.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t,containerClassName:r,isMaximized:i}=this.props,{popper:o}=this.state;(e.containerClassName!==r||e.isMaximized!==i)&&this.updateContainerClassName(r,i),e.isShown!==t&&(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t?this.show():this.hide()})),o&&o.scheduleUpdate()}componentWillUnmount(){this.destroyPopper(!1)}updateContainerClassName(e,t){this.element.className=G(zc,e,{maximized:t})}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var e,t,{popper:r}=this.state,{closeOnBlur:i,referenceObject:o}=this.props;if(!r&&this.container.current!==null){var{options:a,keepInParent:s}=this.props,l=s?Gc:{placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},u=Ht(Ht(Ht({},l),a),{},{modifiers:Ht(Ht(Ht({},l.modifiers),a.modifiers),{},{preventOverflow:Ht(Ht({},(e=l.modifiers)===null||e===void 0?void 0:e.preventOverflow),(t=a.modifiers)===null||t===void 0?void 0:t.preventOverflow)})});document.body.appendChild(this.element);var c=this.getVisibleElement(this.container.current);c==null&&(c=this.container.current);var h=new ys(o||c,this.element,u);h.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(i){var v=this.element.querySelector(".".concat(Co));v instanceof HTMLElement&&!v.contains(document.activeElement)&&v.focus()}}),vi.flushSync(()=>{this.setState({popper:h})})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),vi.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:r}=this.props;e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||(r==null||r(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:r,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return d.jsx(Ps,{isPortal:!0,children:d.jsx(Cs,{in:a,timeout:r,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:G(Co,{interactive:i},e),onBlur:this.handleBlur,tabIndex:o?-1:void 0,role:"presentation",children:d.jsxs("div",{className:"popper-content",children:[t,d.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return d.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Wr.createPortal(this.renderContent(),this.element)})}}In(Ur,"defaultProps",{options:{},className:"",containerClassName:"",isMaximized:!1,timeout:Ts.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,referenceObject:null,"data-testid":void 0});var yi;function So(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function qc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?So(Object(t),!0).forEach(function(r){bt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):So(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bt(n,e,t){return(e=Xc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xc(n){var e=Zc(n,"string");return typeof e=="symbol"?e:e+""}function Zc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Yc=W.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),bt(this,"container",void 0),bt(this,"popper",void 0),bt(this,"parent",void 0),bt(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=A.createRef(),this.popper=A.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:r}=t,{isShown:i}=this.state;i!==r&&(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){Yc.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,r=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&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(he.shownTooltipCount>0||Date.now()-he.lastHiddenTime<he.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}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(),vi.flushSync(()=>{this.setState({isShown:!0})});var{interactive:r}=this.props;r&&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:r,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=qc({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Ur,{className:G(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:r,children:d.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}yi=he;bt(he,"defaultTimeout",500);bt(he,"defaultReshowTimeout",100);bt(he,"triggerReshowThreshold",300);bt(he,"shownTooltipCount",0);bt(he,"lastHiddenTime",Date.now());bt(he,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:yi.defaultReshowTimeout,timeout:yi.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var Qc=W.module("ThemeProvider"),Ri=m.createContext(null);Ri.displayName="ThemeContext";function yC(n){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:r=qu,children:i}=n,o=m.useMemo(()=>Xu(),[]),[a,s]=m.useState(null),[l,u]=m.useState(Zu),c=m.useMemo(()=>e==null?null:Yu(l,{base:o,custom:e??[]}),[o,l,e]),h=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(c==null||e==null)){Qu(r);var f=Ju(r);Qc.debug2("updateThemePreloadData:",{active:c.map(p=>p.themeKey),custom:e.map(p=>p.themeKey),preloadStyleContent:f,selectedThemeKey:l}),ed({themeKey:l,preloadStyleContent:f})}},[c,l,e,r]),m.useEffect(()=>{s({activeThemes:c,selectedThemeKey:l,themes:h,setSelectedThemeKey:u})},[c,l,h]),t&&c==null?null:d.jsxs(d.Fragment,{children:[c==null?null:d.jsx(d.Fragment,{children:c.map(v=>d.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:d.jsx(Ri.Provider,{value:a,children:d.jsx(Ps,{children:i})})]})}function el(){return or(Ri,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var Jc=["color","UNSAFE_style"];function wo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(r){eh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function eh(n,e,t){return(e=th(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function th(n){var e=nh(n,"string");return typeof e=="symbol"?e:e+""}function nh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function rh(n,e){if(n==null)return{};var t,r,i=ih(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function ih(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var tl=m.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=rh(n,Jc),o=m.useMemo(()=>pr(pr({},r),{},{color:Qs(t)}),[t,r]);return d.jsx(ku,pr(pr({},i),{},{ref:e,UNSAFE_style:o}))});tl.displayName="Heading";function oh(n){var{children:e,className:t,style:r,"data-testid":i}=n;return d.jsx("div",{className:G("btn-group",t),style:r,role:"group","data-testid":i,children:e})}var ah=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Eo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Po(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eo(Object(t),!0).forEach(function(r){sh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Eo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function sh(n,e,t){return(e=lh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lh(n){var e=uh(n,"string");return typeof e=="symbol"?e:e+""}function uh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function dh(n,e){if(n==null)return{};var t,r,i=ch(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function ch(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function hh(n,e){switch(n){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 G("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function mh(n){switch(n){case"group-end":return G("pl-2","pr-3")}}var ae=A.forwardRef((n,e)=>{var{kind:t,variant:r,type:i="button",tooltip:o,icon:a,disabled:s=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:h,onMouseUp:v,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,className:b,style:w,children:E,tabIndex:P,"data-testid":F,"aria-label":Z}=n,re=dh(n,ah),{UNSAFE_className:Y}=ju({},"button"),k;r&&(k=mh(r));var B;a&&(B=A.isValidElement(a)?a:d.jsx(ve,{icon:a}));var Q=B!=null&&E==null,q=hh(t,Q),R;o!==void 0&&(R=typeof o=="string"?d.jsx(he,{children:o}):o);var U=Z;Z===void 0&&Q&&o!=null&&typeof o=="string"&&(U=o);var X=d.jsxs("button",Po(Po({"data-testid":F,ref:e,type:i,className:G("btn",q,k,{active:l},b,Y),onClick:u,onContextMenu:c,onMouseUp:v,onMouseDown:h,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,style:w,disabled:s,tabIndex:P,"aria-label":U},re),{},{children:[a&&B,E,o!=null&&!s&&R]}));return s&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[X,R]}):X});ae.displayName="Button";function nl(n){var{className:e,children:t,"data-testid":r}=n;return d.jsx("div",{className:G("modal-footer",e),"data-testid":r,children:t})}function Jn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:c="Discard",isConfirmDanger:h=!1,children:v,"data-testid":f}=n,p=m.useRef(null),g=m.useRef(null),b=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),w=m.useCallback(()=>{var P;(P=p.current)===null||P===void 0||P.focus()},[]),E="";return e&&(E=typeof r=="function"?r():r),d.jsxs(_s,{isOpen:e,onOpened:w,children:[d.jsx(Os,{closeButton:!1,children:t}),d.jsx(xs,{children:E}),d.jsxs(nl,{children:[s&&d.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[d.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),d.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&d.jsx(ae,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:c}),i&&d.jsx(ae,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),d.jsxs(oh,{children:[d.jsx(ae,{kind:h?"danger":"primary",onClick:b,ref:p,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:u}),v]})]})]})}function vh(n,e,t){return(e=fh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fh(n){var e=ph(n,"string");return typeof e=="symbol"?e:e+""}function ph(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ii(n){return n.then!==void 0}class Pe{static disableAllActions(){Pe.actionsDisabled=!0}static enableAllActions(){Pe.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r: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(Pe.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Pe.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Pe.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],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&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var a=(i+t*o+r.length)%r.length,s=r[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}vh(Pe,"actionsDisabled",!1);var To=W.module("GlobalContextAction");class gh 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:r}=this.props;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),To.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Pe.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;To.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class bh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],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(gh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));r.push(s)}}return r}}function rl(n,e,t){return(e=yh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yh(n){var e=Ch(n,"string");return typeof e=="symbol"?e:e+""}function Ch(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var gr=W.module("ContextActions");class ne extends m.Component{static triggerMenu(e,t,r,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:r,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),rl(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=A.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=>!ii(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!ii(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:r}}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 r=e.target,i=function(){var{classList:u}=r,c=t.find(h=>u.contains(h));if(c!==void 0)return gr.debug2('Contextmenu event ignored based on the target className "'.concat(c,'"')),{v:void 0};r=r.parentElement},o;r!=null;)if(o=i(),o)return o.v}if(Pe.isContextActionEvent(e)||(e.contextActions=[]),!!Pe.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>ii(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}gr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,r=0;r<t.length;r+=1){var i=t[r];if(!Pe.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;gr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),gr.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(bh,{actions:t})})}}rl(ne,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var il=A.forwardRef((n,e)=>{var t,r,{closeMenu:i,children:o,menuItem:a,onMenuItemClick:s,onMenuItemMouseMove:l,onMenuItemContextMenu:u,isKeyboardSelected:c=!1,isMouseSelected:h=!1,"data-testid":v}=n,f=m.useCallback(q=>{s(a,q)},[a,s]),p=m.useCallback(q=>{l(a,q)},[a,l]),g=m.useCallback(q=>{u(a,q)},[a,u]);function b(q,R,U){if(typeof q.type=="string")return q;var X={menuItem:a,closeMenu:i,isKeyboardSelected:c,isMouseSelected:h,iconElement:R,displayShortcut:U,"data-testid":v};return A.cloneElement(q,{forwardedProps:X})}var w=(t=a.shortcutText)!==null&&t!==void 0?t:(r=a.shortcut)===null||r===void 0?void 0:r.getDisplayText(),E=null;if(a.icon){var P=a.icon;if(A.isValidElement(P))E=P;else{var F;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(F={color:a.iconColor}),E=d.jsx(ve,{icon:P,style:F})}}var Z=null,re=!!o;a.actions&&(Z=d.jsx(ve,{icon:td}));var Y=null;if(a.menuElement)Y=d.jsx("div",{className:"custom-menu-item",onMouseMove:p,children:b(a.menuElement,E,w)});else{var k,B=a.disabled,Q=a.iconOutline;Y=d.jsx("button",{type:"button",className:G("btn-context-menu",{disabled:B},{active:(re||h)&&(B===void 0||!B)},{"keyboard-active":c&&(B===void 0||!B)}),onClick:f,onMouseMove:p,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:G("icon",{outline:Q}),children:E}),d.jsx("span",{className:"title",children:a.title}),w!==void 0&&d.jsx("span",{className:"shortcut",children:w}),Z&&d.jsx("span",{className:G("submenu-indicator",{disabled:B}),children:Z})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,Y]})});il.displayName="ContextMenuItem";var ol=A.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o=!1,inputClassName:a,isInvalid:s=!1,labelClassName:l,name:u,onChange:c,"data-testid":h}=n,[v]=m.useState(Ot()),f=Ys(e);m.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var p=m.useCallback(g=>{f.current&&(f.current.indeterminate=t===null),c&&c(g)},[f,t,c]);return d.jsxs("div",{className:G("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:G("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:u,onChange:p,"data-testid":h}),d.jsx("label",{className:G("custom-control-label",l),htmlFor:v,children:r})]})});ol.displayName="Checkbox";function Mr(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function al(n){return Mr(n)&&al(n.WrappedComponent)?!0:n.prototype!=null&&n.prototype.isReactComponent!=null}function Sh(n){return!Mr(n)&&"$$typeof"in n&&n.$$typeof===Lu.ForwardRef}function sl(n){return al(n)||Sh(n)}var wh=["copy","tooltip","children"];function _o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_o(Object(t),!0).forEach(function(r){Eh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_o(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Eh(n,e,t){return(e=Ph(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ph(n){var e=Th(n,"string");return typeof e=="symbol"?e:e+""}function Th(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _h(n,e){if(n==null)return{};var t,r,i=Oh(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Oh(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var xo="Copy";function ll(n){var{copy:e,tooltip:t=xo,children:r}=n,i=_h(n,wh),[o,a]=Lc(),s=o?"Copied":t;return d.jsxs(Au,Oo(Oo({},i),{},{"aria-label":s,onPress:()=>{a(typeof e=="function"?e():e)},children:[d.jsx(Ru,{UNSAFE_className:r==null?"action-button-icon-with-tooltip":void 0,children:d.jsx(ve,{icon:o?nd:Is})}),r!=null&&d.jsx(Js,{children:r}),(r==null||s!==xo)&&d.jsx(he,{children:s})]}))}ll.displayName="CopyButton";function Io(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Io(Object(t),!0).forEach(function(r){Zn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Io(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zn(n,e,t){return(e=Ih(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ih(n){var e=Dh(n,"string");return typeof e=="symbol"?e:e+""}function Dh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ul extends m.PureComponent{constructor(e){var t;super(e),Zn(this,"container",void 0),Zn(this,"oldFocus",void 0),Zn(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=A.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:r}=e,i=(t=r.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=Pe.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:Pe.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=Pe.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Pe.getNextMenuItem(i??0,1,t)),r!==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:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(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,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,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(il,{isKeyboardSelected:r===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:xh({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Zn(ul,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function Do(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function No(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Do(Object(t),!0).forEach(function(r){Dn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Do(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Dn(n,e,t){return(e=Nh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nh(n){var e=Mh(n,"string");return typeof e=="symbol"?e:e+""}function Mh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ar extends m.PureComponent{constructor(e){super(e),Dn(this,"container",void 0),Dn(this,"parent",void 0),Dn(this,"popper",void 0),Dn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=A.createRef(),this.parent=null,this.popper=A.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:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=No({placement:"bottom"},s),a=No({separateKeyboardMouse:!0},a),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Ur,{ref:this.popper,options:s,className:G("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(ul,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}Dn(ar,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Kt(n,e,t){return(e=kh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kh(n){var e=jh(n,"string");return typeof e=="symbol"?e:e+""}function jh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mo=W.module("Shortcut"),I=function(n){return n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n}({}),O=function(n){return n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12",n}({}),Lh=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 Se extends Ss{static isAllowedKey(e){return Object.values(O).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!Se.isMacPlatform&&e.metaKey||!Se.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Lh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case I.CTRL:t.ctrlKey=!0;break;case I.ALT:case I.OPTION:t.altKey=!0;break;case I.CMD:t.metaKey=!0;break;case I.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:r}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!Se.isAllowedKey(t)&&Se.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):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 r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.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?"":Se.isMacPlatform?Se.getMacDisplayText(e):Se.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),Kt(this,"id",void 0),Kt(this,"name",void 0),Kt(this,"tooltip",void 0),Kt(this,"isEditable",void 0),Kt(this,"defaultKeyState",void 0),Kt(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=Se.isMacPlatform,u=l?i:r;this.defaultKeyState=Se.createKeyState(u),this.keyState=this.defaultKeyState}getDisplayText(){return Se.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Se.isValidKeyState(e)?(Mo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new qs("onUpdate",{detail:this}))):Mo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Se.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Se.NULL_KEY_STATE)}isNull(){return Se.doKeyStatesMatch(this.keyState,Se.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Se.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Se.getKeyStateFromEvent(e))}}Kt(Se,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Kt(Se,"isMacPlatform",Pe.isMacPlatform());function ko(n,e,t){return(e=Ah(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ah(n){var e=Rh(n,"string");return typeof e=="symbol"?e:e+""}function Rh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var jo=W.module("ShortcutRegistry");class Fh extends Ss{constructor(){super(...arguments),ko(this,"shortcutMap",new Map),ko(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new Se(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return jo.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;jo.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new qs("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[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 ce=Object.freeze(new Fh),Xt={COPY:ce.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[I.CTRL,O.C],macShortcut:[I.CMD,O.C],isEditable:!1}),PASTE:ce.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[I.CTRL,O.V],macShortcut:[I.CMD,O.V],isEditable:!1}),SAVE:ce.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[I.CTRL,O.S],macShortcut:[I.CMD,O.S],isEditable:!1}),SELECT_ALL:ce.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[I.CTRL,O.A],macShortcut:[I.CMD,O.A],isEditable:!1}),REOPEN_CLOSED_PANEL:ce.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[I.ALT,I.SHIFT,O.T],macShortcut:[I.OPTION,I.SHIFT,O.T],isEditable:!0}),LINKER:ce.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[I.CTRL,O.L],macShortcut:[I.CMD,O.L]}),LINKER_CLOSE:ce.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[O.ESCAPE],macShortcut:[O.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:ce.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[I.CTRL,I.ALT,O.I],macShortcut:[I.CMD,I.SHIFT,O.I],isEditable:!0}),EXPORT_LOGS:ce.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[I.CTRL,I.ALT,I.SHIFT,O.L],macShortcut:[I.CMD,I.OPTION,I.SHIFT,O.L],isEditable:!0}),OPEN_DASHBOARD_LIST:ce.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[I.ALT,I.SHIFT,O.D],macShortcut:[I.OPTION,I.SHIFT,O.D],isEditable:!0}),NEXT:ce.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[O.ENTER],macShortcut:[O.ENTER],isEditable:!1}),PREVIOUS:ce.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[I.SHIFT,O.ENTER],macShortcut:[I.SHIFT,O.ENTER],isEditable:!1}),UNDO:ce.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[I.CTRL,O.Z],macShortcut:[I.CMD,O.Z],isEditable:!1}),REDO:ce.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[I.CTRL,I.SHIFT,O.Z],macShortcut:[I.CMD,I.SHIFT,O.Z],isEditable:!1})};function Ci(n,e,t){return(e=$h(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $h(n){var e=Hh(n,"string");return typeof e=="symbol"?e:e+""}function Hh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vr extends m.PureComponent{constructor(e){super(e),Ci(this,"inputField",void 0),Ci(this,"searchChangeSelection",void 0),this.inputField=A.createRef(),this.searchChangeSelection=A.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 r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var{value:e,placeholder:t,endPlaceholder:r,onBlur:i,onChange:o,className:a,disabled:s,matchCount:l,id:u,onKeyDown:c,"data-testid":h,cursor:v}=this.props,f,p=[{action:()=>v==null?void 0:v.next("forward"),shortcut:Xt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:Xt.PREVIOUS}];return v&&l>1?f=d.jsxs(d.Fragment,{children:[d.jsx(ae,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:Ds,tooltip:"Previous match (".concat(Xt.PREVIOUS.getDisplayText(),")")}),d.jsxs("span",{className:"search-change-text",children:[v.index!==void 0&&"".concat(v.index+1," of "),l]}),d.jsx(ae,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("forward")},icon:rd,tooltip:"Next match (".concat(Xt.NEXT.getDisplayText(),")")})]}):f=l>0&&d.jsx("span",{className:"search-match",children:l}),d.jsxs("div",{className:G("search-group",a),children:[d.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:c,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:u,"data-testid":h}),l!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),d.jsx(ne,{actions:p})]}):d.jsxs("span",{className:"search-end-content",children:[(r??"")!==""&&e===""&&d.jsx("span",{className:"search-end-placeholder",children:r}),d.jsx(ve,{icon:id})]})]})}}Ci(Vr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function dl(n,e,t){return(e=Bh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bh(n){var e=Wh(n,"string");return typeof e=="symbol"?e:e+""}function Wh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cl extends m.PureComponent{constructor(e){super(e),dl(this,"searchInput",void 0),this.searchInput=A.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=gn(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:r,id:i,"data-testid":o}=this.props,{value:a}=this.state;return d.jsx(Vr,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}dl(cl,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function hl(n,e,t){return(e=Uh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uh(n){var e=Vh(n,"string");return typeof e=="symbol"?e:e+""}function Vh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Kh=W.module("ItemListItem");class Kr extends m.Component{static handleKeyDown(){return Kh.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),hl(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=A.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":a}=this.props;return d.jsx("div",{className:G("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:Kr.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})}}hl(Kr,"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 Ir;function Lo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ao(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lo(Object(t),!0).forEach(function(r){ht(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Lo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ht(n,e,t){return(e=zh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zh(n){var e=Gh(n,"string");return typeof e=="symbol"?e:e+""}function Gh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ro=W.module("ItemList"),Fo=5;class Ct extends m.PureComponent{static renderItem(e){var t,r,{item:i}=e;return d.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r: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",xn((i,o)=>pt.isSelected(o,i),{max:Ct.CACHE_SIZE})),ht(this,"getCachedItem",xn((i,o,a,s,l,u,c,h)=>{var v=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:c});return d.jsx(Kr,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:c,children:v},o)},{max:Ct.CACHE_SIZE})),ht(this,"getOuterElement",xn(i=>{var o=A.forwardRef((a,s)=>d.jsx("div",Ao({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),ht(this,"getInnerElement",xn(()=>{var i=A.forwardRef((o,a)=>d.jsx("div",Ao({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),ht(this,"getItemData",xn((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=A.createRef(),this.listContainer=A.createRef();var{isStickyBottom:t,selectedRanges:r}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:r,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(),r!==e.selectedRanges&&r!==u)this.setSelectedRanges(r);else if(u!==t.selectedRanges){var{onSelectionChange:c}=this.props;c(u)}if(o!==t.focusIndex){var{onFocusChange:h}=this.props;h(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:r}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:r}=this.state,i=pt.isSelected(r,e),o=i||Pe.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:pt.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.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){Ro.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){Ro.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:u}=this.state;if(!(a==null||o)){var c=Math.abs(t.clientX-(l??0)),h=Math.abs(t.clientY-(u??0));c>Fo&&h>Fo&&this.setState({isDragging:!0}),(r||a===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,s)&&!Pe.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Pe.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,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=Pe.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,r),!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:r,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=r-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,r-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:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}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,r){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&&r?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){pt.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:pt.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){pt.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:pt.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);r(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:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:u}=this.state;if(t<o||t>=o+i.length)return null;var c=i[t-o];return this.getCachedItem(t,t,c,t===l&&!s,this.getItemSelected(t,u),a,r,s)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return d.jsx(Fu,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:c,height:h}=u;return d.jsx($u,{className:"item-list-scroll-pane",height:h,width:c,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":a,children:this.renderInnerElement})}})}}Ir=Ct;ht(Ct,"CACHE_SIZE",1e3);ht(Ct,"DEFAULT_ROW_HEIGHT",20);ht(Ct,"DEFAULT_OVERSCAN",10);ht(Ct,"defaultProps",{offset:0,items:[],rowHeight:Ir.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ir.DEFAULT_OVERSCAN,renderItem:Ir.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var qh=W.module("ErrorBoundary");class Xh extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;qh.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??d.jsx("div",{className:t,children:d.jsx(bn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function Zh(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=n;return d.jsx("button",{type:"button",className:G("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:d.jsx("div",{className:"handle"})})}var Yh=["classNames","timeout","children","onEnter"];function $o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ho(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$o(Object(t),!0).forEach(function(r){Qh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$o(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qh(n,e,t){return(e=Jh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jh(n){var e=em(n,"string");return typeof e=="symbol"?e:e+""}function em(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function tm(n,e){if(n==null)return{};var t,r,i=nm(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function nm(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var rm={display:"contents"};function CC(n){var{classNames:e,timeout:t=Ts.transitionMs,children:r,onEnter:i}=n,o=tm(n,Yh),a=m.useRef(null),s=m.useCallback(u=>{var c=a.current;c&&(i==null||i(c,u))},[i]),l=m.useCallback(u=>{a.current=u==null?void 0:u.firstElementChild},[]);return d.jsx(Cs,Ho(Ho({nodeRef:a,timeout:t,classNames:G("fade",e),onEnter:s},o),{},{children:d.jsx("div",{ref:l,style:rm,children:r})}))}var im=["children","className","isInvalid","onChange","data-testid"];function Bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bo(Object(t),!0).forEach(function(r){om(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function om(n,e,t){return(e=am(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function am(n){var e=sm(n,"string");return typeof e=="symbol"?e:e+""}function sm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function lm(n,e){if(n==null)return{};var t,r,i=um(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function um(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var ml=A.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":a}=n,s=lm(n,im),l=Ys(e),u=m.useCallback(c=>{o(c.target.value)},[o]);return d.jsx("select",Wo(Wo({ref:l,className:G("custom-select",r,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});ml.displayName="Select";var Fi=A.createContext(new Map);Fi.displayName="XComponentMapContext";var SC=Fi.Provider;function dm(n){var e,t=m.useContext(Fi);return(e=t.get(n))!==null&&e!==void 0?e:n.Original}function Uo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Uo(Object(t),!0).forEach(function(r){cm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Uo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function cm(n,e,t){return(e=hm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hm(n){var e=mm(n,"string");return typeof e=="symbol"?e:e+""}function mm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vl(n){var e,t;function r(i,o){var a=dm(t);return sl(n)?d.jsx(a,oi(oi({},i),{},{ref:o})):d.jsx(a,oi({},i))}return r.displayName="XComponent(".concat((e=n.displayName)!==null&&e!==void 0?e:n.name,")"),t=m.forwardRef(r),t.Original=n,t.isXComponent=!0,t}function vm(){return or(od,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function fl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function pl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function wC(n){return fl(n)||pl(n)}var gl=m.createContext(null);gl.displayName="ObjectFetcherContext";function EC(n){if(pl(n))return{id:n.id,type:n.type};if(fl(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function fm(n){var e,t;return{type:(e=n.type)!==null&&e!==void 0?e:"",name:(t=n.title)!==null&&t!==void 0?t:n.name,id:n.id}}function PC(){return or(gl,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var $i=Object.freeze({}),pm=new Map,TC=n=>n.api,_C=n=>n.user,bl=n=>n.storage,yl=n=>bl(n).commandHistoryStorage,Cl=n=>bl(n).fileStorage,gm=n=>n.defaultWorkspaceSettings,Sl=n=>{var{workspace:e}=n;return e},$e=Hu(n=>{var e,t,r=(e=(t=Sl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=gm(n),o=Bu({},i,r,(a,s)=>{if(Array.isArray(a)&&Array.isArray(s))return s});return o}),OC=n=>n.defaultWorkspaceSettings,xC=n=>$e(n).defaultDateTimeFormat,IC=n=>{var e;return(e=$e(n).defaultDecimalFormatOptions)!==null&&e!==void 0?e:$i},DC=n=>{var e;return(e=$e(n).defaultIntegerFormatOptions)!==null&&e!==void 0?e:$i},NC=n=>{var e;return(e=$e(n).formatter)!==null&&e!==void 0?e:[]},bm=n=>$e(n).timeZone,MC=n=>$e(n).showTimeZone,kC=n=>$e(n).showTSeparator,jC=n=>$e(n).truncateNumbersWithPound,LC=n=>$e(n).showEmptyStrings,AC=n=>$e(n).showNullStrings,RC=n=>$e(n).showExtraGroupColumn,FC=n=>$e(n).shortcutOverrides,$C=n=>$e(n).webgl,HC=n=>$e(n).webglEditable,wl=n=>{var e;return(e=$e(n).notebookSettings)!==null&&e!==void 0?e:$i},BC=n=>n.activeTool,ym=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:pm};function Vo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Lt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vo(Object(t),!0).forEach(function(r){Cm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Cm(n,e,t){return(e=Sm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sm(n){var e=wm(n,"string");return typeof e=="symbol"?e:e+""}function wm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var WC=n=>({type:hd,payload:n}),UC=n=>({type:ld,payload:n}),El=n=>({type:vd,payload:n}),VC=n=>({type:fd,payload:n}),KC=n=>({type:md,payload:n}),zC=n=>({type:dd,payload:n}),GC=n=>({type:cd,payload:n}),Em=n=>(e,t)=>{e(El(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i==null?void 0:i.save(n)},Pm=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=Lt(Lt({},r),{},{data:Lt(Lt(Lt({},i),n),{},{settings:Lt(Lt({},i==null?void 0:i.settings),n.settings)})});return e(Em(o))},Tm=n=>(e,t)=>{var{notebookSettings:r}=$e(t()),i=Lt(Lt({},r),n);return e(_m({notebookSettings:i}))},_m=n=>e=>e(Pm({settings:n})),qC=n=>({type:ad,payload:n}),XC=n=>({type:sd,payload:n}),ZC=n=>({type:ud,payload:n});function Ko(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function zo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ko(Object(t),!0).forEach(function(r){Om(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ko(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Om(n,e,t){return(e=xm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xm(n){var e=Im(n,"string");return typeof e=="symbol"?e:e+""}function Im(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Dm(n){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 r=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 n:{var{id:o,payload:a}=i;return t&&Qn({payload:a},{payload:r[o]})?r:zo(zo({},r),{},{[o]:a})}default:return r}}}function Pl(n){var{type:e}=n,t=vm();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:gd});case t.VariableType.FIGURE:return d.jsx(ve,{icon:Ms});case t.VariableType.PANDAS:return d.jsx(ve,{icon:pd});default:return d.jsx(ve,{icon:Ns})}}function Go(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Nm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Go(o,r,i,a,s,"next",l)}function s(l){Go(o,r,i,a,s,"throw",l)}a(void 0)})}}function Tl(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=el();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=Nm(function*(){if(e!=null&&o!=null){var u=yield De.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:r!=null?{__html:r}:void 0})}class _l{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class kr{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)?[]:Wu.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"),r="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(r,":").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 kr.isTableType(e,t)||kr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function Mm(n){var{children:e}=n;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 Si(n,e,t){return(e=km(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function km(n){var e=jm(n,"string");return typeof e=="symbol"?e:e+""}function jm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ol extends m.Component{constructor(e){super(e),Si(this,"timer",void 0),Si(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:r}=this.state;return d.jsx("div",{className:G("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(ks,{className:"ml-2"}),"Running... ",Xe.formatElapsedTime(r)," ",d.jsx(ae,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:bd,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Si(Ol,"defaultProps",{disabled:!1});function Yn(n,e,t){return(e=Lm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lm(n){var e=Am(n,"string");return typeof e=="symbol"?e:e+""}function Am(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jn extends m.PureComponent{constructor(e){super(e),Yn(this,"mouseX",void 0),Yn(this,"mouseY",void 0),Yn(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)>=jn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=jn.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:r}=this.props;L(r);var i=r.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:G("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?fi:yd,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")}}Yn(jn,"defaultProps",{message:""});Yn(jn,"mouseDragThreshold",5);var xl=m.memo(n=>{var{item:e}=n,{startTime:t,serverStartTime:r,serverEndTime:i}=e,o=m.useMemo(()=>{var c;return(c=e.endTime)!==null&&c!==void 0?c:Date.now()},[e.endTime]),a=Xe.formatConvertedDuration(t,o),s=!!a,l=null;r!=null&&i!=null&&(l=Xe.formatConvertedDuration(r,i,"ns"));var u=!!l;return d.jsxs(d.Fragment,{children:[d.jsx(tl,{children:"Execution Info"}),d.jsx(Uu,{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})]})]})})]})});xl.displayName="ConsoleHistoryItemTooltip";var Rm=n=>{if((n==null?void 0:n.command)==null)return null;var e=n.command?n.command.split(`
5
5
  `).length:0;return e>2?null:"console-history-actions-".concat(e)},Il=m.memo(n=>{var{item:e,onCommandSubmit:t,handleTooltipVisible:r}=n,i=m.useMemo(()=>Rm(e),[e]);return d.jsxs("div",{className:G("console-history-actions",i),children:[e.command!=null&&d.jsx(ll,{copy:e.command}),d.jsx(ae,{icon:Cd,kind:"inline",onClick:()=>{var o;return t((o=e.command)!==null&&o!==void 0?o:"")},tooltip:"Rerun",children:null}),d.jsx(Vu,{variant:"info",onOpenChange:r,UNSAFE_className:"console-history-item-contextual-help",children:d.jsx(xl,{item:e})})]})});Il.displayName="ConsoleHistoryItemActions";function Fm(n,e,t){return(e=$m(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $m(n){var e=Hm(n,"string");return typeof e=="symbol"?e:e+""}function Hm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qo=W.module("ConsoleHistoryItem");class Dl 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){qo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(qo.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{isTooltipVisible:e}=this.state,{disabled:t,item:r,language:i,iconForType:o,onCommandSubmit:a}=this.props,{disabledObjects:s,result:l}=r,u=r.command!=null&&r.command!=="",c=null;u&&(c=d.jsxs("div",{className:G("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(Tl,{language:i,children:r.command}),d.jsx(Il,{item:r,onCommandSubmit:a,handleTooltipVisible:k=>this.setState({isTooltipVisible:k})})]})]}));var h=[],v=!1;if(l){var{error:f,message:p,changes:g}=l;if(g){var{created:b,updated:w}=g;[...b,...w].forEach(k=>{v=!0;var{title:B}=k,Q="".concat(B),q=t===void 0||t||(s??[]).indexOf(Q)>=0,R=d.jsx(ae,{kind:"primary",onClick:()=>this.handleObjectClick(k),className:"btn-console-object",disabled:q,icon:o(k.type),children:B},Q);h.push(R)})}if(f!=null&&!u){var E,P="".concat((E=f.message)!==null&&E!==void 0?E:f);P||(P=f);var F=d.jsx(jn,{message:P},"result-error");h.push(F)}if(p!==void 0&&p!==""){var Z=d.jsx("div",{className:"log-message",children:p},"log-message");h.push(Z)}}else{v=!0;var re=d.jsx(Ol,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");h.push(re)}var Y=null;return h.length>0&&(Y=d.jsx(Mm,{children:h})),d.jsxs("div",{className:G("console-command-result",{"console-result-buttons":v}),children:[c,Y]})}}Fm(Dl,"defaultProps",{disabled:!1});function Bm(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var Wm=A.forwardRef(function(e,t){for(var{disabled:r=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l,onCommandSubmit:u}=e,c=[],h=0;h<i.length;h+=1){var v=i[h],f=d.jsx(Dl,{disabled:r,item:v,openObject:a,language:o,supportsType:s,iconForType:l,onCommandSubmit:u},Bm(h,v));c.push(f)}return d.jsx("div",{ref:t,className:"container-fluid console-history",children:c})}),Um={name:"Console",CLEAR:ce.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[I.CTRL,O.L],macShortcut:[I.CTRL,O.C]}),FOCUS_HISTORY:ce.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[I.CTRL,O.H],macShortcut:[I.CTRL,I.OPTION,O.H]})},Vm={name:"Command History",FOCUS_HISTORY:ce.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[I.CTRL,O.H],macShortcut:[I.CTRL,I.OPTION,O.H]}),SEND_TO_CONSOLE:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[O.ENTER],macShortcut:[O.ENTER]}),SEND_TO_NOTEBOOK:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[I.CTRL,O.ENTER],macShortcut:[I.CMD,O.ENTER]}),RUN:ce.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[I.ALT,O.R],macShortcut:[I.OPTION,O.R]})},Km={name:"Notebook",RUN:ce.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[I.ALT,O.R],macShortcut:[I.OPTION,O.R]}),RUN_SELECTED:ce.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[I.ALT,I.SHIFT,O.R],macShortcut:[I.OPTION,I.SHIFT,O.R]}),FIND:ce.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[I.CTRL,O.F],macShortcut:[I.CMD,O.F],isEditable:!1}),MINIMAP:ce.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[I.ALT,O.M],macShortcut:[I.OPTION,O.M]}),WORDWRAP:ce.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[I.ALT,O.Z],macShortcut:[I.OPTION,O.Z]})},Ke={CONSOLE:Um,COMMAND_HISTORY:Vm,NOTEBOOK:Km};const Ie=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),zm="var(--dh-color-editor-bg)",Gm="var(--dh-color-editor-fg)",qm="var(--dh-color-editor-string)",Xm="var(--dh-color-editor-delimiter)",Zm="var(--dh-color-editor-predefined)",Ym="var(--dh-color-editor-keyword)",Qm="var(--dh-color-editor-storage)",Jm="var(--dh-color-editor-number)",ev="var(--dh-color-editor-operator)",tv="var(--dh-color-editor-identifier)",nv="var(--dh-color-editor-comment)",wi={"error-foreground":"var(--dh-color-editor-error-fg)",background:zm,foreground:Gm,"line-height":"19px",string:qm,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:Xm,predefined:Zm,keyword:Ym,storage:Qm,number:Jm,operator:ev,identifier:tv,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:nv,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)","diff-editor-inserted-text-background":"var(--dh-color-editor-diff-inserted-text-bg)","diff-editor-removed-text-background":"var(--dh-color-editor-diff-removed-text-bg)","diff-editor-inserted-line-background":"var(--dh-color-editor-diff-inserted-line-bg)","diff-editor-removed-line-background":"var(--dh-color-editor-diff-removed-line-bg)"};var rv="python",iv={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/}}},ov={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"]]}},av={id:rv,conf:iv,language:ov},sv="groovy",lv={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/}}},uv={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"]]}},dv={id:sv,conf:lv,language:uv},cv="scala",hv={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>))/}}},mv={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"]]}},vv={id:cv,conf:hv,language:mv},fv="deephavenDb",pv={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/}}},gv={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"]]}},bv={id:fv,conf:pv,language:gv},yv="log",Cv={},Sv={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},wv={id:yv,conf:Cv,language:Sv},Ev={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 Xo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Pv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Xo(o,r,i,a,s,"next",l)}function s(l){Xo(o,r,i,a,s,"throw",l)}a(void 0)})}}function en(n,e,t){return(e=Tv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tv(n){var e=_v(n,"string");return typeof e=="symbol"?e:e+""}function _v(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=W.module("MonacoCompletionProvider");class H extends m.PureComponent{static initRuff(){return Pv(function*(){if(H.isRuffEnabled)return H.initRuffPromise||(H.initRuffPromise=Ku({}).then(()=>{lt.debug("Initialized Ruff",ro.version()),H.isRuffInitialized=!0,H.updateRuffWorkspace()})),H.initRuffPromise})()}static updateRuffWorkspace(){if(H.isRuffInitialized){var e=console.log;try{console.log=()=>{},H.ruffWorkspace=new ro(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(r=>r.code==null):t}static lintAllPython(){if(!H.isRuffEnabled){De.removeAllMarkers("ruff");return}De.getModels().filter(e=>e.getLanguageId()==="python").forEach(H.lintPython)}static lintPython(e){if(H.isRuffEnabled&&H.ruffWorkspace){var t=H.getDiagnostics(e);lt.debug("Linting Python document: ".concat(e.uri.toString()),t),De.setModelMarkers(e,"ruff",t.map(r=>{var i=r.code==="F401"||r.code==="F841",o=r.code==null;return{startLineNumber:r.location.row,startColumn:r.location.column,endLineNumber:r.end_location.row,endColumn:r.end_location.column,message:o?r.message:"".concat(r.code,": ").concat(r.message),severity:o?uo.Error:uo.Warning,tags:i?[Vd.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=at.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:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.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 r=H.getDiagnostics(e).filter(u=>{var c=new Hs(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&c.intersectRanges(t)}),i=r.filter(u=>{var{fix:c}=u;return c!=null}).map(u=>{var c="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?c="".concat(u.code,": ").concat(u.fix.message):c="Fix ".concat(u.code)),{title:c,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(h=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:h.location.row,startColumn:h.location.column,endLineNumber:h.end_location.row,endColumn:h.end_location.column},text:(v=h.content)!==null&&v!==void 0?v:""}}})}:void 0}}),o=new Set,a=new Set;r.forEach(u=>{u.code!=null&&(o.has(u.code)&&a.add(u.code),o.add(u.code))});var s=r.map(u=>{if(u.code==null)return[];var c=e.getLineContent(u.location.row),h=De.tokenize(c,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:u.location.row,startColumn:c.length+1,endLineNumber:u.location.row,endColumn:c.length+1},text:" # noqa: ".concat(u.code)};return h!=null&&h.type.startsWith("comment")&&(v.text="# noqa: ".concat(u.code," "),c.startsWith("# noqa:",h.offset)?(v.range.startColumn=h.offset+1,v.range.endColumn=h.offset+9):(v.range.startColumn=h.offset+1,v.range.endColumn=c.startsWith("# ",h.offset)?h.offset+3:h.offset+2)),[{title:"Disable ".concat(u.code," for ").concat(a.has(u.code)?"line ".concat(u.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:v}]}}]}).flat().filter((u,c,h)=>h.find(v=>v.title===u.title)===u),l=[...o].map(u=>({title:"Disable ".concat(u," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(u,`
6
- `)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(H.ruffWorkspace)return lt.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:H.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),en(this,"registeredCompletionProvider",void 0),en(this,"registeredSignatureProvider",void 0),en(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=at.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=at.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=at.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);lt.debug("Requested completion items",a);var l=s.then(u=>{lt.debug("Completion items received: ",a,u);var c=u.map(h=>{var{label:v,kind:f,detail:p,documentation:g,sortText:b,filterText:w,textEdit:E,insertTextFormat:P}=h;return{label:v,kind:H.lspToMonacoKind(f),detail:p,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:w,insertText:E.text,insertTextRules:P===2?4:P,range:H.lspToMonacoRange(E.range)}});return{incomplete:!0,suggestions:c}}).catch(u=>(lt.error("There was an error retrieving completion items",u),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:i},u=s.getSignatureHelp(l);lt.debug("Requested signature help",l);var c=u.then(h=>{lt.debug("Signatures received: ",l,u);var v=h.map(p=>{var{label:g,documentation:b,parameters:w}=p;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:w??[]}});if(v.length===0)return o;var f=0;return{value:{signatures:v,activeSignature:f,activeParameter:h[f].activeParameter},dispose:()=>{}}}).catch(h=>(lt.error("There was an error retrieving completion items",h),o));return c}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t)},a=i.getHover(o);lt.debug("Requested hover",o);var s=a.then(l=>{lt.debug("Hover received: ",o,l);var{contents:u}=l;return{contents:u!=null?[u]:[]}}).catch(l=>(lt.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}en(H,"ruffWorkspace",void 0);en(H,"initRuffPromise",void 0);en(H,"isRuffInitialized",!1);en(H,"isRuffEnabled",!0);en(H,"ruffSettings",Ev);function Zo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ov(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Zo(o,r,i,a,s,"next",l)}function s(l){Zo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Yo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Qo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yo(Object(t),!0).forEach(function(r){xv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xv(n,e,t){return(e=Iv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iv(n){var e=Dv(n,"string");return typeof e=="symbol"?e:e+""}function Dv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Nt=W.module("MonacoUtils"),Jo="inmemory://dh-console/";class me{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nt.debug("Initializing Monaco..."),e!==void 0&&me.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=me;t(),r([bv,av,dv,wv,vv]),at.onLanguage("python",()=>{at.registerCodeActionProvider("python",{provideCodeActions:H.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),at.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:H.handlePythonFormatRequest})}),De.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){H.ruffWorkspace!=null&&H.lintPython(i);var o=Br(a=>H.lintPython(a),250);i.onDidChangeContent(()=>{o(i)})}}),me.removeConflictingKeybindings(),Nt.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=me,i=js(wi);Nt.debug2("Monaco theme:",wi),Nt.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"],"diffEditor.insertedTextBackground":i["diff-editor-inserted-text-background"],"diffEditor.removedTextBackground":i["diff-editor-removed-text-background"],"diffEditor.insertedLineBackground":i["diff-editor-inserted-line-background"],"diffEditor.removedLineBackground":i["diff-editor-removed-line-background"]};De.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{De.setTheme("dh-dark")}catch(s){Nt.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),De.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Qo(Qo({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var{id:i}=r;return i});at.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Nt.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{me.registerLanguage(r)})}static registerLanguage(e){Nt.debug2("Registering language: ",e.id),at.register(e),at.onLanguage(e.id,()=>{at.setLanguageConfiguration(e.id,e.conf),at.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();L(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Nt.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,u=[],c=0;c<s.length;c+=1){var h=s[c],{range:v,rangeLength:f,text:p}=h,g={range:{start:{line:v.startLineNumber-1,character:v.startColumn-1},end:{line:v.endLineNumber-1,character:v.endColumn-1}},rangeLength:f,text:p};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};Nt.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();L(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();L(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){De.addKeybindingRule({keybinding:ot.CtrlCmd|Jt.KeyD,command:null}),me.isMacPlatform()||De.addKeybindingRule({keybinding:ot.CtrlCmd|Jt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Ot()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=me.isMacPlatform();return i?(t.metaKey?ot.CtrlCmd:0)|(t.shiftKey?ot.Shift:0)|(t.altKey?ot.Alt:0)|(t.ctrlKey?ot.WinCtrl:0)|co.fromString(r):(t.ctrlKey?ot.CtrlCmd:0)|(t.shiftKey?ot.Shift:0)|(t.altKey?ot.Alt:0)|(t.metaKey?ot.WinCtrl:0)|co.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=zu(s),u=l.filter(c=>c.type==="url"?/^https?:\/\//.test(c.value):!0);u.forEach(c=>{t.push({url:c.href,range:new Hs(a,c.start+1,a,c.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return Kd.parse("".concat(Jo).concat(Ot()))}static isConsoleModel(e){return e.uri.toString().startsWith(Jo)}static canFormat(e){var t;return((t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.isSupported())===!0}static formatDocument(e){return Ov(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Nv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ea(Object(t),!0).forEach(function(r){jr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jr(n,e,t){return(e=Mv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mv(n){var e=kv(n,"string");return typeof e=="symbol"?e:e+""}function kv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nl extends m.Component{constructor(e){super(e),jr(this,"container",void 0),jr(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();L(t),De.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=Nv({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),L(this.container),this.editor=De.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[ot.CtrlCmd|Jt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),at.registerLinkProvider("plaintext",{provideLinks:me.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;L(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return d.jsx("div",{className:G("editor-container",e),ref:t=>{this.container=t}})}}jr(Nl,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});function ta(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function jv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ta(o,r,i,a,s,"next",l)}function s(l){ta(o,r,i,a,s,"throw",l)}a(void 0)})}}function it(n,e,t){return(e=Lv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lv(n){var e=Av(n,"string");return typeof e=="symbol"?e:e+""}function Av(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ai=W.module("ConsoleInput"),Lr=parseInt(wi["line-height"],10),Ml=6,kl=6,Rv=Lr+Ml+kl,si=100;class Ln extends m.PureComponent{constructor(e){super(e),it(this,"cancelListener",void 0),it(this,"resizeObserver",void 0),it(this,"commandContainer",void 0),it(this,"commandEditor",void 0),it(this,"commandHistoryIndex",void 0),it(this,"commandSuggestionContainer",void 0),it(this,"loadingPromise",void 0),it(this,"timestamp",void 0),it(this,"bufferIndex",void 0),it(this,"history",void 0),it(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=A.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:Lr,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(ai.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r=De.createModel("",e,me.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Lr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ml,bottom:kl},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:r},o=this.commandContainer.current;L(o),this.commandEditor=De.create(o,i),me.setEOL(this.commandEditor),me.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:l}=this,u=s==null?void 0:s.getPosition();L(u);var{lineNumber:c}=u;if(!a.altKey&&!a.shiftKey&&!a.metaKey){if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===(r==null?void 0:r.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(a.keyCode===Jt.Enter&&!this.isSuggestionMenuPopulated()){var h;a.stopPropagation(),a.preventDefault();var v=(h=this.commandEditor)===null||h===void 0?void 0:h.getValue().trim();if(v!==void 0){var f;this.processCommand(v),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}}),me.disableKeyBindings(this.commandEditor,[ot.CtrlCmd|Jt.KeyF]),me.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(o),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(me.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();L(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);L(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();L(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);L(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(r??i),e!==null&&e>this.history.length-si&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return jv(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=_e.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+si-1}),e.loadingPromise=_e.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=si,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,u)=>{var{name:c}=s;return l===0||c!==u[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,_e.isCanceled(s)){ai.debug2("Promise canceled, not loading history");return}ai.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),L(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;L(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),Rv),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return d.jsx("div",{className:G("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:G("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:Ln.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&d.jsx(H,{model:a,language:t,session:r})]})})}}it(Ln,"defaultProps",{maxHeight:Lr*10,scope:null,disabled:!1});it(Ln,"INPUT_CLASS_NAME","console-input");function Gt(n,e,t){return(e=Fv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fv(n){var e=$v(n,"string");return typeof e=="symbol"?e:e+""}function $v(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var na="pasted values",Hv=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],li=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ra=[".zip"];class ze extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Hv.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return li.some(r=>e.endsWith(r))||t&&ra.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===na?ao:e.endsWith(".csv")?Sd:e.endsWith(".zip")?wd:Ed}constructor(e){super(e),Gt(this,"fileElem",void 0),Gt(this,"divElem",void 0),Gt(this,"getValidExtensions",Qt(t=>t?[...li,...ra]:[...li])),Gt(this,"getAcceptString",Qt(t=>this.getValidExtensions(t).join(", "))),Gt(this,"getFileTypeErrorString",Qt(t=>Xs.join(this.getValidExtensions(t),"or"))),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=A.createRef(),this.divElem=A.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();L(o),ze.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:ze.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:na,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:ao,action:this.handleMenuPaste,shortcut:Xt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:ze.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(ne,{actions:s}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:Pd})}),d.jsx("label",{children:"Drop file (or paste values) here to import"}),d.jsx("div",{className:"message-small",children:d.jsx("label",{children:"or"})}),d.jsx(ae,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(ve,{icon:ze.getIcon(i)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[i,!r&&d.jsx(ae,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Ls,tooltip:"Remove"})]})]})]}),!!a&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:As})}),d.jsx("label",{children:a}),a===ze.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Gt(ze,"defaultProps",{allowZip:!1,dragError:null});Gt(ze,"MULTIPLE_FILE_ERROR","Please select only one file");Gt(ze,"FILE_TYPE_ERROR","Filetype not supported.");function Hi(n,e,t){return(e=Bv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bv(n){var e=Wv(n,"string");return typeof e=="symbol"?e:e+""}function Wv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Me{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}Hi(Me,"TYPE_GLOBAL","type-global");Hi(Me,"TYPE_CONTEXT_PRESET","type-context-preset");Hi(Me,"TYPE_CONTEXT_CUSTOM","type-context-custom");class Uv extends Me{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Vv extends Me{format(e){return String.fromCharCode(e)}}function zt(n,e,t){return(e=Kv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kv(n){var e=zv(n,"string");return typeof e=="symbol"?e:e+""}function zv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ia=W.module("DateTimeColumnFormatter");class gt extends Me{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=gt.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=gt.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=gt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),zt(this,"dh",void 0),zt(this,"dhTimeZone",void 0),zt(this,"defaultDateTimeFormatString",void 0),zt(this,"showTimeZone",void 0),zt(this,"showTSeparator",void 0),zt(this,"formatStringMap",void 0);var a=t||gt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{ia.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(gt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=gt.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{ia.error("Invalid format arguments")}return""}}zt(gt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");zt(gt,"DEFAULT_TIME_ZONE_ID","America/New_York");var Ft;function St(n,e,t){return(e=Gv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gv(n){var e=qv(n,"string");return typeof e=="symbol"?e:e+""}function qv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Xv=W.module("DecimalColumnFormatter");class Ge extends Me{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ge.makeFormat(e,t,Me.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ge.makeFormat("Custom Format",e,Me.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ge.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),St(this,"defaultFormatString",void 0),St(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Xv.error("Invalid format arguments")}return""}}Ft=Ge;St(Ge,"DEFAULT_FORMAT_STRING","###,##0.0000");St(Ge,"FORMAT_PERCENT",Ft.makePresetFormat("Percent","##0.00%"));St(Ge,"FORMAT_BASIS_POINTS",Ft.makePresetFormat("Basis Points","###,##0 bp",1e4));St(Ge,"FORMAT_THOUSANDS",Ft.makePresetFormat("Thousands","##0.000 k",.001));St(Ge,"FORMAT_MILLIONS",Ft.makePresetFormat("Millions","###,##0.000 mm",1e-6));St(Ge,"FORMAT_SCIENTIFIC_NOTATION",Ft.makePresetFormat("Scientific Notation","0.0000E0"));St(Ge,"FORMAT_ROUND",Ft.makePresetFormat("Round","###,##0"));St(Ge,"FORMAT_ROUND_TWO_DECIMALS",Ft.makePresetFormat("0.00","###,##0.00"));St(Ge,"FORMAT_ROUND_FOUR_DECIMALS",Ft.makePresetFormat("0.0000","###,##0.0000"));class Zv extends Me{format(e){return"".concat(e)}}var zr;function An(n,e,t){return(e=Yv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yv(n){var e=Qv(n,"string");return typeof e=="symbol"?e:e+""}function Qv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Jv=W.module("IntegerColumnFormatter");class xt extends Me{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return xt.makeFormat(e,t,Me.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return xt.makeFormat("Custom Format",e,Me.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=xt.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),An(this,"dh",void 0),An(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Jv.error("Invalid format arguments")}return""}}zr=xt;An(xt,"DEFAULT_FORMAT_STRING","###,##0");An(xt,"FORMAT_THOUSANDS",zr.makePresetFormat("Thousands","##0.000 k",.001));An(xt,"FORMAT_MILLIONS",zr.makePresetFormat("Millions","###,##0.000 mm",1e-6));An(xt,"FORMAT_SCIENTIFIC_NOTATION",zr.makePresetFormat("Scientific Notation","0.0000E0"));class ef extends Me{format(e){return e}}function oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(r){Bi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bi(n,e,t){return(e=tf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tf(n){var e=nf(n,"string");return typeof e=="symbol"?e:e+""}function nf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rf=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class Ee{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),h="".concat(i+1).padStart(2,"0"),v="".concat(o).padStart(2,"0"),f="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),b="".concat(u).padStart(9,"0"),w="".concat(c,"-").concat(h,"-").concat(v," ").concat(f,":").concat(p,":").concat(g,".").concat(b);return e.i18n.DateTimeFormat.parse(Ee.FULL_DATE_FORMAT,w,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:u,seconds:c,nanos:h}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;h=Ee.getNextNanos(t.nanos),h>999999999&&(c+=1,h=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var v=new Date(o,a,s,l,u,c);return Ee.makeDateWrapper(e,i,v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),h)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<Ee.months.length;i+=1)if(Ee.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,h=i!=null?parseInt(i,10):0,v=o!=null?parseInt(o,10):0,f=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(h)||Number.isNaN(v)||Number.isNaN(f)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:h,minutes:v,seconds:f,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=rf.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,u,,c,h]=r;if(!t&&h!=null&&h.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(h));var v={year:i,month:o,date:a,hours:s,minutes:l,seconds:u,nanos:c};return t?aa(aa({},v),{},{overflow:h}):v}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=Ee.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=Ee.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),h=Ee.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),v=Ee.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[h,v]}if(i==="now"){var f=new Date(Date.now()),p=e.DateWrapper.ofJsDate(f);return[p,null]}var g=Ee.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var b=Ee.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(b==null)throw new Error("Unable to extract date values from ".concat(g));var w=Ee.makeDateWrapper(e,r,b.year,b.month,b.date,b.hours,b.minutes,b.seconds,b.nanos),E=Ee.getNextDate(e,g,b,r);return[w,E]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=Ee.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Bi(Ee,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Bi(Ee,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function YC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function QC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=jl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function jl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function of(n,e,t,r){return jl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function JC(n,e,t,r,i){return function(a){var s=a==null?void 0:a.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function e0(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function t0(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Wi(n,e,t){return(e=af(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function af(n){var e=sf(n,"string");return typeof e=="symbol"?e:e+""}function sf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class er{}Wi(er,"not","not");Wi(er,"and","and");Wi(er,"or","or");function n0(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function Ce(n,e,t){return(e=lf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lf(n){var e=uf(n,"string");return typeof e=="symbol"?e:e+""}function uf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class T{}Ce(T,"eq","eq");Ce(T,"eqIgnoreCase","eqIgnoreCase");Ce(T,"notEq","notEq");Ce(T,"notEqIgnoreCase","notEqIgnoreCase");Ce(T,"greaterThan","greaterThan");Ce(T,"greaterThanOrEqualTo","greaterThanOrEqualTo");Ce(T,"lessThan","lessThan");Ce(T,"lessThanOrEqualTo","lessThanOrEqualTo");Ce(T,"in","in");Ce(T,"inIgnoreCase","inIgnoreCase");Ce(T,"notIn","notIn");Ce(T,"notInIgnoreCase","notInIgnoreCase");Ce(T,"isTrue","isTrue");Ce(T,"isFalse","isFalse");Ce(T,"isNull","isNull");Ce(T,"invoke","invoke");Ce(T,"contains","contains");Ce(T,"notContains","notContains");Ce(T,"containsIgnoreCase","containsIgnoreCase");Ce(T,"startsWith","startsWith");Ce(T,"endsWith","endsWith");Ce(T,"containsAny","containsAny");var df="DH_ITEM_KEY",sa=W.module("ViewportDataUtils");function Ll(n){return"".concat(df,"_").concat(n)}function r0(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;sa.debug("table updated",i.detail);var l=new Map;s.forEach((u,c)=>{var h=e(u,o),v=Ll(a+c);l.set(v,{key:v,item:h})}),sa.debug("update keys",l),t(l)}}function i0(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*o0(n,e){for(var t=n;t<=e;++t)yield{key:Ll(t)}}function cf(n){return n==null||hf(n)?0:n.size}function hf(n){return n!=null&&typeof n=="object"&&"isClosed"in n&&typeof n.isClosed=="boolean"?n.isClosed:!1}function a0(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=io(n-t,o,a),l=io(i+t,o,a);return[s,l]}var Ei;function la(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Vt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){la(o,r,i,a,s,"next",l)}function s(l){la(o,r,i,a,s,"throw",l)}a(void 0)})}}function Cn(n,e,t){return(e=mf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mf(n){var e=vf(n,"string");return typeof e=="symbol"?e:e+""}function vf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mt=W.module("TableUtils");function s0(n){return n===y.sortDirection.ascending||n===y.sortDirection.descending||n===y.sortDirection.reverse||n===y.sortDirection.none}class y{static copyTableAndApplyFilters(e){var t=arguments;return Vt(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(ni(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=y.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return y.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:y.isCharType(e)||y.isNumberType(e)||y.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:y.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,r){var i=e[r];if(i==null)return null;var o=y.getSortForColumn(t,i.name);return o===null?this.makeColumnSort(e,r,y.sortDirection.ascending,!1):o.direction===y.sortDirection.ascending?this.makeColumnSort(e,r,y.sortDirection.descending,!1):null}static makeColumnSort(e,t,r,i){var o=e[t];return o==null||r===y.sortDirection.none?null:{column:{name:o.name,type:o.type},isAbs:i,direction:r}}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t[r]==null)return[];var o=y.getNextSort(t,e,r);return y.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=y.makeColumnSort(t,r,i,o);return y.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=y.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==y.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case y.dataType.BOOLEAN:return y.dataType.BOOLEAN;case"char":case"java.lang.Character":case y.dataType.CHAR:return y.dataType.CHAR;case"java.lang.String":case y.dataType.STRING:return y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case y.dataType.DATETIME:return y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case y.dataType.DECIMAL:return y.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case y.dataType.INT:return y.dataType.INT;default:return y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return y.isIntegerType(e)||y.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return y.getNormalizedType(e)===y.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return _e.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return y.makeCancelableEventPromise(e,t,{timeout:r,matcher:i??void 0})}static makeCancelableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{timeout:i=0,matcher:o}=r,a,s,l=!0,u=new Promise((c,h)=>{s=setTimeout(()=>{a(),l=!1,h(new Es('Event "'.concat(t,'" timed out.')))},i),a=e.addEventListener(t,v=>{if(o!=null&&!o(v)){Mt.debug2("Event triggered, but matcher returned false.");return}Mt.debug2("Event triggered, resolving."),a(),clearTimeout(s),l=!1,c(v)})});return u.cancel=()=>{if(l){Mt.debug2("Pending promise cleanup."),a(),clearTimeout(s),l=!1;return}Mt.debug2("Ignoring non-pending promise cancel.")},u}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=y.removeCommas(t);if(y.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return Xs.sort(o,a,t)})}constructor(e){Cn(this,"dh",void 0),this.dh=e,Xd(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return Vt(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(a=yield e.copy(),yield a.applyFilter(ni(...l.map(f=>f(a)))));var c=a.findColumn(t),h=yield a.selectDistinct([c]);a!==e&&a.close();var v=h.findColumn(t).sort()[r]();return o.applySort(h,[v])})()}doesColumnValueExist(e,t,r,i){var o=this;return Vt(function*(){if(e==null)return null;var a=of(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,ni(a(s)));var l=cf(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=y.getNormalizedType(e);switch(t){case y.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case y.dataType.CHAR:case y.dataType.STRING:return this.dh.ValueType.STRING;case y.dataType.DATETIME:return this.dh.ValueType.DATETIME;case y.dataType.DECIMAL:case y.dataType.INT:return y.isBigDecimalType(e)||y.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),u=null,c=0;c<l.length;c+=1){var h=l[c].trim();if(h.length>0){var v=this.makeQuickFilterFromComponent(e,h,r);if(v)u?u=u.and(v):u=v;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&u?o=o.or(u):o=u}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return y.isNumberType(i)?this.makeQuickNumberFilter(e,t):y.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&y.isDateType(i)?this.makeQuickDateFilter(e,t,r):y.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,u=null,c=null,h=null,v=null;if(s!==null&&s.length>3&&([,l,u,c,h,v]=s),v!=null&&v.trim().length>0)return null;if(l==null&&(l="="),h!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(h=h.trim().toLowerCase(),h){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(c==null)return null;if(c=y.removeCommas(c),y.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(f){return Mt.warn("Unable to create long filter",f),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return o=e.filter(),y.makeRangeFilterWithOperation(o,l,c)}static escapeQuickTextFilter(e){if(e==null)return null;var t=/^(!~|!=|~|=|!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null?"\\".concat(o).concat(a??""):a!=null&&r.test(a.toLowerCase())||a!=null&&a.startsWith("*")?"\\".concat(a):a!=null&&a.endsWith("*")&&!a.endsWith("\\*")?(a=a.substring(0,a.length-1),"".concat(a,"\\*")):"".concat(o??"").concat(a??"")}static unescapeQuickTextFilter(e){var t=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null&&(o=o.replace("\\","")),a!=null&&r.test(a.toLowerCase())&&(a=a.replace("\\","")),o==null&&a!=null&&a.startsWith("\\*")&&(a=a.substring(1)),o==null&&a!=null&&a.endsWith("\\*")?(a=a.substring(0,a.length-2),"".concat(a,"*")):"".concat(o??"").concat(a??"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,h=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(h="*",l=l.substring(0,l.length-1)),l=y.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):h==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):h==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),u=e.filter();try{var c=y.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var u=T.eq;switch(s){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=Ee.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,u=s!=null?o.FilterValue.ofNumber(s):null,c=e.filter();if(l==null)return r===T.notEq?c.isNull().not():c.isNull();switch(r){case T.eq:{if(u!=null){var h=c.greaterThanOrEqualTo(l),v=c.lessThan(u);return h.and(v)}return c.eq(l)}case T.lessThan:return c.lessThan(l);case T.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case T.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case T.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case T.notEq:{if(u!=null){var f=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return f.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,u=null;if(a!==null&&a.length>3&&([,s,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var c=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var h=r.FilterValue.ofString(y.isRangeOperation(s)?y.quoteValue(l):l);return y.makeRangeFilterWithOperation(c,s,h)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:h,value:v}=c;if(h!=null&&h.length>0&&v!=null&&v.length>0)try{var f=this.makeAdvancedValueFilter(e,h,v,r);if(f!=null){if(u===0)l=f;else if(l!==null&&u-1<o.length){var p=o[u-1];if(p===er.and)l=l.and(f);else if(p===er.or)l=l.or(f);else{Mt.error("Unexpected filter operator",p,f),l=null;break}}}else Mt.debug2("Empty filter ignored for",h,v)}catch(b){Mt.error("Unable to create filter",b),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(y.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(y.isNumberType(e.type)||y.isCharType(e.type))return this.makeQuickFilter(e,"".concat(y.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case T.eq:return s.eq(a);case T.eqIgnoreCase:return s.eqIgnoreCase(a);case T.notEq:return s.notEq(a);case T.notEqIgnoreCase:return s.notEqIgnoreCase(a);case T.greaterThan:return s.greaterThan(a);case T.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case T.lessThan:return s.lessThan(a);case T.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case T.isTrue:return s.isTrue();case T.isFalse:return s.isFalse();case T.isNull:return s.isNull();case T.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case T.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case T.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case T.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return L(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,Ee.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return L(a),a}return y.isBigDecimalType(e.type)||y.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;y.isTextType(e.type)?r=t.FilterValue.ofString("a"):y.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):y.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=y.getBaseType(e);return y.isTextType(i)?r.FilterValue.ofString(t):y.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(y.removeCommas(t))):r.FilterValue.ofNumber(y.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return y.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):y.isTextType(e)?r.FilterValue.ofString(t):y.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(y.isTextType(e))return t;if(y.isLongType(e))return i.LongWrapper.ofString(y.removeCommas(t));if(y.isBooleanType(e))return y.makeBooleanValue(t,!0);if(y.isDateType(e)){var[o]=Ee.parseDateRange(i,t,r);return o}return y.isNumberType(e)?y.makeNumberValue(t):(Mt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:y.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):y.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}Ei=y;Cn(y,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});Cn(y,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});Cn(y,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);Cn(y,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));Cn(y,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);Cn(y,"executeAndWaitForEvent",function(){var n=Vt(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Ei.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=Ei.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function En(n,e,t){return(e=ff(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ff(n){var e=pf(n,"string");return typeof e=="symbol"?e:e+""}function pf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Al{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=y.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o==null||o.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ws,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;En(this,"defaultColumnFormatter",void 0),En(this,"typeFormatterMap",void 0),En(this,"columnFormatMap",void 0),En(this,"truncateNumbersWithPound",void 0),En(this,"showEmptyStrings",void 0),En(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Zv,this.typeFormatterMap=new Map([[y.dataType.BOOLEAN,new Uv],[y.dataType.CHAR,new Vv],[y.dataType.DATETIME,new gt(e,r)],[y.dataType.DECIMAL,new Ge(e,i)],[y.dataType.INT,new xt(e,o)],[y.dataType.STRING,new ef]]),this.columnFormatMap=Al.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=y.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=y.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(y.dataType.DATETIME);return Td(e,gt),e.dhTimeZone.id}}function Sn(n,e,t){return(e=gf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gf(n){var e=bf(n,"string");return typeof e=="symbol"?e:e+""}function bf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ee{}Sn(ee,"INTEGER","int");Sn(ee,"LONG","long");Sn(ee,"DOUBLE","double");Sn(ee,"BOOLEAN","bool");Sn(ee,"STRING","string");Sn(ee,"DATE_TIME","datetime");Sn(ee,"LOCAL_TIME","localtime");function Rl(n,e){var t=n.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(r,i)=>e(i)),t}function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function da(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){Ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ue(n,e,t){return(e=yf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yf(n){var e=Cf(n,"string");return typeof e=="symbol"?e:e+""}function Cf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ca="unknown",Sf=2147483647,wf=-2147483648,ha=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,ma=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class je{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case ee.STRING:return ee.STRING;case ee.INTEGER:return je.checkInteger(e);case ee.LONG:return je.checkLong(e);case ee.DOUBLE:return je.checkDouble(e);case ee.BOOLEAN:return je.checkBoolean(e);case ee.DATE_TIME:return je.checkDateTime(e);case ee.LOCAL_TIME:return je.checkLocalTime(e);default:return je.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:je.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:t.includes(".")?ee.DOUBLE:ee.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:ee.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ee.BOOLEAN:ee.STRING}static checkDateTime(e){return ha.test(e)?ee.DATE_TIME:ee.STRING}static checkLocalTime(e){return ma.test(e)?ee.LOCAL_TIME:ee.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(je.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?ee.BOOLEAN:ha.test(e)&&e.includes(":")?ee.DATE_TIME:ma.test(e)?ee.LOCAL_TIME:ee.STRING}return je.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ee.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ee.LONG;var r=parseInt(e,10);return r>Sf||r<wf?ee.LONG:ee.INTEGER}constructor(e,t,r,i,o,a,s,l,u,c){Ue(this,"onFileCompleted",void 0),Ue(this,"file",void 0),Ue(this,"readHeaders",void 0),Ue(this,"nullString",void 0),Ue(this,"onProgress",void 0),Ue(this,"onError",void 0),Ue(this,"types",void 0),Ue(this,"chunks",void 0),Ue(this,"totalChunks",void 0),Ue(this,"rowCount",void 0),Ue(this,"isZip",void 0),Ue(this,"shouldTrim",void 0),Ue(this,"zipProgress",void 0),Ue(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=c,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=da(da({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)qn.parse(this.file,this.config);else{var e=Rl(this.file,this.handleNodeUpdate);qn.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:r}=e;if(!this.types){if(r==null||r.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(r[0].length).fill(ca),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,L(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=je.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
6
+ `)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(H.ruffWorkspace)return lt.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:H.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),en(this,"registeredCompletionProvider",void 0),en(this,"registeredSignatureProvider",void 0),en(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=at.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=at.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=at.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);lt.debug("Requested completion items",a);var l=s.then(u=>{lt.debug("Completion items received: ",a,u);var c=u.map(h=>{var{label:v,kind:f,detail:p,documentation:g,sortText:b,filterText:w,textEdit:E,insertTextFormat:P}=h;return{label:v,kind:H.lspToMonacoKind(f),detail:p,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:w,insertText:E.text,insertTextRules:P===2?4:P,range:H.lspToMonacoRange(E.range)}});return{incomplete:!0,suggestions:c}}).catch(u=>(lt.error("There was an error retrieving completion items",u),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:i},u=s.getSignatureHelp(l);lt.debug("Requested signature help",l);var c=u.then(h=>{lt.debug("Signatures received: ",l,u);var v=h.map(p=>{var{label:g,documentation:b,parameters:w}=p;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:w??[]}});if(v.length===0)return o;var f=0;return{value:{signatures:v,activeSignature:f,activeParameter:h[f].activeParameter},dispose:()=>{}}}).catch(h=>(lt.error("There was an error retrieving completion items",h),o));return c}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t)},a=i.getHover(o);lt.debug("Requested hover",o);var s=a.then(l=>{lt.debug("Hover received: ",o,l);var{contents:u}=l;return{contents:u!=null?[u]:[]}}).catch(l=>(lt.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}en(H,"ruffWorkspace",void 0);en(H,"initRuffPromise",void 0);en(H,"isRuffInitialized",!1);en(H,"isRuffEnabled",!0);en(H,"ruffSettings",Ev);function Zo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ov(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Zo(o,r,i,a,s,"next",l)}function s(l){Zo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Yo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Qo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yo(Object(t),!0).forEach(function(r){xv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xv(n,e,t){return(e=Iv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iv(n){var e=Dv(n,"string");return typeof e=="symbol"?e:e+""}function Dv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Nt=W.module("MonacoUtils"),Jo="inmemory://dh-console/";class me{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nt.debug("Initializing Monaco..."),e!==void 0&&me.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=me;t(),r([bv,av,dv,wv,vv]),at.onLanguage("python",()=>{at.registerCodeActionProvider("python",{provideCodeActions:H.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),at.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:H.handlePythonFormatRequest})}),De.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){H.ruffWorkspace!=null&&H.lintPython(i);var o=Br(a=>H.lintPython(a),250);i.onDidChangeContent(()=>{o(i)})}}),me.removeConflictingKeybindings(),Nt.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=me,i=js(wi);Nt.debug2("Monaco theme:",wi),Nt.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"],"diffEditor.insertedTextBackground":i["diff-editor-inserted-text-background"],"diffEditor.removedTextBackground":i["diff-editor-removed-text-background"],"diffEditor.insertedLineBackground":i["diff-editor-inserted-line-background"],"diffEditor.removedLineBackground":i["diff-editor-removed-line-background"]};De.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{De.setTheme("dh-dark")}catch(s){Nt.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),De.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Qo(Qo({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var{id:i}=r;return i});at.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Nt.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{me.registerLanguage(r)})}static registerLanguage(e){Nt.debug2("Registering language: ",e.id),at.register(e),at.onLanguage(e.id,()=>{at.setLanguageConfiguration(e.id,e.conf),at.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();L(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Nt.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,u=[],c=0;c<s.length;c+=1){var h=s[c],{range:v,rangeLength:f,text:p}=h,g={range:{start:{line:v.startLineNumber-1,character:v.startColumn-1},end:{line:v.endLineNumber-1,character:v.endColumn-1}},rangeLength:f,text:p};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};Nt.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();L(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();L(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){De.addKeybindingRule({keybinding:ot.CtrlCmd|Jt.KeyD,command:null}),me.isMacPlatform()||De.addKeybindingRule({keybinding:ot.CtrlCmd|Jt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Ot()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=me.isMacPlatform();return i?(t.metaKey?ot.CtrlCmd:0)|(t.shiftKey?ot.Shift:0)|(t.altKey?ot.Alt:0)|(t.ctrlKey?ot.WinCtrl:0)|co.fromString(r):(t.ctrlKey?ot.CtrlCmd:0)|(t.shiftKey?ot.Shift:0)|(t.altKey?ot.Alt:0)|(t.metaKey?ot.WinCtrl:0)|co.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=zu(s),u=l.filter(c=>c.type==="url"?/^https?:\/\//.test(c.value):!0);u.forEach(c=>{t.push({url:c.href,range:new Hs(a,c.start+1,a,c.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return Kd.parse("".concat(Jo).concat(Ot()))}static isConsoleModel(e){return e.uri.toString().startsWith(Jo)}static canFormat(e){var t;return((t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.isSupported())===!0}static formatDocument(e){return Ov(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Nv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ea(Object(t),!0).forEach(function(r){jr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jr(n,e,t){return(e=Mv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mv(n){var e=kv(n,"string");return typeof e=="symbol"?e:e+""}function kv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nl extends m.Component{constructor(e){super(e),jr(this,"container",void 0),jr(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();L(t),De.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=Nv({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),L(this.container),this.editor=De.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[ot.CtrlCmd|Jt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),at.registerLinkProvider("plaintext",{provideLinks:me.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;L(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return d.jsx("div",{className:G("editor-container",e),ref:t=>{this.container=t}})}}jr(Nl,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});function ta(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function jv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ta(o,r,i,a,s,"next",l)}function s(l){ta(o,r,i,a,s,"throw",l)}a(void 0)})}}function it(n,e,t){return(e=Lv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lv(n){var e=Av(n,"string");return typeof e=="symbol"?e:e+""}function Av(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ai=W.module("ConsoleInput"),Lr=parseInt(wi["line-height"],10),Ml=6,kl=6,Rv=Lr+Ml+kl,si=100;class Ln extends m.PureComponent{constructor(e){super(e),it(this,"cancelListener",void 0),it(this,"resizeObserver",void 0),it(this,"commandContainer",void 0),it(this,"commandEditor",void 0),it(this,"commandHistoryIndex",void 0),it(this,"commandSuggestionContainer",void 0),it(this,"loadingPromise",void 0),it(this,"timestamp",void 0),it(this,"bufferIndex",void 0),it(this,"history",void 0),it(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=A.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:Lr,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(ai.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r=De.createModel("",e,me.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Lr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ml,bottom:kl},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:r},o=this.commandContainer.current;L(o),this.commandEditor=De.create(o,i),me.setEOL(this.commandEditor),me.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:l}=this,u=s==null?void 0:s.getPosition();L(u);var{lineNumber:c}=u;if(!a.altKey&&!a.shiftKey&&!a.metaKey){if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===(r==null?void 0:r.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(a.keyCode===Jt.Enter&&!this.isSuggestionMenuPopulated()){var h;a.stopPropagation(),a.preventDefault();var v=(h=this.commandEditor)===null||h===void 0?void 0:h.getValue().trim();if(v!==void 0){var f;this.processCommand(v),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}}),me.disableKeyBindings(this.commandEditor,[ot.CtrlCmd|Jt.KeyF]),me.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(o),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(me.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();L(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);L(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();L(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);L(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(r??i),e!==null&&e>this.history.length-si&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return jv(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=_e.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+si-1}),e.loadingPromise=_e.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=si,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,u)=>{var{name:c}=s;return l===0||c!==u[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,_e.isCanceled(s)){ai.debug2("Promise canceled, not loading history");return}ai.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),L(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;L(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),Rv),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return d.jsx("div",{className:G("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:G("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:Ln.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&d.jsx(H,{model:a,language:t,session:r})]})})}}it(Ln,"defaultProps",{maxHeight:Lr*10,scope:null,disabled:!1});it(Ln,"INPUT_CLASS_NAME","console-input");function Gt(n,e,t){return(e=Fv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fv(n){var e=$v(n,"string");return typeof e=="symbol"?e:e+""}function $v(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var na="pasted values",Hv=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],li=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ra=[".zip"];class ze extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Hv.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return li.some(r=>e.endsWith(r))||t&&ra.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===na?ao:e.endsWith(".csv")?Sd:e.endsWith(".zip")?wd:Ed}constructor(e){super(e),Gt(this,"fileElem",void 0),Gt(this,"divElem",void 0),Gt(this,"getValidExtensions",Qt(t=>t?[...li,...ra]:[...li])),Gt(this,"getAcceptString",Qt(t=>this.getValidExtensions(t).join(", "))),Gt(this,"getFileTypeErrorString",Qt(t=>Xs.join(this.getValidExtensions(t),"or"))),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=A.createRef(),this.divElem=A.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();L(o),ze.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:ze.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:na,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:ao,action:this.handleMenuPaste,shortcut:Xt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:ze.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(ne,{actions:s}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:Pd})}),d.jsx("label",{children:"Drop file (or paste values) here to import"}),d.jsx("div",{className:"message-small",children:d.jsx("label",{children:"or"})}),d.jsx(ae,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(ve,{icon:ze.getIcon(i)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[i,!r&&d.jsx(ae,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Ls,tooltip:"Remove"})]})]})]}),!!a&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:As})}),d.jsx("label",{children:a}),a===ze.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Gt(ze,"defaultProps",{allowZip:!1,dragError:null});Gt(ze,"MULTIPLE_FILE_ERROR","Please select only one file");Gt(ze,"FILE_TYPE_ERROR","Filetype not supported.");function Hi(n,e,t){return(e=Bv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bv(n){var e=Wv(n,"string");return typeof e=="symbol"?e:e+""}function Wv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Me{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}Hi(Me,"TYPE_GLOBAL","type-global");Hi(Me,"TYPE_CONTEXT_PRESET","type-context-preset");Hi(Me,"TYPE_CONTEXT_CUSTOM","type-context-custom");class Uv extends Me{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Vv extends Me{format(e){return String.fromCharCode(e)}}function zt(n,e,t){return(e=Kv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kv(n){var e=zv(n,"string");return typeof e=="symbol"?e:e+""}function zv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ia=W.module("DateTimeColumnFormatter");class gt extends Me{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=gt.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=gt.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=gt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),zt(this,"dh",void 0),zt(this,"dhTimeZone",void 0),zt(this,"defaultDateTimeFormatString",void 0),zt(this,"showTimeZone",void 0),zt(this,"showTSeparator",void 0),zt(this,"formatStringMap",void 0);var a=t||gt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{ia.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(gt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=gt.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{ia.error("Invalid format arguments")}return""}}zt(gt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");zt(gt,"DEFAULT_TIME_ZONE_ID","America/New_York");var Ft;function St(n,e,t){return(e=Gv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gv(n){var e=qv(n,"string");return typeof e=="symbol"?e:e+""}function qv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Xv=W.module("DecimalColumnFormatter");class Ge extends Me{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ge.makeFormat(e,t,Me.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ge.makeFormat("Custom Format",e,Me.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ge.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),St(this,"defaultFormatString",void 0),St(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Xv.error("Invalid format arguments")}return""}}Ft=Ge;St(Ge,"DEFAULT_FORMAT_STRING","###,##0.0000");St(Ge,"FORMAT_PERCENT",Ft.makePresetFormat("Percent","##0.00%"));St(Ge,"FORMAT_BASIS_POINTS",Ft.makePresetFormat("Basis Points","###,##0 bp",1e4));St(Ge,"FORMAT_THOUSANDS",Ft.makePresetFormat("Thousands","##0.000 k",.001));St(Ge,"FORMAT_MILLIONS",Ft.makePresetFormat("Millions","###,##0.000 mm",1e-6));St(Ge,"FORMAT_SCIENTIFIC_NOTATION",Ft.makePresetFormat("Scientific Notation","0.0000E0"));St(Ge,"FORMAT_ROUND",Ft.makePresetFormat("Round","###,##0"));St(Ge,"FORMAT_ROUND_TWO_DECIMALS",Ft.makePresetFormat("0.00","###,##0.00"));St(Ge,"FORMAT_ROUND_FOUR_DECIMALS",Ft.makePresetFormat("0.0000","###,##0.0000"));class Zv extends Me{format(e){return"".concat(e)}}var zr;function An(n,e,t){return(e=Yv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yv(n){var e=Qv(n,"string");return typeof e=="symbol"?e:e+""}function Qv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Jv=W.module("IntegerColumnFormatter");class xt extends Me{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return xt.makeFormat(e,t,Me.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return xt.makeFormat("Custom Format",e,Me.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=xt.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),An(this,"dh",void 0),An(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Jv.error("Invalid format arguments")}return""}}zr=xt;An(xt,"DEFAULT_FORMAT_STRING","###,##0");An(xt,"FORMAT_THOUSANDS",zr.makePresetFormat("Thousands","##0.000 k",.001));An(xt,"FORMAT_MILLIONS",zr.makePresetFormat("Millions","###,##0.000 mm",1e-6));An(xt,"FORMAT_SCIENTIFIC_NOTATION",zr.makePresetFormat("Scientific Notation","0.0000E0"));class ef extends Me{format(e){return e}}function oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(r){Bi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bi(n,e,t){return(e=tf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tf(n){var e=nf(n,"string");return typeof e=="symbol"?e:e+""}function nf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rf=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class Ee{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),h="".concat(i+1).padStart(2,"0"),v="".concat(o).padStart(2,"0"),f="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),b="".concat(u).padStart(9,"0"),w="".concat(c,"-").concat(h,"-").concat(v," ").concat(f,":").concat(p,":").concat(g,".").concat(b);return e.i18n.DateTimeFormat.parse(Ee.FULL_DATE_FORMAT,w,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:u,seconds:c,nanos:h}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;h=Ee.getNextNanos(t.nanos),h>999999999&&(c+=1,h=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var v=new Date(o,a,s,l,u,c);return Ee.makeDateWrapper(e,i,v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),h)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<Ee.months.length;i+=1)if(Ee.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,h=i!=null?parseInt(i,10):0,v=o!=null?parseInt(o,10):0,f=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(h)||Number.isNaN(v)||Number.isNaN(f)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:h,minutes:v,seconds:f,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=rf.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,u,,c,h]=r;if(!t&&h!=null&&h.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(h));var v={year:i,month:o,date:a,hours:s,minutes:l,seconds:u,nanos:c};return t?aa(aa({},v),{},{overflow:h}):v}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=Ee.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=Ee.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),h=Ee.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),v=Ee.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[h,v]}if(i==="now"){var f=new Date(Date.now()),p=e.DateWrapper.ofJsDate(f);return[p,null]}var g=Ee.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var b=Ee.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(b==null)throw new Error("Unable to extract date values from ".concat(g));var w=Ee.makeDateWrapper(e,r,b.year,b.month,b.date,b.hours,b.minutes,b.seconds,b.nanos),E=Ee.getNextDate(e,g,b,r);return[w,E]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=Ee.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Bi(Ee,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Bi(Ee,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function YC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function QC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=jl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function jl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function of(n,e,t,r){return jl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function JC(n,e,t,r,i){return function(a){var s=a==null?void 0:a.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function e0(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function t0(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Wi(n,e,t){return(e=af(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function af(n){var e=sf(n,"string");return typeof e=="symbol"?e:e+""}function sf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class er{}Wi(er,"not","not");Wi(er,"and","and");Wi(er,"or","or");function n0(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function Ce(n,e,t){return(e=lf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lf(n){var e=uf(n,"string");return typeof e=="symbol"?e:e+""}function uf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class T{}Ce(T,"eq","eq");Ce(T,"eqIgnoreCase","eqIgnoreCase");Ce(T,"notEq","notEq");Ce(T,"notEqIgnoreCase","notEqIgnoreCase");Ce(T,"greaterThan","greaterThan");Ce(T,"greaterThanOrEqualTo","greaterThanOrEqualTo");Ce(T,"lessThan","lessThan");Ce(T,"lessThanOrEqualTo","lessThanOrEqualTo");Ce(T,"in","in");Ce(T,"inIgnoreCase","inIgnoreCase");Ce(T,"notIn","notIn");Ce(T,"notInIgnoreCase","notInIgnoreCase");Ce(T,"isTrue","isTrue");Ce(T,"isFalse","isFalse");Ce(T,"isNull","isNull");Ce(T,"invoke","invoke");Ce(T,"contains","contains");Ce(T,"notContains","notContains");Ce(T,"containsIgnoreCase","containsIgnoreCase");Ce(T,"startsWith","startsWith");Ce(T,"endsWith","endsWith");Ce(T,"containsAny","containsAny");var df="DH_ITEM_KEY",sa=W.module("ViewportDataUtils");function Ll(n){return"".concat(df,"_").concat(n)}function r0(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;sa.debug("table updated",i.detail);var l=new Map;s.forEach((u,c)=>{var h=e(u,o),v=Ll(a+c);l.set(v,{key:v,item:h})}),sa.debug("update keys",l),t(l)}}function i0(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*o0(n,e){for(var t=n;t<=e;++t)yield{key:Ll(t)}}function cf(n){return n==null||hf(n)?0:n.size}function hf(n){return n!=null&&typeof n=="object"&&"isClosed"in n&&typeof n.isClosed=="boolean"?n.isClosed:!1}function a0(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=io(n-t,o,a),l=io(i+t,o,a);return[s,l]}var Ei;function la(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Vt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){la(o,r,i,a,s,"next",l)}function s(l){la(o,r,i,a,s,"throw",l)}a(void 0)})}}function Cn(n,e,t){return(e=mf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mf(n){var e=vf(n,"string");return typeof e=="symbol"?e:e+""}function vf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mt=W.module("TableUtils");function s0(n){return n===y.sortDirection.ascending||n===y.sortDirection.descending||n===y.sortDirection.reverse||n===y.sortDirection.none}class y{static copyTableAndApplyFilters(e){var t=arguments;return Vt(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(ni(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=y.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return y.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:y.isCharType(e)||y.isNumberType(e)||y.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:y.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,r){var i=e[r];if(i==null)return null;var o=y.getSortForColumn(t,i.name);return o===null?this.makeColumnSort(e,r,y.sortDirection.ascending,!1):o.direction===y.sortDirection.ascending?this.makeColumnSort(e,r,y.sortDirection.descending,!1):null}static makeColumnSort(e,t,r,i){var o=e[t];return o==null||r===y.sortDirection.none?null:{column:{name:o.name,type:o.type},isAbs:i,direction:r}}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t[r]==null)return[];var o=y.getNextSort(t,e,r);return y.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=y.makeColumnSort(t,r,i,o);return y.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=y.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==y.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case y.dataType.BOOLEAN:return y.dataType.BOOLEAN;case"char":case"java.lang.Character":case y.dataType.CHAR:return y.dataType.CHAR;case"java.lang.String":case y.dataType.STRING:return y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case y.dataType.DATETIME:return y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case y.dataType.DECIMAL:return y.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case y.dataType.INT:return y.dataType.INT;default:return y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return y.isIntegerType(e)||y.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static isArrayType(e){return e.includes("[]")}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return y.getNormalizedType(e)===y.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return _e.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return y.makeCancelableEventPromise(e,t,{timeout:r,matcher:i??void 0})}static makeCancelableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{timeout:i=0,matcher:o}=r,a,s,l=!0,u=new Promise((c,h)=>{s=setTimeout(()=>{a(),l=!1,h(new Es('Event "'.concat(t,'" timed out.')))},i),a=e.addEventListener(t,v=>{if(o!=null&&!o(v)){Mt.debug2("Event triggered, but matcher returned false.");return}Mt.debug2("Event triggered, resolving."),a(),clearTimeout(s),l=!1,c(v)})});return u.cancel=()=>{if(l){Mt.debug2("Pending promise cleanup."),a(),clearTimeout(s),l=!1;return}Mt.debug2("Ignoring non-pending promise cancel.")},u}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=y.removeCommas(t);if(y.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return Xs.sort(o,a,t)})}constructor(e){Cn(this,"dh",void 0),this.dh=e,Xd(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return Vt(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(a=yield e.copy(),yield a.applyFilter(ni(...l.map(f=>f(a)))));var c=a.findColumn(t),h=yield a.selectDistinct([c]);a!==e&&a.close();var v=h.findColumn(t).sort()[r]();return o.applySort(h,[v])})()}doesColumnValueExist(e,t,r,i){var o=this;return Vt(function*(){if(e==null)return null;var a=of(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,ni(a(s)));var l=cf(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=y.getNormalizedType(e);switch(t){case y.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case y.dataType.CHAR:case y.dataType.STRING:return this.dh.ValueType.STRING;case y.dataType.DATETIME:return this.dh.ValueType.DATETIME;case y.dataType.DECIMAL:case y.dataType.INT:return y.isBigDecimalType(e)||y.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),u=null,c=0;c<l.length;c+=1){var h=l[c].trim();if(h.length>0){var v=this.makeQuickFilterFromComponent(e,h,r);if(v)u?u=u.and(v):u=v;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&u?o=o.or(u):o=u}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return y.isNumberType(i)?this.makeQuickNumberFilter(e,t):y.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&y.isDateType(i)?this.makeQuickDateFilter(e,t,r):y.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,u=null,c=null,h=null,v=null;if(s!==null&&s.length>3&&([,l,u,c,h,v]=s),v!=null&&v.trim().length>0)return null;if(l==null&&(l="="),h!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(h=h.trim().toLowerCase(),h){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(c==null)return null;if(c=y.removeCommas(c),y.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(f){return Mt.warn("Unable to create long filter",f),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return o=e.filter(),y.makeRangeFilterWithOperation(o,l,c)}static escapeQuickTextFilter(e){if(e==null)return null;var t=/^(!~|!=|~|=|!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null?"\\".concat(o).concat(a??""):a!=null&&r.test(a.toLowerCase())||a!=null&&a.startsWith("*")?"\\".concat(a):a!=null&&a.endsWith("*")&&!a.endsWith("\\*")?(a=a.substring(0,a.length-1),"".concat(a,"\\*")):"".concat(o??"").concat(a??"")}static unescapeQuickTextFilter(e){var t=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null&&(o=o.replace("\\","")),a!=null&&r.test(a.toLowerCase())&&(a=a.replace("\\","")),o==null&&a!=null&&a.startsWith("\\*")&&(a=a.substring(1)),o==null&&a!=null&&a.endsWith("\\*")?(a=a.substring(0,a.length-2),"".concat(a,"*")):"".concat(o??"").concat(a??"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,h=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(h="*",l=l.substring(0,l.length-1)),l=y.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):h==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):h==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),u=e.filter();try{var c=y.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var u=T.eq;switch(s){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=Ee.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,u=s!=null?o.FilterValue.ofNumber(s):null,c=e.filter();if(l==null)return r===T.notEq?c.isNull().not():c.isNull();switch(r){case T.eq:{if(u!=null){var h=c.greaterThanOrEqualTo(l),v=c.lessThan(u);return h.and(v)}return c.eq(l)}case T.lessThan:return c.lessThan(l);case T.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case T.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case T.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case T.notEq:{if(u!=null){var f=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return f.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,u=null;if(a!==null&&a.length>3&&([,s,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var c=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var h=r.FilterValue.ofString(y.isRangeOperation(s)?y.quoteValue(l):l);return y.makeRangeFilterWithOperation(c,s,h)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:h,value:v}=c;if(h!=null&&h.length>0&&v!=null&&v.length>0)try{var f=this.makeAdvancedValueFilter(e,h,v,r);if(f!=null){if(u===0)l=f;else if(l!==null&&u-1<o.length){var p=o[u-1];if(p===er.and)l=l.and(f);else if(p===er.or)l=l.or(f);else{Mt.error("Unexpected filter operator",p,f),l=null;break}}}else Mt.debug2("Empty filter ignored for",h,v)}catch(b){Mt.error("Unable to create filter",b),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(y.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(y.isNumberType(e.type)||y.isCharType(e.type))return this.makeQuickFilter(e,"".concat(y.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case T.eq:return s.eq(a);case T.eqIgnoreCase:return s.eqIgnoreCase(a);case T.notEq:return s.notEq(a);case T.notEqIgnoreCase:return s.notEqIgnoreCase(a);case T.greaterThan:return s.greaterThan(a);case T.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case T.lessThan:return s.lessThan(a);case T.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case T.isTrue:return s.isTrue();case T.isFalse:return s.isFalse();case T.isNull:return s.isNull();case T.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case T.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case T.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case T.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return L(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,Ee.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return L(a),a}return y.isBigDecimalType(e.type)||y.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;y.isTextType(e.type)?r=t.FilterValue.ofString("a"):y.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):y.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=y.getBaseType(e);return y.isTextType(i)?r.FilterValue.ofString(t):y.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(y.removeCommas(t))):r.FilterValue.ofNumber(y.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return y.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):y.isTextType(e)?r.FilterValue.ofString(t):y.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(y.isTextType(e))return t;if(y.isLongType(e))return i.LongWrapper.ofString(y.removeCommas(t));if(y.isBooleanType(e))return y.makeBooleanValue(t,!0);if(y.isDateType(e)){var[o]=Ee.parseDateRange(i,t,r);return o}return y.isNumberType(e)?y.makeNumberValue(t):(Mt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:y.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):y.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}Ei=y;Cn(y,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});Cn(y,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});Cn(y,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);Cn(y,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));Cn(y,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);Cn(y,"executeAndWaitForEvent",function(){var n=Vt(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Ei.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=Ei.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function En(n,e,t){return(e=ff(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ff(n){var e=pf(n,"string");return typeof e=="symbol"?e:e+""}function pf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Al{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=y.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o==null||o.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ws,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;En(this,"defaultColumnFormatter",void 0),En(this,"typeFormatterMap",void 0),En(this,"columnFormatMap",void 0),En(this,"truncateNumbersWithPound",void 0),En(this,"showEmptyStrings",void 0),En(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Zv,this.typeFormatterMap=new Map([[y.dataType.BOOLEAN,new Uv],[y.dataType.CHAR,new Vv],[y.dataType.DATETIME,new gt(e,r)],[y.dataType.DECIMAL,new Ge(e,i)],[y.dataType.INT,new xt(e,o)],[y.dataType.STRING,new ef]]),this.columnFormatMap=Al.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=y.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=y.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(y.dataType.DATETIME);return Td(e,gt),e.dhTimeZone.id}}function Sn(n,e,t){return(e=gf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gf(n){var e=bf(n,"string");return typeof e=="symbol"?e:e+""}function bf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ee{}Sn(ee,"INTEGER","int");Sn(ee,"LONG","long");Sn(ee,"DOUBLE","double");Sn(ee,"BOOLEAN","bool");Sn(ee,"STRING","string");Sn(ee,"DATE_TIME","datetime");Sn(ee,"LOCAL_TIME","localtime");function Rl(n,e){var t=n.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(r,i)=>e(i)),t}function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function da(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){Ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ue(n,e,t){return(e=yf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yf(n){var e=Cf(n,"string");return typeof e=="symbol"?e:e+""}function Cf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ca="unknown",Sf=2147483647,wf=-2147483648,ha=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,ma=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class je{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case ee.STRING:return ee.STRING;case ee.INTEGER:return je.checkInteger(e);case ee.LONG:return je.checkLong(e);case ee.DOUBLE:return je.checkDouble(e);case ee.BOOLEAN:return je.checkBoolean(e);case ee.DATE_TIME:return je.checkDateTime(e);case ee.LOCAL_TIME:return je.checkLocalTime(e);default:return je.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:je.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:t.includes(".")?ee.DOUBLE:ee.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:ee.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ee.BOOLEAN:ee.STRING}static checkDateTime(e){return ha.test(e)?ee.DATE_TIME:ee.STRING}static checkLocalTime(e){return ma.test(e)?ee.LOCAL_TIME:ee.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(je.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?ee.BOOLEAN:ha.test(e)&&e.includes(":")?ee.DATE_TIME:ma.test(e)?ee.LOCAL_TIME:ee.STRING}return je.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ee.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ee.LONG;var r=parseInt(e,10);return r>Sf||r<wf?ee.LONG:ee.INTEGER}constructor(e,t,r,i,o,a,s,l,u,c){Ue(this,"onFileCompleted",void 0),Ue(this,"file",void 0),Ue(this,"readHeaders",void 0),Ue(this,"nullString",void 0),Ue(this,"onProgress",void 0),Ue(this,"onError",void 0),Ue(this,"types",void 0),Ue(this,"chunks",void 0),Ue(this,"totalChunks",void 0),Ue(this,"rowCount",void 0),Ue(this,"isZip",void 0),Ue(this,"shouldTrim",void 0),Ue(this,"zipProgress",void 0),Ue(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=c,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=da(da({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)qn.parse(this.file,this.config);else{var e=Rl(this.file,this.handleNodeUpdate);qn.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:r}=e;if(!this.types){if(r==null||r.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(r[0].length).fill(ca),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,L(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=je.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
7
7
  Expected length `.concat(i.length," but found ").concat(s.length,`.
8
8
  Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var a=this.onProgress(o);a&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;L(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===ca||i===ee.LOCAL_TIME?ee.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}var Fl;function ge(n,e,t){return(e=Ef(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ef(n){var e=Pf(n,"string");return typeof e=="symbol"?e:e+""}function Pf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var br=W.module("CsvParser"),Tf=650;class Rn{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(Rn.generateHeaderRecursive(Math.floor(e/26)-1)),r=e%26),t.concat(String.fromCharCode(65+r))}constructor(e){var{onFileCompleted:t,session:r,file:i,type:o,readHeaders:a=!0,onProgress:s,onError:l,timeZone:u,isZip:c}=e;ge(this,"onFileCompleted",void 0),ge(this,"session",void 0),ge(this,"file",void 0),ge(this,"isZip",void 0),ge(this,"type",void 0),ge(this,"readHeaders",void 0),ge(this,"timeZone",void 0),ge(this,"onProgress",void 0),ge(this,"onError",void 0),ge(this,"tables",void 0),ge(this,"headers",void 0),ge(this,"types",void 0),ge(this,"rowCount",void 0),ge(this,"rowsProcessed",void 0),ge(this,"chunks",void 0),ge(this,"totalChunks",void 0),ge(this,"isComplete",void 0),ge(this,"zipProgress",void 0),ge(this,"consolidatedChunks",void 0),ge(this,"numConsolidated",void 0),ge(this,"isCancelled",void 0),ge(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=c,this.type=o,this.readHeaders=a,this.timeZone=u,this.onProgress=s,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=c?0:Math.ceil(i.size/qn.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:o.delimiter,newline:o.newline,escapeChar:o.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:o.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var r=t.length,i=new Array(e).fill(null).map(()=>new Array(r)),o=0;o<r;o+=1){var a=t[o];if(a.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(a.length,`
9
9
  `).concat(a));for(var s=0;s<e;s+=1){var l=this.type.shouldTrim?t[o][s].trim():t[o][s];i[s][o]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)qn.parse(this.file,this.config);else{var o=Rl(this.file,this.handleNodeUpdate);qn.parse(o,this.config),o.resume()}},t=new je(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:r,onError:i,handleCreateTable:o,isZip:a,tables:s}=this;if(this.isCancelled){br.debug2("CSV parser cancelled."),t.abort(),s.forEach(h=>h.close());return}var{data:l}=e;this.headers||(r?(this.headers=Dt.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Rn.generateHeaders(l[0].length));var u=[];try{if(u=this.transpose(this.headers.length,l),a)this.consolidateChunks(u,t);else{var c=this.chunks;this.chunks+=1,o(c,u,t)}}catch(h){i(h)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var r=0;r<e.length;r+=1)this.consolidatedChunks[r]=this.consolidatedChunks[r].concat(e[r]);this.numConsolidated+=1,(this.numConsolidated>=Tf||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:r}=this,i=this.chunks;this.chunks+=1;var o=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,L(o),r(i,o,e)}handleCreateTable(e,t,r){var{session:i,tables:o,onFileCompleted:a,totalChunks:s,types:l,onProgress:u,onError:c}=this;r&&r.pause(),L(this.headers),L(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(h=>{if(this.isCancelled){br.debug2("CSV parser cancelled."),r&&r.abort(),o.forEach(f=>f.close());return}r&&r.resume(),o[e]=h;var v=0;s>0?v=Math.round(o.length/s*50)+50:v=Math.round(this.rowsProcessed/this.rowCount*50)+50,br.debug2("CSV parser progress ".concat(v)),u(v),this.isComplete&&o.length===this.chunks&&(br.debug2("CSV parser complete."),a(o))}).catch(h=>{!this.isComplete&&r&&r.abort(),c(h)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}Fl=Rn;ge(Rn,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(Fl.generateHeaderRecursive(t));return e});function Ui(n,e,t){return(e=_f(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _f(n){var e=Of(n,"string");return typeof e=="symbol"?e:e+""}function Of(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zt{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Ui(Zt,"DEFAULT_TYPE","DEFAULT_CSV");Ui(Zt,"AUTO","AUTODETECT");Ui(Zt,"TYPES",Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
@@ -21,5 +21,5 @@ Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(thi
21
21
  `&&(r+=`
22
22
  `))}}if(r=r.trimRight(),this.editor.setValue(r),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>we.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-we.truncateSize))}scrollToBottom(){var e,t;if(this.editor){var r=(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(r),this.editor.revealLine(r,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,r=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(r==null||r.length===0)return!1;for(var i=0;i<r.length;i+=1){var o=r[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 r=this.bufferedMessages[t],i=we.getLogText(r);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,we.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,r=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(ae,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:xd,tooltip:"Clear log"}),d.jsx(ae,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Id,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(ar,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}st(we,"DefaultLogLevels",[Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN]);st(we,"AllLogLevels",[Ie.INFO,Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN,Ie.DEBUG,Ie.TRACE]);st(we,"bufferTimeout",16);st(we,"maxLogSize",131072);st(we,"truncateSize",65536);const np="var(--dh-color-chart-colorway)",rp="var(--dh-color-chart-grid)",ip="var(--dh-color-chart-axis-line)",op="var(--dh-color-chart-axis-line-zero)",Pa={"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:np,gridcolor:rp,linecolor:ip,zerolinecolor:op,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)","map-style":"var(--dh-color-chart-map-style)"};var Ta=W.module("ChartTheme");function ap(){var n,e=js(Pa);return e.colorway=Dd((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Nd.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Ta.debug2("Chart theme:",Pa),Ta.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"],map_style:e["map-style"]})}function _a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function sp(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(r){lp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lp(n,e,t){return(e=up(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function up(n){var e=dp(n,"string");return typeof e=="symbol"?e:e+""}function dp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var cp=m.lazy(()=>Bs(()=>import("./Plot-DBz8ZKU9.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function hp(n){return d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(cp,sp({},n))})}var Vi=m.createContext(null);Vi.displayName="ChartThemeContext";function l0(n){var{children:e}=n,{activeThemes:t}=el(),r=m.useMemo(ap,[t]);return d.jsx(Vi.Provider,{value:r,children:e})}function mp(){return or(Vi,"No ChartThemeContext value found.")}function Oa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function vp(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Oa(o,r,i,a,s,"next",l)}function s(l){Oa(o,r,i,a,s,"throw",l)}a(void 0)})}}var fp=W.module("HeapUsage");function pp(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=mp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,h]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=Zs(),p=m.useCallback(vp(function*(){try{var $=yield t.getWorkerHeapInfo();if(!f.current)return;if(u($),o||c){for(var V=($.totalHeapSize-$.freeMemory)/$.maximumHeapSize,K=Date.now(),{timestamps:pe,usages:ke}=v.current;pe.length!==0&&K-pe[0]>a*1.5;)pe.shift(),ke.shift();pe.push(K),ke.push(V)}else v.current={timestamps:[],usages:[]}}catch(j){fp.warn("Unable to get heap usage",j)}}),[t,f,o,c,a]);Ic(p,c?i:r);var g=($,V)=>Math.round($*10**V)/10**V,b=2,w=1024**3,{freeMemory:E,totalHeapSize:P,maximumHeapSize:F}=l,Z=g(E/w,b),re=g(P/w,b),Y=g(F/w,b),k=re-Z,B=function(V,K){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:G("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:V}),d.jsx("div",{children:K})]})},{timestamps:Q,usages:q}=v.current,R=(e=Q[Q.length-1])!==null&&e!==void 0?e:0,U=P/F,X=(P-E)/F;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(U*100,"% - ").concat(U*2,"px")}}),d.jsx("div",{className:G("used-memory",{"heap-overflow":(P-E)/F>.95}),style:{width:"calc(".concat(X*100,"% - ").concat(X*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>h(!0),onExited:()=>h(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[B("In use:","".concat(k.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),B("Free:","".concat(Z.toFixed(b)," GB")),B("Total:","".concat(re.toFixed(b)," GB")),B("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(hp,{data:[{x:[...Q],y:[...q],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(a/6),gridcolor:s.linecolor,range:[R-a,R],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 Ul=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 Vl(n){return n.componentName!==void 0}function gp(n){return n.component!==void 0}var Kl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const bp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ul,isGLComponentConfig:Vl,isReactComponentConfig:gp,itemDefaultConfig:Kl},Symbol.toStringTag,{value:"Module"}));function Dr(n,e,t){return(e=yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yp(n){var e=Cp(n,"string");return typeof e=="symbol"?e:e+""}function Cp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ze{constructor(){Dr(this,"_mSubscriptions",void 0),Dr(this,"off",this.unbind),Dr(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ze.ALL_EVENT]=[]}on(e,t,r){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:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Ze.ALL_EVENT],u=0;u<l.length;u++){var c=l[u].ctx||{};try{l[u].fn.apply(c,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}unbind(e,t,r){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)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Dr(Ze,"ALL_EVENT","__all");function ft(n,e,t){return(e=Sp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sp(n){var e=wp(n,"string");return typeof e=="symbol"?e:e+""}function wp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ti extends Ze{constructor(e,t,r){super(),ft(this,"width",void 0),ft(this,"height",void 0),ft(this,"title",void 0),ft(this,"parent",void 0),ft(this,"layoutManager",void 0),ft(this,"tab",void 0),ft(this,"_config",void 0),ft(this,"isHidden",!1),ft(this,"beforeCloseHandler",void 0),ft(this,"_element",D(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ft(this,"_contentElement",void 0),this.title=Vl(e)?e.componentName:"",this.parent=t,this.layoutManager=r,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 r,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",c=u==="height"?t:e,h=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=c/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[u]=v;else{var g;a.contentItems[p].config[u]=((g=a.contentItems[p].config[u])!==null&&g!==void 0?g:0)+f}return a.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Ep=Object.freeze(Object.defineProperty({__proto__:null,Container:Ti,ItemContainer:Ti},Symbol.toStringTag,{value:"Module"}));function zl(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Gl(n){if(window.location.hash)return zl(n);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},r,i;for(i=0;i<e.length;i++)r=e[i].split("="),t[r[0]]=r[1];return t[n]||null}function Ki(n){return window.requestAnimationFrame(n)}function Pp(n,e){var t=e.indexOf(n);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Rr(){return Ot()}function Tp(n,e){var t=n.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 zi(n){return D.trim(n.replace(/(<([^>]+)>)/gi,""))}function Qe(n,e,t){return(e=_p(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _p(n){var e=Op(n,"string");return typeof e=="symbol"?e:e+""}function Op(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sr extends Ze{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Qe(this,"_eElement",void 0),Qe(this,"_oDocument",void 0),Qe(this,"_eBody",void 0),Qe(this,"_root",void 0),Qe(this,"_destroyAfterMouseUp",void 0),Qe(this,"_nDelay",400),Qe(this,"_timeout",void 0),Qe(this,"timeout",void 0),Qe(this,"_nDistance",10),Qe(this,"_nX",0),Qe(this,"_nY",0),Qe(this,"_nOriginalX",0),Qe(this,"_nOriginalY",0),Qe(this,"_bDragging",!1),this._eElement=e,this._oDocument=D(document),this._eBody=D(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),(r=this._eElement)===null||r===void 0||r.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,r,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r: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,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r: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,r,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.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,r,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"),(r=this._root)===null||r===void 0||r.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,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}function Pn(n,e,t){return(e=xp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xp(n){var e=Ip(n,"string");return typeof e=="symbol"?e:e+""}function Ip(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ql{constructor(e,t){Pn(this,"_container",void 0),Pn(this,"_reactComponent",null),Pn(this,"_portalComponent",null),Pn(this,"_originalComponentWillUpdate",void 0),Pn(this,"_initialState",void 0),Pn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Wr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t,void 0)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=D.extend(e,this._container._config.props);return A.createElement(this._reactClass,t)}}var Fr=["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"],Dp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Gi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return qi(n,e,"_min"),e}function _i(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return qi(n,e,"_max"),e}function qi(n,e,t){var r=t==="_min"?Np:Mp;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[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=r(i,Fr);e[s]=a}qi(o,a,t)}else{var l=r(o,Dp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Fr);e[u]=l}}}}function Np(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Mp(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function ui(n,e,t){return(e=kp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kp(n){var e=jp(n,"string");return typeof e=="symbol"?e:e+""}function jp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Oi{constructor(e,t){ui(this,"name",void 0),ui(this,"origin",void 0),ui(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function yr(n,e,t){return(e=Lp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lp(n){var e=Ap(n,"string");return typeof e=="symbol"?e:e+""}function Ap(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Xl=class extends Ze{constructor(e){super(),yr(this,"_layoutManager",void 0),yr(this,"_dontPropagateToParent",void 0),yr(this,"_childEventSource",void 0),yr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ze.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),D(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];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,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){D(window).off("gl_child_event",this._boundOnEventFromChild)}};function Zl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function Yl(n){return(e,t)=>Zl(e,n,t)}function Ql(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];e.emit(n,...r)}}function Jl(n){return(e,t)=>{var r=m.useRef(null),i=m.useRef(()=>!1);if(r.current!=e||i.current!=t){var o;(o=r.current)===null||o===void 0||o.off(n,i.current),e==null||e.on(n,t)}r.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=r.current)===null||a===void 0?void 0:a.off(n,i.current)},[])}}function wt(n){return{listen:Yl(n),emit:Ql(n),useListener:Jl(n)}}const Rp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Oi,DragListener:sr,EventEmitter:Ze,EventHub:Xl,ReactComponentHandler:ql,animFrame:Ki,filterXss:Tp,getHashValue:zl,getQueryStringParam:Gl,getUniqueId:Rr,listenForEvent:Zl,makeEmitFunction:Ql,makeEventFunctions:wt,makeListenFunction:Yl,makeUseListenerFunction:Jl,minifyConfig:Gi,removeFromArray:Pp,stripTags:zi,unminifyConfig:_i},Symbol.toStringTag,{value:"Module"}));function Wt(n,e,t){return(e=Fp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=$p(n,"string");return typeof e=="symbol"?e:e+""}function $p(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eu extends Ze{constructor(e,t,r,i,o){super(),Wt(this,"isInitialised",!1),Wt(this,"_config",void 0),Wt(this,"_dimensions",void 0),Wt(this,"_parentId",void 0),Wt(this,"_indexInParent",void 0),Wt(this,"_layoutManager",void 0),Wt(this,"_popoutWindow",null),Wt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,u,c,h;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(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&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=D.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=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,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;D(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=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Rr();e=Gi(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[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 Oe(n,e,t){return(e=Hp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hp(n){var e=Bp(n,"string");return typeof e=="symbol"?e:e+""}function Bp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wn extends Ze{constructor(e,t,r,i,o,a){var s,l,u,c,h,v,f,p;if(super(),Oe(this,"_dragListener",void 0),Oe(this,"_layoutManager",void 0),Oe(this,"_contentItem",void 0),Oe(this,"_originalParent",void 0),Oe(this,"_area",null),Oe(this,"_lastValidArea",null),Oe(this,"_minX",void 0),Oe(this,"_maxX",void 0),Oe(this,"_minY",void 0),Oe(this,"_maxY",void 0),Oe(this,"_width",void 0),Oe(this,"_height",void 0),Oe(this,"_sided",void 0),Oe(this,"element",void 0),Oe(this,"childElementContainer",void 0),Oe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=D(wn._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",zi((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(),D(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,E;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((E=this._proxyTab.outerHeight(!0))!==null&&E!==void 0?E:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(c=P==null?void 0:P.top)!==null&&c!==void 0?c:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(p=this.element.height())!==null&&p!==void 0?p:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.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,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Oe(wn,"_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 Cr(n,e,t){return(e=Wp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wp(n){var e=Up(n,"string");return typeof e=="symbol"?e:e+""}function Up(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tu{constructor(e,t,r){Cr(this,"_element",void 0),Cr(this,"_itemConfig",void 0),Cr(this,"_layoutManager",void 0),Cr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new sr(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 r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}function Sr(n,e,t){return(e=Vp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vp(n){var e=Kp(n,"string");return typeof e=="symbol"?e:e+""}function Kp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nu{constructor(e,t,r){Sr(this,"_element",D(window)),Sr(this,"_itemConfig",void 0),Sr(this,"_layoutManager",void 0),Sr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&this._layoutManager&&(this._dragListener=new sr(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 r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}}function ru(n,e,t){return(e=zp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zp(n){var e=Gp(n,"string");return typeof e=="symbol"?e:e+""}function Gp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class lr{constructor(){ru(this,"element",D(lr._template)),D(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()}}ru(lr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function di(n,e,t){return(e=qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qp(n){var e=Xp(n,"string");return typeof e=="symbol"?e:e+""}function Xp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gn{constructor(e,t,r,i){di(this,"element",void 0),di(this,"_header",void 0),di(this,"_action",void 0),this._header=e,this.element=D('<li class="'+r+'" 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 Zp(n,e,t){return(e=Yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yp(n){var e=Qp(n,"string");return typeof e=="symbol"?e:e+""}function Qp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mn extends Error{constructor(e,t){super(),Zp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Jp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:mn},Symbol.toStringTag,{value:"Module"}));function Te(n,e,t){return(e=eg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eg(n){var e=tg(n,"string");return typeof e=="symbol"?e:e+""}function tg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vn(n){return n.isStack}function Ae(n){return n.isComponent}function iu(n){return n.isRoot}class Ne extends Ze{constructor(e,t,r,i){super(),Te(this,"config",void 0),Te(this,"type",void 0),Te(this,"contentItems",void 0),Te(this,"parent",void 0),Te(this,"layoutManager",void 0),Te(this,"element",void 0),Te(this,"childElementContainer",void 0),Te(this,"componentName",void 0),Te(this,"isInitialised",!1),Te(this,"isMaximised",!1),Te(this,"isRoot",!1),Te(this,"isRow",!1),Te(this,"isColumn",!1),Te(this,"isStack",!1),Te(this,"isComponent",!1),Te(this,"tab",void 0),Te(this,"_pendingEventPropagations",void 0),Te(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Ze.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=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(r!==!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 r=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]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,vn(this)&&this.header.tabs[i].setContentItem(t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),r(o.contentItems[a])};return r(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),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$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"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&Ae(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r: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 Oi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new mn("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(Kl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof Oi&&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,Ki(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Wn(n,e,t){return(e=ng(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ng(n){var e=rg(n,"string");return typeof e=="symbol"?e:e+""}function rg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ou extends Ne{constructor(e,t,r){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,r,D()),Wn(this,"config",void 0),Wn(this,"componentName",void 0),Wn(this,"container",void 0),Wn(this,"parent",void 0),Wn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=D.extend(!0,{},this.config.componentState||{});if(o==null)throw new mn('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 Ti(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(){Ne.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Ne.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),Ne.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Ne.prototype._$destroy.call(this)}_$getArea(){return null}}function dt(n,e,t){return(e=ig(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ig(n){var e=og(n,"string");return typeof e=="symbol"?e:e+""}function og(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tr extends Ne{constructor(e,t,r,i){super(t,r,i,D('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),dt(this,"isRow",void 0),dt(this,"isColumn",void 0),dt(this,"childElementContainer",void 0),dt(this,"parent",void 0),dt(this,"_splitter",[]),dt(this,"_splitterSize",void 0),dt(this,"_splitterGrabSize",void 0),dt(this,"_isColumn",void 0),dt(this,"_dimension",void 0),dt(this,"_splitterPosition",null),dt(this,"_splitterMinPosition",null),dt(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,r){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),Ne.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!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 r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r: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(Ne.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var c;l=this.contentItems[0],this.contentItems=[],(c=this.parent)===null||c===void 0||c.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,r),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(Ne.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,r=(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-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,c,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));a+=h,s.push(h)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];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[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==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,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var h=u.itemSizes[c];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},r.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<r.length;f++){l=r[f];var p=Math.round((l.width-t)*v);a-=p,l.width-=p}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new au(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,r=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,c=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),h=this._isColumn?c.vertical:c.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(h||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r: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,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=c*h,s.after.config[this._dimension]=(1-c)*h,e.element.css({top:0,left:0}),Ki(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function xa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ia(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(r){xi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xi(n,e,t){return(e=ag(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ag(n){var e=sg(n,"string");return typeof e=="symbol"?e:e+""}function sg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ii extends Ne{constructor(e,t,r){super(e,Ia(Ia({},t),{},{type:"root"}),null,D('<div class="lm_goldenlayout lm_item lm_root"></div>')),xi(this,"childElementContainer",void 0),xi(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,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 r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r: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,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(Ae(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!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 tr)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var c,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((c=h.config[a])!==null&&c!==void 0?c:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}function Da(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Da(Object(t),!0).forEach(function(r){rt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Da(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function rt(n,e,t){return(e=lg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lg(n){var e=ug(n,"string");return typeof e=="symbol"?e:e+""}function ug(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Di extends Ne{constructor(e,t,r){var i,o,a,s,l,u,c,h,v;super(e,t,r,D('<div class="lm_item lm_stack"></div>')),rt(this,"_activeContentItem",null),rt(this,"_header",void 0),rt(this,"childElementContainer",D('<div class="lm_items"></div>')),rt(this,"header",void 0),rt(this,"parent",void 0),rt(this,"isStack",!0),rt(this,"_dropSegment",null),rt(this,"_contentAreaDimensions",null),rt(this,"_dropIndex",void 0),rt(this,"_side",void 0),rt(this,"_sided",!1),rt(this,"config",void 0),this.parent=r,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(h=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=Tn(Tn({},this._header),f.header)),t.header&&(this._header=Tn(Tn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Tn(Tn({},this._header),t.content[0].header)),this.header=new Rt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,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=((r=this.element.width())!==null&&r!==void 0?r: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),Ae(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,r=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(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Ne.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",r=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=this.parent instanceof tr&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Ae(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var h,v=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));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 r=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+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.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+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.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,r,i,o,a,s,l,u,c,h,v,f,p,g,b,w,E=this.header.tabs.length;if(E===0){var P,F,Z,re,Y,k,B,Q,q=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(F=q==null?void 0:q.left)!==null&&F!==void 0?F:0,x2:((Z=q==null?void 0:q.left)!==null&&Z!==void 0?Z:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((k=(B=this.header.element.offset())===null||B===void 0?void 0:B.top)!==null&&k!==void 0?k:0)+((Q=this.header.element.innerHeight())!==null&&Q!==void 0?Q:0)});return}var R=this.header.tabsContainer,U=(t=R.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),X=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!U||!X)){e<U.left?e=U.left+1:e>U.right&&(e=U.right-1);var $,V;if(!(X.left<e&&e<X.right)){for(var K=0;K<E;K++){var pe;if($=this.header.tabs[K].element,V=(pe=$.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=K;break}}if($&&V&&e<V.left+V.width*.5)$.before(this.layoutManager.tabDropPlaceholder);else if($){var ke;this._dropIndex=Math.min(((ke=this._dropIndex)!==null&&ke!==void 0?ke:0)+1,E),$.after(this.layoutManager.tabDropPlaceholder)}}var j=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;j=Math.max(j,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var C=j+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);C=Math.min(C,((u=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:j,x2:C,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===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,r=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}this._dropSegment=e}}const dg=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Ne,Component:ou,ContentItem:Ne,Root:Ii,RowOrColumn:tr,Stack:Di,isComponent:Ae,isRoot:iu,isStack:vn},Symbol.toStringTag,{value:"Module"}));function jt(n,e,t){return(e=cg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cg(n){var e=hg(n,"string");return typeof e=="symbol"?e:e+""}function hg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ur{constructor(e,t){var r;jt(this,"header",void 0),jt(this,"contentItem",void 0),jt(this,"element",D(ur._template)),jt(this,"titleElement",void 0),jt(this,"closeElement",void 0),jt(this,"isActive",!1),jt(this,"_layoutManager",void 0),jt(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,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new sr(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),Ae(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.text(e)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Ae(this.contentItem)&&this.contentItem.container._contentElement.off(),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 r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new wn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){Ae(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(D(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){Ae(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&Ae(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ae(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),Ae(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(),Ae(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()}_isInNestedLayout(e){var t=D(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!Ae(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}jt(ur,"_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(n,e,t){return(e=mg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mg(n){var e=vg(n,"string");return typeof e=="symbol"?e:e+""}function vg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rt extends Ze{constructor(e,t){var r,i;super(),se(this,"layoutManager",void 0),se(this,"element",D(Rt._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",D(Rt._nextButtonTemplate)),se(this,"tabPreviousButton",D(Rt._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,(r=this.layoutManager.config.settings)!==null&&r!==void 0&&r.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 r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===e)return;var i=new ur(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,r,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||(r=t.scrollIntoView)===null||r===void 0||r.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 r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_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 r,i,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,c;l.scrollLeft=(u=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r: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,r;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)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,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((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(c=>{var h,v,f=o||c,p=c-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(h=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),D(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,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Gn(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),r=this._getHeaderSetting("popout"),new Gn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Gn(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),r=this._getHeaderSetting("close"),this.closeButton=new Gn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),D(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"),D(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var c=(s+l+u.length)%u.length;c!==s;){if(u.eq(c).css("display")!=="none")return c;c=(c+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.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 r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-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,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.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(),D(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,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=(r=D(window).height())!==null&&r!==void 0?r:0,l=(i=D(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<s-u.bottom,h=!c&&u.bottom>s*.6,v=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}se(Rt,"_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(Rt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));se(Rt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Un(n,e,t){return(e=fg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fg(n){var e=pg(n,"string");return typeof e=="symbol"?e:e+""}function pg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class au{constructor(e,t,r){Un(this,"_isVertical",void 0),Un(this,"_size",void 0),Un(this,"_grabSize",void 0),Un(this,"_dragListener",void 0),Un(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new sr(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=D('<div class="lm_drag_handle"></div>'),t=D('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const gg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:eu,DragProxy:wn,DragSource:tu,DragSourceFromEvent:nu,DropTargetIndicator:lr,Header:Rt,HeaderButton:Gn,Splitter:au,Tab:ur},Symbol.toStringTag,{value:"Module"}));var bg={config:bp,container:Ep,controls:gg,errors:Jp,items:dg,utils:Rp};function Na(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Je(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(r){ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ue(n,e,t){return(e=yg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yg(n){var e=Cg(n,"string");return typeof e=="symbol"?e:e+""}function Cg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ma=["column","row","stack","component"];class Gr extends Ze{static isLayoutItemConfig(e){return Ma.includes(e.type)}static minifyConfig(e){return Gi(e)}static unminifyConfig(e){return _i(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":ql}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",D('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"_initialHeaderHeight",void 0),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Xl(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",D('<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&&D("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 r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}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 Ne))throw new Error("Root must be a ContentItem");var t={settings:Je({},this.config.settings),dimensions:Je({},this.config.dimensions),labels:Je({},this.config.labels),content:[]},r=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]={},r(a.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(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){D(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 lr,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 r=this._reactChildMap.get(e);r===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 r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r: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(),D(window).off("resize",this._onResize),D(window).off("unload beforeunload",this._onUnload),D(window).off("blur.lm").off("focus.lm"),D(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 r,i;if(typeof e.type!="string")throw new mn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Gr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Ma.join(","),new mn(i);return e.type==="component"&&!(t instanceof Di)&&t&&!(this.isSubWindow===!0&&t instanceof Ii)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Rr(),e.type==="stack"?new Di(this,e,t):e.type==="row"?new tr(!1,this,e,t):e.type==="column"?new tr(!0,this,e,t):new ou(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof Ne,s=this;if(a){var l;o=this.toConfig(e).content,r=Rr();for(var u=e.parent,c=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;c=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(c)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,E=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+E.left,top:w+E.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var P=new eu(o,t,r,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 r=new tu(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new nu(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,r;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((r=this.container.height())!==null&&r!==void 0?r: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 r=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&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Je({},this.root._$getArea()),r=[Je(Je({},t),{},{side:"left",x2:t.x1+e}),Je(Je({},t),{},{side:"right",x1:t.x2-e}),Je(Je({},t),{},{side:"top",y2:t.y1+e}),Je(Je({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$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 r=e[t];if(vn(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Je(Je({},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 Ne)return e;if(D.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.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=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&D(window).resize(this._onResize),D(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,r=Gl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=_i(e),localStorage.removeItem(r));var i=D.extend(!0,{},Ul,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=D('<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=zi((e=this.config.content[0].title)!==null&&e!==void 0?e:""),D("head").append(D("body link, body style, template, .gl_keep")),this.container=D("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?D(this._originalContainer):D("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,D("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 mn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new mn(t,e);this.root=new Ii(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,r=e*t;if(!(this.width==null||r<=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(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{vn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ue(Gr,"__lm",bg);const ka={"tab-height":"28px","drag-border-width":"5px"},ja=Object.freeze({tabHeight:parseInt(ka["tab-height"],10),dragBorderWidth:parseInt(ka["drag-border-width"],10)});function La(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?La(Object(t),!0).forEach(function(r){su(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):La(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function su(n,e,t){return(e=Sg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sg(n){var e=wg(n,"string");return typeof e=="symbol"?e:e+""}function wg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ut=W.module("LayoutUtils");function lu(n){return n.componentName!==void 0}function qt(n){var e=n;return(lu(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function wr(n){return n.focus!==void 0}function Aa(n){return n.type==="stack"}class _{static activateTab(e,t){var r=_.getStackForRoot(e,t,!1);if(!r){Ut.error("Could not find stack for config",t);return}var i=_.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=_.getStackForRoot(e,t,!1);if(!r)return Ut.error("Could not find stack for config",t),!1;var i=_.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(iu(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,c,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(c=s.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(s,h),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(r=>r.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=_.getAllStackContainers(e),r=_.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&vn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(vn(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 r;if(((r=e.config)===null||r===void 0?void 0:r.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]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&vn(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&&oo(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}return null}static getStackForRoot(e,t){var r=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&&r&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var r=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=_.getStackForRoot(e,{component:s},r&&l,i,o);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&oo(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i],{content:a}=o;if(qt(o)){var s=t(o.component,o);s!=null?r.push(s):Ut.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=kt(kt({},o),{},{content:_.dehydrateLayoutConfig(a,t)});r.push(l)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(Aa(r)&&delete r.activeItemIndex,_.dropLayoutMinorChange(i)):qt(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=_.cloneLayout(e),o=_.cloneLayout(t);return r?(_.dropLayoutMinorChange(i),_.dropLayoutMinorChange(o),Qn(i,o)):Qn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i];if(qt(o)){var a,{component:s,props:l={}}=o;r.push(kt(kt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Ot(),props:t(s,l)}))}else if(o.content!==void 0){var u=_.hydrateLayoutConfig(o.content,t);Aa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ut.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(kt(kt({},o),{},{content:u}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,c=kt({},t);if(c.id==null&&(c.id=Ot()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var h=o||{id:c.id,component:c.component};L(e);var v=r??(a?_.addStack(e):_.getStackForRoot(e,h));L(v);var f=_.getContentItemInStack(v,h);if(s!=null){var p=b=>{Ut.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:w}=b.origin;requestAnimationFrame(()=>{_.focusElement(w[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(c,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(c);s==null&&u&&wr(u)&&u.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=_.getContentItemInStack(e,o);if(r&&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&&wr(i)&&i.focus()}static closeComponent(e,t,r){var i=_.getStackForRoot(e,t,!1,!1,!1);if(!i){Ut.warn("Cannot find stack for component, ignoring close",t);return}var o=_.getContentItemInStack(i,t),a=document.activeElement;o&&(Ae(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&wr(a)&&a.focus()}static renameComponent(e,t,r){var i=_.getStackForRoot(e,t,!1);if(!i){Ut.error("Could not find stack for config",t);return}var o=_.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=_.getStackForRoot(e,t,!1);if(!r)return Ut.error("Could not find stack for config",t),null;var{props:i={}}=t,o=_.getPanelComponentState(t),a={type:"react-component",component:t.component,props:kt(kt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Ot()};return _.openComponentInStack(r,a),a}static getPanelComponentState(e){if(lu(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(qt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ja.tabHeight,borderWidth:ja.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=_.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return _.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=_.getComponentConfigFromContainer(t);if(r&&qt(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.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]:_.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(wr(r)&&r.focus(),r)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var r=()=>{e.off("initialised",r),t()};e.on("initialised",r)})}}su(_,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Eg=A.forwardRef((n,e)=>{var t=_.getComponentNameFromPanel({props:n});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Eg.displayName="PanelPlaceholder";var le=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:d0,emit:Pg,useListener:c0}=wt(le.OPEN),{listen:h0,emit:Ra,useListener:m0}=wt(le.CLOSE),qr=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:Tg,emit:v0,useListener:f0}=wt(qr.CYCLE_TO_NEXT_STACK),{listen:_g,emit:p0,useListener:g0}=wt(qr.CYCLE_TO_PREVIOUS_STACK),{listen:Og,emit:b0,useListener:y0}=wt(qr.CYCLE_TO_NEXT_TAB),{listen:xg,emit:C0,useListener:S0}=wt(qr.CYCLE_TO_PREVIOUS_TAB);function Ig(n){return typeof n.id=="string"&&n.layout instanceof Gr&&n.panelManager instanceof Xi&&typeof n.registerComponent=="function"}function Dg(n){if(!Ig(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function Fa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $a(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(r){At(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function At(n,e,t){return(e=Ng(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ng(n){var e=Mg(n,"string");return typeof e=="symbol"?e:e+""}function Mg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ct=W.module("PanelManager"),dn=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}(dn||{});class Xi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=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]:()=>{};At(this,"layout",void 0),At(this,"hydrateComponent",void 0),At(this,"dehydrateComponent",void 0),At(this,"onPanelsUpdated",void 0),At(this,"closed",void 0),At(this,"openedMap",void 0),At(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=r,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(le.FOCUS,this.handleFocus),e.on(le.MOUNT,this.handleMount),e.on(le.UNMOUNT,this.handleUnmount),e.on(le.REOPEN,this.handleReopen),e.on(le.REOPEN_LAST,this.handleReopenLast),e.on(le.DELETE,this.handleDeleted),e.on(le.CLOSED,this.handleClosed),e.on(le.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(Tg(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(_g(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(Og(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(xg(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(le.FOCUS,this.handleFocus),e.off(le.MOUNT,this.handleMount),e.off(le.UNMOUNT,this.handleUnmount),e.off(le.REOPEN,this.handleReopen),e.off(le.REOPEN_LAST,this.handleReopenLast),e.off(le.DELETE,this.handleDeleted),e.off(le.CLOSED,this.handleClosed),e.off(le.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 _.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&qt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=_.getStackForConfig(this.layout.root,{id:e});return(t=r&&_.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>Mr(r)&&t instanceof r.WrappedComponent||!Mr(r)&&t instanceof r))}updatePanel(e){var t=_.getIdFromPanel(e);if(t==null){ct.error("updatePanel Panel did not have an ID",e);return}ct.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=_.getIdFromPanel(e);if(t==null){ct.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ct.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ct.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ct.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){ct.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ct.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ct.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=_.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=_.getFocusedStackIndex(t);if(r===-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===dn.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,c=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack(dn.Next)}handleCycleToPreviousStack(){this.cycleStack(dn.Previous)}cycleTab(e){var t,r=_.getFocusedStack(this.layout);if(r!==void 0){var{contentItems:i}=r;if(!(i.length<=1)){var o=(t=r.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===dn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];r.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(dn.Next)}handleCycleToPreviousTab(){this.cycleTab(dn.Previous)}handleReopen(e,t){ct.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=$a($a({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:_.getStackById(a,e.parentStackId);_.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 r=(t=_.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===r){this.handleReopen(o);return}}}}handleDeleted(e){ct.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ct.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;_.closeComponent(r,t)}addClosedPanel(e){var t=_.getComponentConfigFromContainer(e);if(t&&qt(t)){var r=this.dehydrateComponent(t.component,t);if(r!=null){var i;r.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(r)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}At(Xi,"MAX_CLOSED_PANEL_COUNT",100);var kg=W.module("PanelErrorBoundary");class jg 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,r=_.getIdFromContainer(e);kg.debug("componentWillUnmount",r),t.emit(le.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(bn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Ha(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ha(Object(t),!0).forEach(function(r){Lg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lg(n,e,t){return(e=Ag(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Rg(n,"string");return typeof e=="symbol"?e:e+""}function Rg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function uu(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return r!=null&&(o.metadata=r),i!=null&&(o.panelState=i),$r($r({},n),{},{componentState:null,props:o,type:"react-component"})}function du(n,e){return $r($r({},n),{},{localDashboardId:e})}const Fg={dehydrate:uu,hydrate:du};var cu=A.createContext(void 0);cu.displayName="LayoutManagerContext";var $g=ye.shape({on:ye.func,off:ye.func,isHidden:ye.bool,tab:ye.shape({header:ye.shape({tabs:ye.arrayOf(ye.shape({contentItem:ye.shape({})}))})}),title:ye.string,setTitle:ye.func,close:ye.func}),hu=ye.shape({on:ye.func,off:ye.func,emit:ye.func}),Hg=ye.shape({registerComponent:ye.func,root:ye.shape({addChild:ye.func}),on:ye.func,off:ye.func,eventHub:hu}),w0=Object.freeze({Container:$g,EventHub:hu,Layout:Hg});function Vn(n,e,t,r){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.");A.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}function Le(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var mu="SET_DASHBOARD_DATA";const Bg=Dm(mu,{},!1),Wg={dashboardData:Bg};var Ug=new Map,vu=Object.freeze({}),Vg=Object.freeze([]),E0=Ai,Kg=ws,P0=Gu,zg=n=>n.dashboardData,He=(n,e)=>{var t;return(t=zg(n)[e])!==null&&t!==void 0?t:vu},T0=(n,e)=>{var t;return(t=He(n,e).closed)!==null&&t!==void 0?t:Vg},_0=(n,e)=>{var t;return(t=He(n,e).openedMap)!==null&&t!==void 0?t:Ug},fu=(n,e)=>{var t;return(t=He(n,e).pluginDataMap)!==null&&t!==void 0?t:vu},O0=(n,e,t)=>fu(n,e)[t];function Ba(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Nn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ba(Object(t),!0).forEach(function(r){Gg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Gg(n,e,t){return(e=qg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qg(n){var e=Xg(n,"string");return typeof e=="symbol"?e:e+""}function Xg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var pu=(n,e)=>({type:mu,id:n,payload:e}),nn=(n,e)=>(t,r)=>t(pu(n,Nn(Nn({},He(r(),n)),e))),x0=(n,e,t)=>(r,i)=>r(pu(n,Nn(Nn({},He(i(),n)),{},{pluginDataMap:Nn(Nn({},fu(i(),n)),{},{[e]:t})})));Object.entries(Wg).map(n=>{var[e,t]=n;return Md.register(e,t)});var gu=m.createContext(null);gu.displayName="PersistentStateContext";function Er(n,e){return"".concat(n,"::").concat(e)}function Zg(n){var{initialState:e,onChange:t,children:r}=n,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),[a]=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=m.useRef(new Map),l=m.useCallback((p,g,b)=>{var{type:w}=b,E=Er(g,w),P=s.current.get(E);if(P!=null&&P!==p)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));s.current.set(E,p),i.current&&a.get(E)!==b&&(a.set(E,b),t([...a.entries()]))},[i,t,a]),u=m.useRef(e[Symbol.iterator]()),c=m.useCallback((p,g)=>{var b=Er(p,g),w=a.get(b);if(w==null&&o.current){var{value:E}=u.current.next(),P=E;return a.set(b,P),P}return w},[a]),h=m.useCallback((p,g,b)=>{var w=Er(g,b),E=s.current.get(w);E===p&&(a.delete(w),s.current.delete(w),i.current&&t([...a.entries()]))},[i,t,a]),v=m.useCallback((p,g,b)=>{var w=Er(g,b),E=s.current.get(w);E===p&&s.current.delete(w)},[]),f=m.useMemo(()=>({addState:l,removeState:h,deregisterHook:v,getState:c}),[l,c,h,v]);return d.jsx(gu.Provider,{value:f,children:r})}var Yg=W.module("DashboardPanelWrapper");function Qg(n){var{glContainer:e,children:t}=n,r=m.useCallback(a=>{e.setPersistedState(a)},[e]),{persistedState:i}=e.getConfig(),[o]=m.useState(()=>i!=null&&!Array.isArray(i)?(Yg.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return d.jsx(Zg,{initialState:o,onChange:r,children:t})}var Zi=m.createContext(null);Zi.displayName="PanelIdContext";function Jg(){return m.useContext(Zi)}function Wa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function an(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wa(Object(t),!0).forEach(function(r){eb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function eb(n,e,t){return(e=tb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tb(n){var e=nb(n,"string");return typeof e=="symbol"?e:e+""}function nb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _n=W.module("DashboardLayout"),rb=Object.freeze({}),ib=[],Ua=()=>{},ob=1e3,Va=n=>n;function I0(n){var e,t,{id:r,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=ib,onLayoutChange:l=Ua,onLayoutInitialized:u=Ua,hydrate:c=du,dehydrate:h=uu,panelWrapper:v}=n,f=Ai(),p=(e=ws(j=>He(j,r)))!==null&&e!==void 0?e:rb,[g,b]=m.useState(!1),[w,E]=m.useState(!1),P=m.useRef(),[F]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[Z,re]=m.useState(a.getReactChildren()),Y=m.useMemo(()=>new Map,[]),k=m.useMemo(()=>new Map,[]),B=m.useCallback(function(j,C){var S,M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h;_n.debug2("registerComponent",j,C,M,z);function ie(x,J){var oe=C,fe=v,Be=sl(oe),Et=Be?d.jsx(oe,an(an({},x),{},{ref:J})):d.jsx(oe,an({},x)),{glContainer:Pt,glEventHub:ti}=x,Bn=_.getIdFromContainer(Pt);return d.jsx(jg,{glContainer:Pt,glEventHub:ti,children:d.jsx(Zi.Provider,{value:Bn,children:d.jsx(Qg,an(an({},x),{},{children:fe==null?Et:d.jsx(fe,an(an({},x),{},{children:Et}))}))})})}ie.displayName="DashboardWrapper(".concat((S=C.displayName)!==null&&S!==void 0?S:j,")");var mt=a.registerComponent(j,A.forwardRef(ie));return Y.set(j,M),k.set(j,z),mt},[c,h,Y,k,a,v]),Q=m.useCallback((j,C)=>{var S;return((S=Y.get(j))!==null&&S!==void 0?S:Va)(C,r)},[Y,r]),q=m.useCallback((j,C)=>{var S;return((S=k.get(j))!==null&&S!==void 0?S:Va)(C,r)},[k,r]),R=m.useMemo(()=>new Xi(a,Q,q,new Map,F,j=>{var{closed:C,openedMap:S}=j;f(nn(r,{closed:C,openedMap:S}))}),[q,f,Q,r,F,a]),U=Mc(j=>{var C=P.current,S=C==null||!_.isEqual(C,j);_n.debug("handleLayoutStateChanged",S,j),S&&(_n.debug("Layout config has changed","lastConfig",C,"dehydratedLayoutConfig",j),b(a.root.contentItems.length===0),P.current=j,l(j),re(a.getReactChildren()))},ob,{flushOnUnmount:!0});m.useEffect(()=>()=>U.flush(),[U]);var X=m.useCallback(()=>{if(!w){var j=a.toConfig(),C=j.content,S=_.dehydrateLayoutConfig(C,q);U(S)}},[q,w,a,U]),$=m.useCallback(j=>{var C=_.getIdFromContainer(j);a.eventHub.emit(le.DRAGGING,C),E(!0)},[a.eventHub]),V=m.useCallback(j=>{var C=_.getIdFromContainer(j);a.eventHub.emit(le.DROPPED,C),E(!1)},[a.eventHub]),K=m.useCallback(j=>{if(_n.debug2("handleComponentCreated",j),!(j==null||j.config==null||!qt(j.config)||j.config.component==null||j.element==null)){var C=j.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),S="".concat(C,"-component");j.element.addClass(S)}},[]),pe=m.useCallback(()=>{re(a.getReactChildren())},[a]);Le(a,"stateChanged",X),Le(a,"itemPickedUp",$),Le(a,"itemDropped",V),Le(a,"componentCreated",K),Le(a.eventHub,le.TITLE_CHANGED,X),Le(a,"reactChildrenChanged",pe);var ke=Nc(s);return m.useEffect(function(){if(ke!==s&&s!==P.current){_n.debug("loadNewConfig effect triggered. previousLayoutConfig",ke,"layoutConfig",s,"lastConfig",P.current),_n.debug("Setting new layout content...");for(var C=_.hydrateLayoutConfig(s,Q);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var S=0;S<C.length;S+=1)a.root.addChild(C[S]);b(a.root.contentItems.length===0)}},[Q,a,s,R,ke]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,Z,A.Children.map(i,j=>j!=null?d.jsx(Xh,{fallback:[],children:A.cloneElement(j,{id:r,layout:a,panelManager:R,registerComponent:B})}):null)]})}var bu=m.createContext(null);bu.displayName="DashboardIdContext";function D0(){var n=m.useContext(bu);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function ab(n,e,t){return(e=sb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sb(n){var e=lb(n,"string");return typeof e=="symbol"?e:e+""}function lb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function yu(n,e,t){if(n){if(t(n)===!0)return n;for(var r=n.child;r;){var i=yu(r,e,t);if(i)return i;r=r.sibling}}}function ub(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var Yi=ub(m.createContext(null));Yi.displayName="FiberContext";class N0 extends m.Component{constructor(){super(...arguments),ab(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Yi.Provider,{value:this._reactInternals,children:e})}}function db(){var n=m.useContext(Yi);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>Ot()),t=m.useMemo(()=>{for(var r of[n,n==null?void 0:n.alternate].filter(o=>o!=null)){var i=yu(r,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[n,e]);return t}var M0="default",cb="CREATE_DASHBOARD",hb="CLOSE_DASHBOARD",{listen:k0,emit:mb,useListener:j0}=wt(cb),{listen:L0,emit:vb,useListener:A0}=wt(hb);function fb(n,e,t){return(e=pb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pb(n){var e=gb(n,"string");return typeof e=="symbol"?e:e+""}function gb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cu 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:r}=this.props;return[...(e=r==null||(t=r.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 r;return(r=(t==null?void 0:t.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s;if(((i=t[r].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[r])===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(le.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!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){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o=!!(!((i=e[r])===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:r,glContainer:i}=this.props,o=(e=_.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:r}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:ne.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var o=(e=r.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:ne.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:ne.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:ne.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(ne,{actions:i})}}fb(Cu,"defaultProps",{additionalActions:[]});var bb=n=>({workspace:Sl(n)}),yb=$n(bb,{setWorkspace:El})(Cu);function Su(n,e,t){return(e=Cb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cb(n){var e=Sb(n,"string");return typeof e=="symbol"?e:e+""}function Sb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wu extends m.PureComponent{constructor(e){super(e),Su(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=A.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!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,r=t==null?void 0:t.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return d.jsxs("form",{className:G("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(r,"-input"),children:["Rename ",r]}),d.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),d.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(ae,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(ae,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Ur,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Su(wu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var Pr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Ka(n,e,t){return(e=wb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wb(n){var e=Eb(n,"string");return typeof e=="symbol"?e:e+""}function Eb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pb=W.module("Panel");class Tb extends m.PureComponent{constructor(e){super(e),Ka(this,"ref",void 0),Ka(this,"getAdditionalActions",Qt((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),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=A.createRef();var{glContainer:t}=this.props;this.state={title:_.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,{componentPanel:t,glContainer:r,glEventHub:i}=this.props;r.on("resize",this.handleResize),r.on("show",this.handleBeforeShow),r.on("shown",this.handleShow),r.on("hide",this.handleHide),r.on("tab",this.handleTab),r.on("tabClicked",this.handleTabClicked),i.on(Pr.focus,this.handleTabFocus),i.on(Pr.blur,this.handleTabBlur),i.emit(le.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:r}=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),r.off(Pr.focus,this.handleTabFocus),r.off(Pr.blur,this.handleTabBlur),r.emit(le.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:_.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:r}=this.props;r.emit(le.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,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleResize(){for(var{onResize:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=_.getRootFromContainer(t),i=_.getComponentConfigFromContainer(t);L(i),_.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=_.getRootFromContainer(e),i=_.getComponentConfigFromContainer(e);if(i==null){Pb.error("Could not get component config from container",e);return}var o=_.cloneComponent(r,i);o!==null&&t.emit(le.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ne.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ne.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a=Ws,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:c=!1,isRenamable:h=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:G("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(bn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Wr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(yb,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,c,h)}),h&&d.jsx(wu,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),v.element[0])]})}}var _b=vl(Tb),Ob=W.module("useDhId"),ci="__dhId";function R0(){var n,e,t=(n=(e=db())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[ci],i=Jg();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(ci," to be a string, but got ").concat(typeof r));return r}return i??(Ob.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ci," prop. Defaulting to null.")),null)}function dr(n,e,t){return(e=xb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xb(n){var e=Ib(n,"string");return typeof e=="symbol"?e:e+""}function Ib(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qe{}dr(qe,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");dr(qe,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");dr(qe,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");dr(qe,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");dr(qe,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function rn(n,e,t){return(e=Db(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Db(n){var e=Nb(n,"string");return typeof e=="symbol"?e:e+""}function Nb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class It{}rn(It,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");rn(It,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");rn(It,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");rn(It,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");rn(It,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");rn(It,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");rn(It,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");rn(It,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const F0=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function $t(n,e,t){return(e=Mb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mb(n){var e=kb(n,"string");return typeof e=="symbol"?e:e+""}function kb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class te{}$t(te,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");$t(te,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");$t(te,"CLOSE_FILE","NotebookEvent.closeFile");$t(te,"RENAME","NotebookEvent.rename");$t(te,"RENAME_FILE","NotebookEvent.renameFile");$t(te,"REGISTER_FILE","NotebookEvent.registerFile");$t(te,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");$t(te,"UNREGISTER_FILE","NotebookEvent.unregisterFile");$t(te,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Qi=wt(qe.SESSION_OPENED),jb=Qi.listen,$0=Qi.emit,H0=Qi.useListener,Ji=wt(qe.SESSION_CLOSED),Lb=Ji.listen,B0=Ji.emit,W0=Ji.useListener,Ab=["children"];function za(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ga(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?za(Object(t),!0).forEach(function(r){Ni(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):za(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Rb(n,e){if(n==null)return{};var t,r,i=Fb(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Fb(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function Ni(n,e,t){return(e=$b(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $b(n){var e=Hb(n,"string");return typeof e=="symbol"?e:e+""}function Hb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Bb extends m.PureComponent{constructor(e){super(e),Ni(this,"stopListenForSessionClosed",void 0),Ni(this,"stopListenForSessionOpened",void 0),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;this.stopListenForSessionClosed=Lb(e,this.handleSessionClosed),this.stopListenForSessionOpened=jb(e,this.handleSessionOpened),e.on(It.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var e,t,{glEventHub:r}=this.props;(e=this.stopListenForSessionClosed)===null||e===void 0||e.call(this),(t=this.stopListenForSessionOpened)===null||t===void 0||t.call(this),r.off(It.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var{onClearAllFilters:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e){var{onSessionOpen:t}=this.props;t==null||t(e)}render(){var e=this.props,{children:t}=e,r=Rb(e,Ab);return d.jsx(_b,Ga(Ga({},r),{},{children:t}))}}var cr=vl(Bb);const U0=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Wb=Object.freeze({}),Ub=new Map,Xr=Object.freeze([]),V0=(n,e)=>{var t;return(t=He(n,e).columns)!==null&&t!==void 0?t:Xr},K0=(n,e)=>{var t;return(t=He(n,e).filterSets)!==null&&t!==void 0?t:Xr},z0=(n,e)=>{var t;return(t=He(n,e).filters)!==null&&t!==void 0?t:Xr},G0=(n,e)=>{var t;return(t=He(n,e).tableMap)!==null&&t!==void 0?t:Ub},q0=(n,e)=>He(n,e).isolatedLinkerPanelId,Eu=(n,e)=>{var t;return(t=He(n,e).links)!==null&&t!==void 0?t:Xr},X0=(n,e)=>He(n,e).columnSelectionValidator,Z0=(n,e)=>{var t;return(t=He(n,e).consoleSettings)!==null&&t!==void 0?t:Wb},Y0=(n,e)=>He(n,e).connection,hr=(n,e)=>He(n,e).sessionWrapper,Q0=(n,e)=>t=>t(nn(n,{connection:e})),J0=(n,e)=>t=>t(nn(n,{sessionWrapper:e})),Pu=(n,e)=>t=>t(nn(n,{links:e})),eS=(n,e)=>(t,r)=>{var i=Eu(r(),n),o=e.filter(a=>i.findIndex(s=>Qn(s.start,a.start)&&Qn(s.end,a.end))<0);return t(Pu(n,i.concat(o)))},tS=(n,e)=>(t,r)=>{var i=Eu(r(),n),o=i.filter(a=>!e.includes(a.id));return t(Pu(n,o))},nS=(n,e)=>t=>t(nn(n,{isolatedLinkerPanelId:e})),rS=(n,e)=>t=>t(nn(n,{columnSelectionValidator:e})),Vb=(n,e)=>t=>t(nn(n,{consoleSettings:e})),iS=(n,e)=>t=>t(nn(n,{filterSets:e}));function Hr(n,e,t){return(e=Kb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kb(n){var e=zb(n,"string");return typeof e=="symbol"?e:e+""}function zb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Tr=W.module("CommandHistoryPanel");class mr extends m.Component{static handleError(e){Tr.error(e)}constructor(e){super(e),Hr(this,"container",void 0),Hr(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=A.createRef(),this.pending=new rr;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(qe.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(qe.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){var{session:t,language:r,sessionId:i}=e;this.setState({session:t,sessionId:i,language:r},()=>{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:r,language:i}=this.state;if(Tr.debug("handleSendToNotebook",r,e),!r){Tr.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?te.CREATE_NOTEBOOK:te.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Tr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(qe.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;L(t),L(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(mr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(cr,{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(Ve,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),d.jsx(ne,{actions:o})]})]})}}Hr(mr,"COMPONENT","CommandHistoryPanel");Hr(mr,"TITLE","Command History");var Gb=(n,e)=>{var t=yl(n),r=hr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},qb=$n(Gb,null,null,{forwardRef:!0})(mr),Tu=m.createContext(null);Tu.displayName="PluginsContext";var on=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",ELEMENT_PLUGIN:"ElementPlugin",MIDDLEWARE_PLUGIN:"MiddlewarePlugin",MULTI_PLUGIN:"MultiPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",WIDGET_PLUGIN:"WidgetPlugin"});function Xb(n){return"DashboardPlugin"in n}function Zb(n){return"AuthPlugin"in n}function Yb(n){return"TablePlugin"in n}function Qb(n){return Xb(n)||Zb(n)||Yb(n)}function Jb(n){return"type"in n&&n.type===on.DASHBOARD_PLUGIN}function Mi(n){return"type"in n&&n.type===on.MIDDLEWARE_PLUGIN}function vr(n){return"type"in n&&n.type===on.WIDGET_PLUGIN}function _u(n){return vr(n)&&"dashboardTypes"in n&&n.dashboardTypes!=null}function ey(n){return"type"in n&&n.type===on.TABLE_PLUGIN}function ty(n){return"type"in n&&n.type===on.AUTH_PLUGIN}function Ou(n){return"type"in n&&n.type===on.THEME_PLUGIN}function xu(n){return"type"in n&&n.type===on.ELEMENT_PLUGIN}function Iu(n){return"type"in n&&n.type===on.MULTI_PLUGIN}function ki(n){return Jb(n)||ty(n)||xu(n)||Iu(n)||ey(n)||Ou(n)||vr(n)||Mi(n)}var ny=["metadata"],ry=["metadata"],iy=["Component"],oy=["Component"];function qa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qa(Object(t),!0).forEach(function(r){ay(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ay(n,e,t){return(e=sy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sy(n){var e=ly(n,"string");return typeof e=="symbol"?e:e+""}function ly(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Zr(n,e){if(n==null)return{};var t,r,i=uy(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function uy(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var nt=W.module("@deephaven/plugin.PluginUtils");function kn(n){var e,t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Component";return(e=(t=n.displayName)!==null&&t!==void 0?t:n.name)!==null&&e!==void 0?e:r}function Xa(n,e){return n==null||!vr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function oS(n,e){return n==null||!_u(n)?!1:[n.dashboardTypes].flat().some(t=>t===e)}function dy(n){var e=d.jsx(ve,{icon:Ns});if(!vr(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function aS(n){var e=[...n.entries()].filter(t=>Ou(t[1]));return nt.debug("Getting theme data from plugins",e),e.map(t=>{var[r,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:kd(r,s),name:s,styleContent:u}})}).flat()}function sS(n){var e=[...n.entries()].filter(t=>xu(t[1])&&t[1].mapping!=null);return nt.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,r]=t;return Object.entries(r.mapping)}))}function cy(n,e){return e.length===0?(nt.debug("No middleware to chain for component",kn(n)),n):(nt.debug("Chaining component middleware",kn(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function a(s){var{metadata:l}=s,u=Zr(s,ny);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?d.jsx(t,Fe(Fe({},u),{},{metadata:l})):d.jsx(i,Fe(Fe({},u),{},{metadata:l,Component:t}))}return a.displayName="".concat(r.name,"(").concat(kn(t),")"),a},n))}function lS(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(nt.debug("No panel middleware to chain for panel component",kn(n)),n):(nt.debug("Chaining panel middleware",kn(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var o=i.panelComponent,a=[i.supportedTypes].flat(),s=A.forwardRef((l,u)=>{var{metadata:c}=l,h=Zr(l,ry),v=u!=null?{ref:u}:{};return(c==null?void 0:c.type)!=null&&!a.includes(c.type)?d.jsx(r,Fe(Fe(Fe({},v),h),{},{metadata:c})):d.jsx(o,Fe(Fe(Fe({},v),h),{},{metadata:c,Component:r}))});return s.displayName="".concat(i.name,"Panel(").concat(kn(r,"Panel"),")"),s},n))}function uS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"PanelMiddleware",t=A.forwardRef((r,i)=>{var{Component:o}=r,a=Zr(r,iy),{inject:s,wrap:l}=n(a),u=o,c=d.jsx(u,Fe(Fe({ref:i},a),s));return l!=null?l(c):c});return t.displayName=e,t}function dS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"WidgetMiddleware";function t(r){var{Component:i}=r,o=Zr(r,oy),{inject:a,wrap:s}=n(o),l=i,u=d.jsx(l,Fe(Fe({},o),a));return s!=null?s(u):u}return t.displayName=e,t}function hy(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function my(n){return ki(n)?n:hy(n)&&ki(n.default)?n.default:Qb(n)?n:null}function Za(n,e,t,r){if(n.has(e)){nt.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,Fe(Fe({},t),{},{version:r}))}function cS(n,e,t,r,i,o){i!=null&&(e[i]=t,nt.debug("Registered plugin '".concat(i,"' in module resolve map")));var a=my(t);if(a==null){nt.error("Plugin '".concat(r,"' is missing an exported value."));return}Iu(a)?(nt.debug("MultiPlugin '".concat(r,"' contains ").concat(a.plugins.length," plugins")),a.plugins.forEach(s=>{if(!ki(s)){nt.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),s);return}var l=typeof s.name=="string"?s.name.trim():"";if(l.length===0){nt.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),s);return}Za(n,l,s,o)})):Za(n,r,a,o)}function hS(n){var e=new Map;n.forEach(s=>{s.package!=null&&e.set(s.package,s)});var t=new Map;n.forEach(s=>{var l=new Set;s.dependencies!=null&&s.dependencies.forEach(u=>{var c=e.get(u);c!=null?l.add(c):nt.warn("Plugin '".concat(s.name,"' depends on '").concat(u,"' which is not in the manifest"))}),t.set(s,l)});for(var r=[],i=new Set(n),o=new Set,a=function(){var l=[];if(i.forEach(c=>{var h=t.get(c);if(h==null||h.size===0){l.push(c);return}var v=!0;h.forEach(f=>{o.has(f)||(v=!1)}),v&&l.push(c)}),l.length===0){var u=[...i].map(c=>c.name);return nt.error("Circular plugin dependency detected among: ".concat(u.join(", "),". Loading remaining plugins together.")),r.push([...i]),1}r.push(l),l.forEach(c=>{i.delete(c),o.add(c)})};i.size>0&&!a(););return r}function vy(n,e){var t;return(t=[...n.values()].find(r=>_u(r)&&[r.dashboardTypes].flat().some(i=>i===e)))!==null&&t!==void 0?t:null}function fy(){return or(Tu,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Ya=W.module("@deephaven/plugin.WidgetView");function mS(n){var{fetch:e,type:t}=n,r=fy(),{basePlugin:i,middleware:o}=m.useMemo(()=>{var s,l=[];return r.forEach(u=>{if(!(!vr(u)&&!Mi(u))){var c=[u.supportedTypes].flat().includes(t);c&&(Mi(u)?l.push(u):(s!=null&&Ya.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(s.name," with ").concat(u.name)),s=u))}}),{basePlugin:s,middleware:l}},[r,t]),a=m.useMemo(()=>i==null?(Ya.debug("No base plugin found for widget type ".concat(t)),null):cy(i.component,o),[i,o,t]);if(a!=null)return d.jsx(a,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}function Qa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qa(Object(t),!0).forEach(function(r){fn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fn(n,e,t){return(e=py(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function py(n){var e=gy(n,"string");return typeof e=="symbol"?e:e+""}function gy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var On=W.module("ConsolePanel"),by=500,yy=Object.freeze({consoleSettings:{},itemIds:[]});class Yr extends m.PureComponent{constructor(e){super(e),fn(this,"consoleRef",void 0),fn(this,"objectSubscriptionCleanup",void 0),fn(this,"savePanelState",gn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};On.debug("Saving panel state",l),this.setState({panelState:l})},by)),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=A.createRef();var{panelState:t}=e,r=_r(_r({},yy),t||{}),{consoleSettings:i,itemIds:o}=r;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(le.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(le.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(r=>{On.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,u=[...a,...l],c=new Map(o);u.forEach(v=>{var{title:f}=v;f!==void 0&&c.delete(f)});var h=[...a,...s];return h.forEach(v=>{v.title!==void 0&&c.set(v.title,v)}),{objectMap:c}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,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:r}=this.state,i=r.get(e);return i==null&&t&&(i=Ot(),this.setItemId(e,i)),i}deleteItemId(e){this.setState(t=>{var{itemIds:r}=t;On.debug("Delete item",e,r);var i=[...r.keys()].find(a=>r.get(a)===e);if(i===void 0)return null;var o=new Map(r);return o.delete(i),{itemIds:o}})}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,{itemIds:i}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(r=e.props)===null||r===void 0||(r=r.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handlePanelClosed(e){var{glContainer:t}=this.props,r=_.getRootFromContainer(t),i=_.getStackForConfig(r,{id:e});i!==null&&_.getContentItemInStack(i,{id:e})!==null||this.deleteItemId(e)}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(qe.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:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&_.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;Ra(i,r),vb(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;On.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(qe.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,plugins:r}=this.props,{type:i}=e,o=vy(r,i);if(o!=null){var a=o.createDashboardPayload(e);On.debug("openDashboardWidget",a),mb(t,a)}else this.openPanelWidget(e)}openPanelWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;L(r);var{config:i,session:o}=r,{title:a=e.name}=e;L(a);var s=this.getItemId(a);L(s);var l={fetch:()=>o.getObject(e),panelId:s,widget:_r(_r({},fm(e)),{},{sessionId:i.id})};On.debug("openPanelWidget",l),Pg(t,l)}addCommand(e){var t,r=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,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{Ra(a,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(r=>Xa(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Xa(i,e));return r!=null?dy(r):d.jsx(Pl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(bn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:c,session:h,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:w,type:E}=c;return d.jsx(cr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:h!=null&&d.jsx(Yt,{dh:p,ref:this.consoleRef,settings:s,session:h,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:E,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:_l.LANGUAGE_MAP.get(E)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),b,d.jsx("div",{children:"•"})]}),d.jsx(pp,{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})})}}fn(Yr,"COMPONENT","ConsolePanel");fn(Yr,"TITLE","Console");fn(Yr,"contextType",cu);var Cy=(n,e)=>({commandHistoryStorage:yl(n),sessionWrapper:hr(n,e.localDashboardId),timeZone:bm(n),plugins:ym(n)}),hi=$n(Cy,null,null,{forwardRef:!0})(Yr);function vS(n){return n==="file"||n==="directory"}function yt(n){return n.type==="directory"}function Sy(n,e,t){return(e=wy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wy(n){var e=Ey(n,"string");return typeof e=="symbol"?e:e+""}function Ey(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eo extends Error{constructor(){super("No file exists at the path specified"),Sy(this,"isFileNotFound",!0)}}function Ja(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function es(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ja(o,r,i,a,s,"next",l)}function s(l){Ja(o,r,i,a,s,"throw",l)}a(void 0)})}}var cn=function(n){return n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN="",n}({});class N{static fileExists(e,t){return es(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof eo))throw r;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(!N.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var r=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return r.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var r;return(r=t.pop())!==null&&r!==void 0?r:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),r=null,i=null;t<0?i=e:(i=e.substring(0,t),r=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return r!==null?"".concat(o,".").concat(r):o}static getUniqueCopyFileName(e,t){return es(function*(){for(var r=N.getCopyFileName(t);yield N.fileExists(e,r);)r=N.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return cn.GROOVY;case"py":return cn.PYTHON;case"pyc":return cn.PYTHON_COMPILED;case"scala":return cn.SCALA;case"txt":return cn.PLAIN_TEXT;default:return cn.UNKNOWN}}static getParent(e){if(!N.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(!N.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]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=N.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Xn("Name cannot be empty");if(t.includes(e))throw new Xn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new Xn('Invalid characters in name: "'.concat((o=(a=e.match(r))===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(r=>N.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.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 to=26;function ji(n){return yt(n)?N.makePath(n.filename):N.getPath(n.filename)}function ts(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=ji(e);if(n.some(r=>{var{filename:i}=r;return N.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>yt(r)&&t.startsWith(N.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Py(n){if(yt(n))return n.isExpanded?jd:Ld;var e=N.getMimeType(n.basename);switch(e){case cn.PYTHON:return Rd;default:return Ad}}function Li(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:c,onDragOver:h,onDragEnd:v,onDragExit:f,onDrop:p}=n,g=(e=r==null?void 0:r.some(k=>k.id===s.id))!==null&&e!==void 0?e:!1,b=ji(s),w=i&&u?ji(u):null,E=i&&o&&yt(s)&&w===b,P=i&&o&&w===b,F=i&&!o&&w===b,Z=Py(s),re=N.getDepth(s.filename),Y=Array(re).fill(null).map((k,B)=>d.jsx("span",{className:"file-list-depth-line"},B));return d.jsxs("div",{className:G("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":E,"is-in-drop-target":P,"is-invalid-drop-target":F,"is-selected":a}),onDragStart:k=>c(l,k),onDragOver:k=>h(l,k),onDragEnd:k=>v(l,k),onDragExit:f,onDrop:k=>p(l,k),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:Z,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function ns(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ns(Object(t),!0).forEach(function(r){Ty(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ns(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ty(n,e,t){return(e=_y(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _y(n){var e=Oy(n,"string");return typeof e=="symbol"?e:e+""}function Oy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var We=W.module("FileList"),xy=500,rs="item-list-scroll-pane";function Iy(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Li,rowHeight:l=to,overscanCount:u=Ct.DEFAULT_OVERSCAN}=n,[c,h]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,w]=m.useState(),[E,P]=m.useState(),[F,Z]=m.useState([]),re=m.useRef(),Y=m.useRef(null),k=m.useRef(null),B=m.useCallback(x=>{if(x.length===0||c==null)return[];for(var J=[],oe=0;oe<x.length;oe+=1)for(var fe=x[oe],Be=fe[0];Be<=fe[1];Be+=1)Be>=c.offset&&Be<c.offset+c.items.length&&J.push(c.items[Be-c.offset]);return J},[c]),Q=m.useCallback(x=>{var J=B([[x,x]]);if(J.length>0)return J[0]},[B]),q=m.useCallback(()=>{var x=pt.count(F);if(x===0)return null;if(x===1){var J=F[0][0],oe=Q(J);if(oe!=null)return oe.filename}return"".concat(x," items")},[Q,F]),R=m.useCallback(x=>{if(!(!b||!p)){We.debug("dropItems",b,"to",x);try{var{files:J,targetPath:oe}=ts(b,p);if(i==null||i(J,oe),x!=null){var fe;Z([[x,x]]),(fe=Y.current)===null||fe===void 0||fe.focusItem(x)}}catch(Be){We.error("Unable to complete move",Be)}}},[b,p,i]),U=m.useCallback((x,J)=>{var oe=c.items[x-c.offset];oe!==void 0&&(We.debug("handleItemClick",oe),o(oe,J),yt(oe)&&(t==null||t.setExpanded(oe.filename,!oe.isExpanded)))},[c,o,t]),X=m.useCallback((x,J)=>{var oe,fe;We.debug2("handleItemDragStart",x,F);var Be=F;pt.isSelected(F,x)||(Be=[[x,x]],Z(Be)),w(B(Be)),(oe=Y.current)===null||oe===void 0||oe.resetMouseState();var Et=document.createElement("div"),Pt=document.createElement("div");Pt.className="dnd-placeholder-content",Pt.innerText=(fe=q())!==null&&fe!==void 0?fe:"",Et.appendChild(Pt),Et.className="file-list-dnd-placeholder",document.body.appendChild(Et),J.dataTransfer.setDragImage(Et,0,0),J.dataTransfer.effectAllowed="move",P(Et)},[q,B,F]),$=m.useCallback((x,J)=>{J.preventDefault(),We.debug2("handleItemDragOver",J),g(Q(x))},[Q]),V=m.useCallback((x,J)=>{We.debug("handleItemDragEnd",x),E==null||E.remove(),w(void 0),g(void 0),P(void 0)},[E]),K=m.useCallback((x,J)=>{R(x)},[R]),pe=m.useCallback(()=>{We.debug2("handleItemDragExit"),g(void 0)},[]),ke=m.useCallback(x=>{x.target instanceof Element&&x.target.classList.contains(rs)&&(x.preventDefault(),We.debug2("handleListDragOver",x),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),j=m.useCallback(x=>{x.target instanceof Element&&x.target.classList.contains(rs)&&(We.debug("handleListDrop"),R())},[R]),C=m.useCallback(function(x){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(We.debug2("handleSelectionChange",x),J===!0||x!==F){Z(x);var oe=B(x);a(oe)}},[B,a,F]),S=m.useCallback(x=>{if(We.debug2("handleFocusChange",x),x!=null){var[J]=B([[x,x]]);r(J)}else r();re.current=x},[B,r]),M=m.useCallback((x,J)=>{We.debug("handleViewportChange",x,J),(x!==v.top||J!==v.bottom)&&f({top:x,bottom:J})},[v]),z=m.useMemo(()=>{if(!b||!p)return!1;try{return ts(b,p),We.debug("handleValidateDropTarget true"),!0}catch{return We.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:ie}=n;m.useEffect(()=>{ie!==void 0&&(ie==="/"?t.collapseAll():(t.setExpanded(ie,!1),t.setExpanded(ie,!0)))},[t,ie]),m.useEffect(function(){We.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 J=t.onUpdate(oe=>{h({items:oe.items.map(fe=>Or(Or({},fe),{},{itemName:fe.basename})),offset:oe.offset,itemCount:t.size})});return()=>{J()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),F.length>0&&C(F,!0)},[c,S,C,F]),m.useEffect(function(){if(p!=null&&yt(p)&&p.filename!=="/"){var J=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},xy);return()=>clearTimeout(J)}},[p,t]);var mt=m.useCallback(x=>s(Or(Or({},x),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:z,onDragStart:X,onDragEnd:V,onDragOver:$,onDragExit:pe,onDrop:K})),[V,pe,$,X,K,b,p,z,s]);return d.jsx("div",{ref:k,className:G("file-list",{"is-dragging":b!=null}),onDragOver:ke,onDrop:j,children:d.jsx(Ct,{ref:Y,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:S,onSelect:U,onSelectionChange:C,onViewportChange:M,selectedRanges:F,renderItem:mt,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Dy={DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[O.DELETE],macShortcut:[I.CMD,O.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[O.ENTER],macShortcut:[O.ENTER]})};const is={FILE_EXPLORER:Dy};var os=W.module("FileListItemEditor"),Ny=()=>Promise.resolve();function My(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Ny}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[c,h]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var E;(E=o.current)===null||E===void 0||E.focus()},[o]),f=m.useCallback(E=>E.stopPropagation(),[]),p=m.useCallback(()=>{c.then(()=>{r(a)}).catch(E=>os.info("Unable to validate name",E))},[r,a,c]);m.useEffect(function(){var P=_e.makeCancelable(i(a));return P.then(()=>u(void 0)).catch(F=>{_e.isCanceled(F)||u(F)}),h(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{os.debug2("handleBlur"),p()},[p]),b=m.useCallback(E=>{var{value:P}=E.target;s(P)},[]),w=m.useCallback(E=>{E.stopPropagation();var{key:P}=E;switch(P){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:G("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function as(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?as(Object(t),!0).forEach(function(r){ky(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):as(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ky(n,e,t){return(e=jy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jy(n){var e=Ly(n,"string");return typeof e=="symbol"?e:e+""}function Ly(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Du(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:c,onSelectionChange:h,table:v,rowHeight:f=to,validateRename:p=()=>Promise.resolve()}=n,[g,b]=m.useState(),[w,E]=m.useState([]),[P,F]=m.useState(),Z=m.useCallback(K=>{E(K),h==null||h(K)},[h]),re=m.useCallback(K=>{F(K)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),k=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),B=m.useCallback(()=>{i==null||i()},[i]),Q=m.useCallback(()=>{P&&(o==null||o(N.getPath(P.filename)))},[P,o]),q=m.useCallback(()=>{P&&b(P)},[P]),R=m.useCallback(()=>{b(void 0)},[]),U=m.useCallback(K=>{g&&(u==null||u(g,K),b(void 0))},[u,g]),X=m.useMemo(()=>{if(g)return[];var K=[];return i&&K.push({title:"New File",description:"Create new file",action:B,group:ne.groups.medium}),o&&K.push({title:"New Folder",description:"Create new folder",action:Q,group:ne.groups.medium}),a&&K.push({title:"Copy File",description:"Copy the selected file",action:Y,group:ne.groups.low,disabled:P==null||yt(P)}),s&&w.length>0&&K.push({title:"Delete",description:"Delete",shortcut:is.FILE_EXPLORER.DELETE,action:k,group:ne.groups.low}),u&&K.push({title:"Rename",description:"Rename",shortcut:is.FILE_EXPLORER.RENAME,action:q,group:ne.groups.low,disabled:P==null}),K},[Y,k,B,Q,q,P,a,i,o,s,u,w,g]),$=m.useCallback(K=>(L(g),p(g,K)),[g,p]),V=m.useCallback(K=>{var{item:pe}=K;return g&&g.filename===pe.filename?d.jsx(Li,mi(mi({},K),{},{children:d.jsx(My,{item:pe,validate:$,onSubmit:U,onCancel:R})})):d.jsx(Li,mi({},K))},[R,U,g,$]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(Iy,{onMove:l,onSelect:c,onSelectionChange:Z,onFocusChange:re,renderItem:V,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),r&&d.jsx(ne,{actions:X})]})}Du.displayName="FileListContainer";function ss(n,e,t){return(e=Ay(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ay(n){var e=Ry(n,"string");return typeof e=="symbol"?e:e+""}function Ry(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nr extends Xn{constructor(e){super("Name already exists"),ss(this,"isExistingFile",!0),ss(this,"info",void 0),this.info=e}}function ls(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function us(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ls(o,r,i,a,s,"next",l)}function s(l){ls(o,r,i,a,s,"throw",l)}a(void 0)})}}var Tt=W.module("FileExplorer");function no(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:c,rowHeight:h=to}=n,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var U;function X(){return $.apply(this,arguments)}function $(){return $=us(function*(){Tt.debug("initTable"),U=_e.makeCancelable(e.getTable(),V=>V.close());try{g(yield U)}catch(V){_e.isCanceled(V)||Tt.error("Unable to initialize table",V)}}),$.apply(this,arguments)}return X(),()=>{U.cancel()}},[e]);var b=m.useCallback(R=>{_e.isCanceled(R)||Tt.error(R)},[]),w=m.useCallback(()=>{Tt.debug("handleCreateFile"),s()},[s]),E=m.useCallback(()=>{Tt.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(R=>{Tt.debug("handleCopyFile",R.filename),i(R)},[i]),F=m.useCallback(R=>{Tt.debug("handleDelete, pending confirmation",R),f(R)},[]),Z=m.useCallback(()=>{Tt.debug("handleDeleteConfirm",v),v.forEach(R=>e.deleteFile(yt(R)?N.makePath(R.filename):R.filename)),o(v),f([])},[v,o,e]),re=m.useCallback(()=>{Tt.debug("handleDeleteCancel"),f([])},[]),Y=m.useCallback((R,U)=>{var X=N.reducePaths(R.map($=>yt($)?N.makePath($.filename):$.filename));X.forEach($=>{var V=N.isPath($)?"".concat(U).concat(N.getBaseName($.substring(0,$.length-1)),"/"):"".concat(U).concat(N.getBaseName($));e.moveFile($,V).then(()=>{a($,V)}).catch(b)})},[b,a,e]),k=m.useCallback((R,U)=>{var X=R.filename,$=yt(R);$&&!X.endsWith("/")&&(X="".concat(X,"/"));var V="".concat(N.getParent(X)).concat(U);$&&!V.endsWith("/")&&(V="".concat(V,"/")),Tt.debug2("handleRename",X,V),e.moveFile(X,V).catch(b),a(X,V)},[b,a,e]),B=m.useCallback(function(){var R=us(function*(U,X){if(X!==U.basename){N.validateName(X);var $="".concat(N.getPath(U.filename)).concat(X);try{var V=yield e.info($);throw new Nr(V)}catch(K){if(!(K instanceof eo))throw K}}});return function(U,X){return R.apply(this,arguments)}}(),[e]),Q=v.length>0,q=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return d.jsxs("div",{className:"file-explorer",children:[p&&d.jsx(Du,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:P,onCreateFolder:E,onCreateFile:w,onMove:Y,onDelete:F,onRename:k,onSelect:u,onSelectionChange:c,rowHeight:h,table:p,validateRename:B}),d.jsx(Jn,{isOpen:Q,headerText:q,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:Z,confirmButtonText:"Delete"})]})}no.displayName="FileExplorer";function ds(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Fy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ds(o,r,i,a,s,"next",l)}function s(l){ds(o,r,i,a,s,"throw",l)}a(void 0)})}}function hn(n,e,t){return(e=$y(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $y(n){var e=Hy(n,"string");return typeof e=="symbol"?e:e+""}function Hy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var sn=W.module("NewItemModal");class pn extends m.PureComponent{static getValidationMessage(e){return e instanceof Nr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){_e.isCanceled(e)||sn.error(e)}constructor(e){super(e),hn(this,"inputRef",A.createRef()),hn(this,"cancelableValidatePromise",void 0),hn(this,"cancelableExistingItemPromise",void 0),hn(this,"pending",new rr),hn(this,"pathMap",new Map),hn(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,r=N.hasPath(t)?N.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:N.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:N.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!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=N.hasPath(e)?N.getPath(e):"/";this.setState({path:t,value:N.getBaseName(e),validationError:void 0,prevExtension:N.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=_e.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return Fy(function*(){N.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Nr(l)}catch(u){if(!(u instanceof eo))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(pn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(sn.debug("handleSelect",e),e.type==="directory")this.setState({path:N.makePath(e.filename)});else{var t=e.basename,r=N.getPath(e.filename);this.setState({value:t,path:r},()=>{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:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof Xn))throw e;sn.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:r}=this.state;sn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){sn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=N.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){sn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;sn.debug("submitModal",r,i);var l=N.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(u=>{if(u instanceof Nr&&s!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw _e.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).catch(this.handleValidationError).catch(pn.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((r,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),d.jsxs(A.Fragment,{children:[d.jsx(ae,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:Fd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:c,validationError:h,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=N.fileExtensionToString(f),w=N.fileExtensionToString(p),E=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(_s,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(Os,{toggle:r,children:o}),d.jsx(xs,{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:G("form-control",{"is-invalid":h}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d.jsx("div",{className:"invalid-feedback",children:pn.getValidationMessage(h)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(no,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(nl,{children:[d.jsx(ae,{kind:"secondary",onClick:r,children:"Cancel"}),d.jsx(ae,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:E})]})]}),d.jsx(Jn,{isOpen:c,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(Jn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}hn(pn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function By(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(ae,{kind:"ghost",icon:$s,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(ae,{kind:"ghost",icon:$d,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(cl,{value:i,onChange:r,placeholder:"Search by name"})})]})}function cs(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Wy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){cs(o,r,i,a,s,"next",l)}function s(l){cs(o,r,i,a,s,"throw",l)}a(void 0)})}}function Nu(n,e,t){return(e=Uy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uy(n){var e=Vy(n,"string");return typeof e=="symbol"?e:e+""}function Vy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ln=W.module("FileExplorerPanel"),Ky=(n,e)=>{var t=Cl(n),r=hr(n,e.localDashboardId),{session:i,config:o}=r??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},zy=$n(Ky,null,null,{forwardRef:!0});function Gy(n){var e=n;return e!=null&&typeof e.button=="number"}class Fn extends A.Component{static handleError(e){ln.error(e)}static isFocusEvent(e){return Gy(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};ln.debug("handleCreateFile",t,r,i),e.emit(te.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){ln.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){ln.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Fn.handleError)}handleCopyFile(e){var t=this;return Wy(function*(){var{fileStorage:r}=t.props;if(yt(e)){ln.error("Invalid item in handleCopyItem",e);return}var i=yield N.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(te.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=N.makePath(e[0].filename):t=N.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(ln.debug("fileSelect",e),e.type!=="directory"){var r=Fn.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(te.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;ln.debug("handleRename",e,t),r.emit(te.RENAME_FILE,e,t)}handleSessionOpened(e){var{session:t,language:r}=e;this.setState({session:t,language:r})}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:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return d.jsxs(cr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(By,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(no,{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(pn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}Nu(Fn,"COMPONENT","FileExplorerPanel");Nu(Fn,"TITLE","File Explorer");var qy=zy(Fn);function nr(n,e,t){return(e=Xy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xy(n){var e=Zy(n,"string");return typeof e=="symbol"?e:e+""}function Zy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var hs=W.module("LogPanel");class Qr extends m.PureComponent{constructor(e){super(e),nr(this,"isBottomVisible",void 0),nr(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){var{session:t}=e;hs.debug("Session opened",[t]),this.setState({session:t})}handleSessionClosed(e){hs.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return d.jsxs(cr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&d.jsx(we,{session:r,ref:i=>{this.logView=i}})]})}}nr(Qr,"defaultProps",{session:null});nr(Qr,"COMPONENT","LogPanel");nr(Qr,"TITLE","Log");var Yy=(n,e)=>{var t;return{session:(t=hr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},Qy=$n(Yy,null,null,{forwardRef:!0})(Qr);function ms(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function xr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ms(o,r,i,a,s,"next",l)}function s(l){ms(o,r,i,a,s,"throw",l)}a(void 0)})}}function vs(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vs(Object(t),!0).forEach(function(r){Re(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Re(n,e,t){return(e=Jy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jy(n){var e=eC(n,"string");return typeof e=="symbol"?e:e+""}function eC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tC=m.lazy(()=>Bs(()=>import("./MarkdownNotebook-BlE_4mh5.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),de=W.module("NotebookPanel"),fs=400;class xe extends m.Component{static handleError(e){_e.isCanceled(e)||de.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(xe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(xe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=N.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",Qt((v,f)=>et(et({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",Qt((v,f,p)=>{var g=[{title:"Find",icon:Wd,action:this.handleFind,group:ne.groups.high,shortcut:Ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Is,action:this.handleCopy,group:ne.groups.medium,order:20},{title:"Rename File",icon:Ud,action:this.handleShowRename,group:ne.groups.medium,order:30},{title:"Delete File",icon:Ls,action:this.handleDelete,group:ne.groups.medium,order:40},{title:"Show Minimap",icon:v?Mn:void 0,action:this.handleMinimapChange,group:ne.groups.low,shortcut:Ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?Mn:void 0,action:this.handleWordWrapChange,group:ne.groups.low,shortcut:Ke.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:ne.groups.low,order:10}),g.push({title:"Format on Save",icon:p?Mn:void 0,action:this.handleFormatOnSaveChange,group:ne.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 rr,this.debouncedSavePanelState=gn(this.savePanelState.bind(this),fs),this.debouncedLoad=gn(this.load.bind(this),fs),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,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&&N.hasPath(s.itemName),c=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,h=c?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},de.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(te.RENAME_FILE,this.handleRenameFile),t.on(le.DROPPED,this.handlePanelDropped),e.on(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;r!==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:r,isPreview:i}=this.state;e.off(te.RENAME_FILE,this.handleRenameFile),e.off(le.DROPPED,this.handlePanelDropped),t.off(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(te.UNREGISTER_FILE,r,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:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);L(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r==null||r.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){de.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){de.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(te.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(te.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(te.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;L(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;de.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:c}=u;this.renameTab(c,N.getBaseName(s))}var h=et(et({},t),{},{language:(a=xe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(h.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:h}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&N.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){de.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.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;de.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:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,u=et(et({},a),{},{value:s}),c=et(et({},a),{},{value:l}),h={settings:c,fileMetadata:i,isPreview:o};return de.debug("Saving panel state",h),{settings:u,panelState:h}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(te.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return xr(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;L(o);var{language:s}=a,{itemName:l}=o,u=yield N.getUniqueCopyFileName(t,l);de.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var c={id:u,itemName:u},h={value:null,language:s};r.emit(te.SELECT_NOTEBOOK,i,s,h,c,!0)})()}handleDelete(){de.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return xr(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;de.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(N.hasPath(o.itemName)&&(yield N.fileExists(t,o.itemName))?(i.emit(te.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){de.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+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:r}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};r(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,r=t.wordWrap==="on"?"off":"on";return{settings:et(et({},t),{},{wordWrap:r})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:r}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};r(i)}handleLinkClick(e){var{notebooksUrl:t,session:r,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==="/"){de.debug("Ignoring invalid notebook link",a);return}de.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},u={id:a,itemName:a};s.emit(te.SELECT_NOTEBOOK,r,i,l,u)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;_e.isCanceled(t)||(_e.isTimedOut(t)&&(t=new Error("File not found.")),de.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return xr(function*(){de.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:r=!1}=t;r&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=xe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=et(et({},a.settings),{},{language:o});return de.debug("handleSaveSuccess",i,s,l),s&&N.hasPath(s.itemName)&&s.itemName!==i.itemName&&(de.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(xe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){_e.isCanceled(e)||(this.setState({savedChangeCount:0}),de.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),de.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}),N.getBaseName(o)!==N.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,N.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 xr(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield me.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){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){de.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){de.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e){var{session:t,language:r}=e;this.setState({session:t,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;de.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){de.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];de.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){de.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){de.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r==null?void 0:r.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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=et(et({},s),{},{language:t,value:r}),u={id:null,itemName:e};de.debug("handleCreateNotebook",o,a,l,u),i.emit(te.CREATE_NOTEBOOK,o,a,l,u)}runCommand(e){if(e===void 0||e===""){de.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(qe.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:r}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",r??!1)}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:c,error:h,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:w,sessionLanguage:E,settings:P,showCloseModal:F,showDeleteModal:Z,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,k=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:xe.DEFAULT_NAME,B=k.endsWith(".md"),Q=(b==null?void 0:b.id)!=null,q=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),R=w!=null,U=E===q.language,X=!f||!R||!U,$=!f,V=[{action:this.handleSave,shortcut:Xt.SAVE},{action:this.handleMinimapChange,shortcut:Ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ke.NOTEBOOK.WORDWRAP}],K=Pi.getDisabledRunTooltip(R,U,"Notebook extension","Run"),pe=Pi.getDisabledRunTooltip(R,U,"Notebook extension","Run Selected"),ke=[{title:Q?"Rename":"Save As…",order:10,group:ne.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ne.groups.high,order:20}],j=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[j!=null&&Wr.createPortal(d.jsx("span",{className:G(xe.UNSAVED_INDICATOR_CLASS_NAME,{[xe.UNSAVED_STATUS_CLASS_NAME]:u!==c})}),j),d.jsxs(cr,{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:ke,renderTabTooltip:()=>k,children:[!B&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(ae,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:X,icon:d.jsx(ve,{icon:Fs,transform:"grow-4"}),tooltip:"Run ".concat(Ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),K!=null&&d.jsx(he,{children:K})]}),d.jsxs("span",{children:[d.jsx(ae,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:X,icon:d.jsx(ve,{icon:Hd,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(ae,{kind:"ghost",className:"mr-auto",disabled:$,onClick:this.handleSave,icon:Bd,tooltip:"Save ".concat(Xt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(ae,{kind:"ghost",className:"btn-overflow",disabled:$,icon:Rs,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(ar,{actions:this.getDropdownOverflowActions,popperOptions:xe.POPPER_OPTIONS})})]}),d.jsx(Bl,{isLoaded:f,isLoading:p,error:h,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:E,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:q,focusOnMount:Y,ref:C=>{this.notebook=C}})]}),B&&d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(tC,{content:(r=q.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(pn,{isOpen:re,type:"file",defaultValue:k,title:Q?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(Jn,{isOpen:Z,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(Jn,{isOpen:F,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(ne,{actions:V})]})]})}}Re(xe,"COMPONENT","NotebookPanel");Re(xe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(xe,"DEFAULT_NAME","Untitled");Re(xe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(xe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(xe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var nC=(n,e)=>{var t=Cl(n),r=wl(n),i=hr(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:r,session:o,sessionLanguage:s}},un=$n(nC,{updateNotebookSettings:Tm},null,{forwardRef:!0})(xe);function rC(){var{python:{linter:n={}}={}}=Kg(wl),{isEnabled:e=!1,config:t}=n;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function ps(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gs(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ps(Object(t),!0).forEach(function(r){iC(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ps(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function iC(n,e,t){return(e=oC(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oC(n){var e=aC(n,"string");return typeof e=="symbol"?e:e+""}function aC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=W.module("ConsolePlugin");function bs(n){return n.notebook!==void 0}function sC(n){Dg(n)}function fS(n){sC(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,u]=m.useState(new Map),[c,h]=m.useState(new Map);rC();var v=Ai(),f=m.useCallback(()=>i.getLastUsedPanelOfType(hi),[i]),p=m.useCallback((C,S)=>{u(M=>new Map(M.set(C,S)))},[u]),g=m.useCallback(C=>{u(S=>(S.delete(C),new Map(S)))},[u]),b=m.useCallback((C,S)=>{h(M=>new Map(M.set(C,S)))},[h]),w=m.useCallback(C=>{h(S=>(S.delete(C),new Map(S)))},[h]),E=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,z=C&&C.trim();if(!z)be.info("Ignoring empty code");else{var ie=f();if(!ie||!(ie instanceof hi.WrappedComponent)){be.error("Console panel not found");return}be.debug("Send command: ",C,S,M),ie.addCommand(C,S,M)}},[f]),P=m.useCallback(C=>{v(Vb(e,C))},[v,e]),F=m.useCallback(C=>{var{language:S}=C,M=S==="python"?"py":S,z=null;return M==null?(be.debug("No extension for language",S),z="Untitled-".concat(s.current)):z="Untitled-".concat(s.current,".").concat(M),s.current+=1,z},[]),Z=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:M}=C;if(M!=null&&l.has(M))return l.get(M);if(M!=null&&c.has(M))return c.get(M);if(S)return Ot()},[l,c]),re=m.useCallback((C,S)=>{_.renameComponent(r.root,{id:C},S)},[r.root]),Y=m.useCallback((C,S)=>{be.debug("Rename file panel",C,S);var M;if(l.has(C)&&(M=l.get(C),g(C),M!=null&&p(S,M)),c.has(C)&&(M=c.get(C),w(C),M!=null&&b(S,M)),M===void 0){be.debug2("File ".concat(C," isn't open, no need to rename the tab"));return}re(M,N.getBaseName(S))},[l,c,re,p,b,g,w]),k=m.useCallback(C=>{var S=Z(C,!1);if(S==null){be.error("Could not find panel id for file metadata",C);return}_.activateTab(r.root,{id:S})},[Z,r.root]),B=m.useCallback((C,S,M)=>{if(be.debug("registerFilePanel",C,S,M),S==null||S.id==null){be.debug("Ignore empty file id",S);return}var{id:z}=S;if(M){b(z,C);return}if(l.has(z)){var ie=l.get(z);if(C===ie){be.debug("Update tab title for file ".concat(z));var{itemName:mt}=S;Y(z,mt)}else be.error("File ".concat(z," already associated with a different tab ").concat(ie));return}p(z,C),c.has(z)&&w(z)},[l,c,Y,p,b,w]),Q=m.useCallback((C,S)=>{if(be.debug("unregisterFileTab",C,S),C==null||C.id==null){be.debug("Ignore empty file id",C);return}var{id:M}=C;if(S){w(M);return}g(M)},[g,w]),q=m.useCallback((C,S)=>{be.debug("closeFilePanel",C);var{id:M}=C;if(M==null){be.warn("File ID is null, ignore close event");return}var z=null,ie=!1;if(l.has(M))z=l.get(M);else if(c.has(M))z=c.get(M),ie=!0;else{be.debug("File ".concat(M," isn't open, ignore close event"));return}Q(C,ie),_.closeComponent(r.root,{id:z},S)},[r.root,l,c,Q]),R=m.useCallback(C=>{var{itemName:S}=C;return N.getBaseName(S)},[]),U=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpen",C,S,l),S!=null&&l.has(S)},[l]),X=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpenAsPreview",C,S,c),S!=null&&c.has(S)},[c]),$=m.useCallback(C=>{if(C!=null){var S=i.getOpenedPanelById(C);S&&bs(S)&&S.focus()}},[i]),V=m.useCallback(C=>{var{id:S,settings:M,fileMetadata:z,session:ie,sessionLanguage:mt,isPreview:x=!1}=C,J={settings:M,fileMetadata:z},oe=R(z);return{type:"react-component",component:un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ie,sessionLanguage:mt,panelState:J,isPreview:x,notebooksUrl:a},title:oe,id:S}},[R,e,a]),K=m.useCallback(function(C,S,M){var z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(M)},ie=Z(z);if(U(z)&&ie!=null){be.debug("File is already open, focus panel"),k(z),$(ie);return}if(ie==null){be.error("Panel ID for file metadata is null");return}var mt=_.getStackForComponentTypes(r.root,[un.COMPONENT]),x=V({id:ie,settings:M,fileMetadata:z,session:C,sessionLanguage:S});be.debug("createNotebook",x,l),_.openComponentInStack(mt,x)},[U,$,F,Z,r.root,V,l,k]),pe=m.useCallback(function(C,S,M,z){var ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;be.debug("selectNotebook",z,ie);var mt=U(z),x=X(z),[J]=[...c.values()],oe=!ie,fe=oe&&J?J:Z(z);if(fe==null||fe==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(z)));if(mt||x)k(z);else{var Be=_.getStackForComponentTypes(r.root,[un.COMPONENT]),Et=V({id:fe,settings:M,fileMetadata:z,session:C,sessionLanguage:S,isPreview:oe});_.openComponentInStack(Be,Et)}if(x&&ie){var Pt=z.id,ti=_.getStackForConfig(r.root,{component:un.COMPONENT,id:fe}),Bn=_.getContentItemInStack(ti,{component:un.COMPONENT,id:fe});Pt!=null&&Bn&&Ae(Bn)&&(Bn.container.emit(te.PROMOTE_FROM_PREVIEW),w(Pt),p(Pt,fe))}ie&&$(fe)},[k,U,X,$,Z,r.root,V,c,w,p]),ke=m.useCallback(function(C,S){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,ie=i.getLastUsedPanelOfType(un);ie&&bs(ie)?M!=null&&M.value!=null&&ie.notebook!=null&&ie.notebook.append(M.value):z&&K(C,S,M)},[K,i]),j=m.useCallback((C,S)=>Fg.hydrate(gs(gs({},C),{},{notebooksUrl:a}),S),[a]);return Vn(o,hi,t),Vn(o,qb),Vn(o,qy),Vn(o,Qy),Vn(o,un,j),Le(r.eventHub,qe.SEND_COMMAND,E),Le(r.eventHub,qe.SETTINGS_CHANGED,P),Le(r.eventHub,te.CLOSE_FILE,q),Le(r.eventHub,te.CREATE_NOTEBOOK,K),Le(r.eventHub,te.SELECT_NOTEBOOK,pe),Le(r.eventHub,te.RENAME,re),Le(r.eventHub,te.RENAME_FILE,Y),Le(r.eventHub,te.SEND_TO_NOTEBOOK,ke),Le(r.eventHub,te.REGISTER_FILE,B),Le(r.eventHub,te.UNREGISTER_FILE,Q),null}function Jr(n,e,t){return(e=lC(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lC(n){var e=uC(n,"string");return typeof e=="symbol"?e:e+""}function uC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ei{}Jr(ei,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Jr(ei,"INPUT_FILTER","ControlType.INPUT_FILTER");Jr(ei,"MARKDOWN","ControlType.MARKDOWN");Jr(ei,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{Pm as $,$C as A,ae as B,ol as C,Ge as D,HC as E,Al as F,Js as G,tl as H,xt as I,el as J,O as K,$e as L,wl as M,Tm as N,er as O,_e as P,H as Q,Ev as R,ml as S,T,Xt as U,ll as V,ei as W,U0 as X,ar as Y,Pl as Z,Vr as _,gt as a,I as a$,nn as a0,x0 as a1,pu as a2,qC as a3,Sl as a4,_C as a5,hr as a6,Y0 as a7,ym as a8,He as a9,UC as aA,ZC as aB,zC as aC,GC as aD,Q0 as aE,J0 as aF,WC as aG,KC as aH,El as aI,VC as aJ,me as aK,gC as aL,Ic as aM,or as aN,Lc as aO,Dc as aP,Ys as aQ,Zs as aR,Nc as aS,Mc as aT,pt as aU,Ct as aV,Ac as aW,il as aX,cl as aY,Xh as aZ,Kr as a_,M0 as aa,zg as ab,BC as ac,Fg as ad,Xd as ae,zs as af,te as ag,It as ah,v0 as ai,p0 as aj,b0 as ak,C0 as al,le as am,F0 as an,k0 as ao,L0 as ap,un as aq,Pg as ar,fm as as,Ws as at,Ur as au,fS as av,ne as aw,Jn as ax,fy as ay,XC as az,Dt as b,kr as b$,nl as b0,oh as b1,Ri as b2,yC as b3,Zh as b4,Fi as b5,SC as b6,sl as b7,Qs as b8,vl as b9,t0 as bA,of as bB,i0 as bC,o0 as bD,cf as bE,hf as bF,s0 as bG,a0 as bH,Vi as bI,l0 as bJ,hp as bK,ap as bL,mp as bM,Yt as bN,Tl as bO,Ve as bP,Ar as bQ,qf as bR,Wl as bS,_l as bT,Wm as bU,Dl as bV,Mm as bW,jn as bX,Ol as bY,Ln as bZ,kf as b_,al as ba,Rc as bb,Sh as bc,Mr as bd,dm as be,gl as bf,pl as bg,fl as bh,wC as bi,EC as bj,PC as bk,Uv as bl,Vv as bm,Ee as bn,Zv as bo,df as bp,ee as bq,ef as br,Me as bs,YC as bt,jl as bu,Ll as bv,e0 as bw,r0 as bx,QC as by,JC as bz,y as c,lS as c$,Nl as c0,pp as c1,we as c2,wi as c3,Ke as c4,Bl as c5,Pi as c6,Us as c7,_ as c8,Vn as c9,Ig as cA,Tg as cB,Og as cC,_g as cD,xg as cE,h0 as cF,d0 as cG,Wg as cH,E0 as cI,P0 as cJ,A0 as cK,j0 as cL,f0 as cM,y0 as cN,g0 as cO,S0 as cP,D0 as cQ,R0 as cR,Le as cS,m0 as cT,Jg as cU,aS as cV,sS as cW,on as cX,Tu as cY,mS as cZ,cy as c_,c0 as ca,O0 as cb,_b as cc,hb as cd,cb as ce,ci as cf,bu as cg,I0 as ch,w0 as ci,cu as cj,jg as ck,Zi as cl,Xi as cm,gu as cn,Zg as co,mu as cp,Pr as cq,Dg as cr,uu as cs,vb as ct,mb as cu,Ra as cv,T0 as cw,_0 as cx,fu as cy,du as cz,Xe as d,Vb as d$,uS as d0,dS as d1,dy as d2,my as d3,vy as d4,hS as d5,ty as d6,Jb as d7,xu as d8,Zb as d9,qy as dA,qs as dB,mC as dC,cr as dD,Xs as dE,wt as dF,nS as dG,G0 as dH,q0 as dI,Eu as dJ,z0 as dK,X0 as dL,rr as dM,V0 as dN,iS as dO,K0 as dP,yt as dQ,rS as dR,tS as dS,eS as dT,Pu as dU,qe as dV,B0 as dW,$0 as dX,Z0 as dY,Lb as dZ,jb as d_,Xb as da,Qb as db,Yb as dc,Iu as dd,ki as de,ey as df,Ou as dg,_u as dh,Mi as di,vr as dj,Xa as dk,oS as dl,cS as dm,Za as dn,pC as dp,ho as dq,Eg as dr,Gr as ds,N0 as dt,N as du,eo as dv,vS as dw,hi as dx,Qy as dy,qb as dz,_m as e,rC as e0,W0 as e1,H0 as e2,vC as e3,bC as e4,fC as e5,ri as e6,ec as e7,ni as e8,n0 as e9,Xn as ea,bm as f,OC as g,RC as h,AC as i,LC as j,jC as k,kC as l,MC as m,TC as n,DC as o,IC as p,xC as q,Se as r,ce as s,he as t,vm as u,Pe as v,FC as w,NC as x,CC as y,Kg as z};
25
- //# sourceMappingURL=ControlType-D-mhzKYk.js.map
24
+ `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,we.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,r=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(ae,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:xd,tooltip:"Clear log"}),d.jsx(ae,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Id,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(ar,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}st(we,"DefaultLogLevels",[Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN]);st(we,"AllLogLevels",[Ie.INFO,Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN,Ie.DEBUG,Ie.TRACE]);st(we,"bufferTimeout",16);st(we,"maxLogSize",131072);st(we,"truncateSize",65536);const np="var(--dh-color-chart-colorway)",rp="var(--dh-color-chart-grid)",ip="var(--dh-color-chart-axis-line)",op="var(--dh-color-chart-axis-line-zero)",Pa={"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:np,gridcolor:rp,linecolor:ip,zerolinecolor:op,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)","map-style":"var(--dh-color-chart-map-style)"};var Ta=W.module("ChartTheme");function ap(){var n,e=js(Pa);return e.colorway=Dd((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Nd.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Ta.debug2("Chart theme:",Pa),Ta.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"],map_style:e["map-style"]})}function _a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function sp(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(r){lp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lp(n,e,t){return(e=up(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function up(n){var e=dp(n,"string");return typeof e=="symbol"?e:e+""}function dp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var cp=m.lazy(()=>Bs(()=>import("./Plot-0FbdKJAa.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function hp(n){return d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(cp,sp({},n))})}var Vi=m.createContext(null);Vi.displayName="ChartThemeContext";function l0(n){var{children:e}=n,{activeThemes:t}=el(),r=m.useMemo(ap,[t]);return d.jsx(Vi.Provider,{value:r,children:e})}function mp(){return or(Vi,"No ChartThemeContext value found.")}function Oa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function vp(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Oa(o,r,i,a,s,"next",l)}function s(l){Oa(o,r,i,a,s,"throw",l)}a(void 0)})}}var fp=W.module("HeapUsage");function pp(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=mp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,h]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=Zs(),p=m.useCallback(vp(function*(){try{var $=yield t.getWorkerHeapInfo();if(!f.current)return;if(u($),o||c){for(var V=($.totalHeapSize-$.freeMemory)/$.maximumHeapSize,K=Date.now(),{timestamps:pe,usages:ke}=v.current;pe.length!==0&&K-pe[0]>a*1.5;)pe.shift(),ke.shift();pe.push(K),ke.push(V)}else v.current={timestamps:[],usages:[]}}catch(j){fp.warn("Unable to get heap usage",j)}}),[t,f,o,c,a]);Ic(p,c?i:r);var g=($,V)=>Math.round($*10**V)/10**V,b=2,w=1024**3,{freeMemory:E,totalHeapSize:P,maximumHeapSize:F}=l,Z=g(E/w,b),re=g(P/w,b),Y=g(F/w,b),k=re-Z,B=function(V,K){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:G("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:V}),d.jsx("div",{children:K})]})},{timestamps:Q,usages:q}=v.current,R=(e=Q[Q.length-1])!==null&&e!==void 0?e:0,U=P/F,X=(P-E)/F;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(U*100,"% - ").concat(U*2,"px")}}),d.jsx("div",{className:G("used-memory",{"heap-overflow":(P-E)/F>.95}),style:{width:"calc(".concat(X*100,"% - ").concat(X*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>h(!0),onExited:()=>h(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[B("In use:","".concat(k.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),B("Free:","".concat(Z.toFixed(b)," GB")),B("Total:","".concat(re.toFixed(b)," GB")),B("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(hp,{data:[{x:[...Q],y:[...q],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(a/6),gridcolor:s.linecolor,range:[R-a,R],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 Ul=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 Vl(n){return n.componentName!==void 0}function gp(n){return n.component!==void 0}var Kl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const bp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ul,isGLComponentConfig:Vl,isReactComponentConfig:gp,itemDefaultConfig:Kl},Symbol.toStringTag,{value:"Module"}));function Dr(n,e,t){return(e=yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yp(n){var e=Cp(n,"string");return typeof e=="symbol"?e:e+""}function Cp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ze{constructor(){Dr(this,"_mSubscriptions",void 0),Dr(this,"off",this.unbind),Dr(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ze.ALL_EVENT]=[]}on(e,t,r){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:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Ze.ALL_EVENT],u=0;u<l.length;u++){var c=l[u].ctx||{};try{l[u].fn.apply(c,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}unbind(e,t,r){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)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Dr(Ze,"ALL_EVENT","__all");function ft(n,e,t){return(e=Sp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sp(n){var e=wp(n,"string");return typeof e=="symbol"?e:e+""}function wp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ti extends Ze{constructor(e,t,r){super(),ft(this,"width",void 0),ft(this,"height",void 0),ft(this,"title",void 0),ft(this,"parent",void 0),ft(this,"layoutManager",void 0),ft(this,"tab",void 0),ft(this,"_config",void 0),ft(this,"isHidden",!1),ft(this,"beforeCloseHandler",void 0),ft(this,"_element",D(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ft(this,"_contentElement",void 0),this.title=Vl(e)?e.componentName:"",this.parent=t,this.layoutManager=r,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 r,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",c=u==="height"?t:e,h=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=c/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[u]=v;else{var g;a.contentItems[p].config[u]=((g=a.contentItems[p].config[u])!==null&&g!==void 0?g:0)+f}return a.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Ep=Object.freeze(Object.defineProperty({__proto__:null,Container:Ti,ItemContainer:Ti},Symbol.toStringTag,{value:"Module"}));function zl(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Gl(n){if(window.location.hash)return zl(n);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},r,i;for(i=0;i<e.length;i++)r=e[i].split("="),t[r[0]]=r[1];return t[n]||null}function Ki(n){return window.requestAnimationFrame(n)}function Pp(n,e){var t=e.indexOf(n);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Rr(){return Ot()}function Tp(n,e){var t=n.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 zi(n){return D.trim(n.replace(/(<([^>]+)>)/gi,""))}function Qe(n,e,t){return(e=_p(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _p(n){var e=Op(n,"string");return typeof e=="symbol"?e:e+""}function Op(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sr extends Ze{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Qe(this,"_eElement",void 0),Qe(this,"_oDocument",void 0),Qe(this,"_eBody",void 0),Qe(this,"_root",void 0),Qe(this,"_destroyAfterMouseUp",void 0),Qe(this,"_nDelay",400),Qe(this,"_timeout",void 0),Qe(this,"timeout",void 0),Qe(this,"_nDistance",10),Qe(this,"_nX",0),Qe(this,"_nY",0),Qe(this,"_nOriginalX",0),Qe(this,"_nOriginalY",0),Qe(this,"_bDragging",!1),this._eElement=e,this._oDocument=D(document),this._eBody=D(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),(r=this._eElement)===null||r===void 0||r.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,r,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r: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,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r: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,r,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.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,r,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"),(r=this._root)===null||r===void 0||r.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,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}function Pn(n,e,t){return(e=xp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xp(n){var e=Ip(n,"string");return typeof e=="symbol"?e:e+""}function Ip(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ql{constructor(e,t){Pn(this,"_container",void 0),Pn(this,"_reactComponent",null),Pn(this,"_portalComponent",null),Pn(this,"_originalComponentWillUpdate",void 0),Pn(this,"_initialState",void 0),Pn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Wr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t,void 0)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=D.extend(e,this._container._config.props);return A.createElement(this._reactClass,t)}}var Fr=["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"],Dp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Gi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return qi(n,e,"_min"),e}function _i(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return qi(n,e,"_max"),e}function qi(n,e,t){var r=t==="_min"?Np:Mp;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[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=r(i,Fr);e[s]=a}qi(o,a,t)}else{var l=r(o,Dp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Fr);e[u]=l}}}}function Np(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Mp(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function ui(n,e,t){return(e=kp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kp(n){var e=jp(n,"string");return typeof e=="symbol"?e:e+""}function jp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Oi{constructor(e,t){ui(this,"name",void 0),ui(this,"origin",void 0),ui(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function yr(n,e,t){return(e=Lp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lp(n){var e=Ap(n,"string");return typeof e=="symbol"?e:e+""}function Ap(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Xl=class extends Ze{constructor(e){super(),yr(this,"_layoutManager",void 0),yr(this,"_dontPropagateToParent",void 0),yr(this,"_childEventSource",void 0),yr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ze.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),D(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];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,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){D(window).off("gl_child_event",this._boundOnEventFromChild)}};function Zl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function Yl(n){return(e,t)=>Zl(e,n,t)}function Ql(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];e.emit(n,...r)}}function Jl(n){return(e,t)=>{var r=m.useRef(null),i=m.useRef(()=>!1);if(r.current!=e||i.current!=t){var o;(o=r.current)===null||o===void 0||o.off(n,i.current),e==null||e.on(n,t)}r.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=r.current)===null||a===void 0?void 0:a.off(n,i.current)},[])}}function wt(n){return{listen:Yl(n),emit:Ql(n),useListener:Jl(n)}}const Rp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Oi,DragListener:sr,EventEmitter:Ze,EventHub:Xl,ReactComponentHandler:ql,animFrame:Ki,filterXss:Tp,getHashValue:zl,getQueryStringParam:Gl,getUniqueId:Rr,listenForEvent:Zl,makeEmitFunction:Ql,makeEventFunctions:wt,makeListenFunction:Yl,makeUseListenerFunction:Jl,minifyConfig:Gi,removeFromArray:Pp,stripTags:zi,unminifyConfig:_i},Symbol.toStringTag,{value:"Module"}));function Wt(n,e,t){return(e=Fp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=$p(n,"string");return typeof e=="symbol"?e:e+""}function $p(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eu extends Ze{constructor(e,t,r,i,o){super(),Wt(this,"isInitialised",!1),Wt(this,"_config",void 0),Wt(this,"_dimensions",void 0),Wt(this,"_parentId",void 0),Wt(this,"_indexInParent",void 0),Wt(this,"_layoutManager",void 0),Wt(this,"_popoutWindow",null),Wt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,u,c,h;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(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&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=D.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=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,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;D(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=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Rr();e=Gi(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[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 Oe(n,e,t){return(e=Hp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hp(n){var e=Bp(n,"string");return typeof e=="symbol"?e:e+""}function Bp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wn extends Ze{constructor(e,t,r,i,o,a){var s,l,u,c,h,v,f,p;if(super(),Oe(this,"_dragListener",void 0),Oe(this,"_layoutManager",void 0),Oe(this,"_contentItem",void 0),Oe(this,"_originalParent",void 0),Oe(this,"_area",null),Oe(this,"_lastValidArea",null),Oe(this,"_minX",void 0),Oe(this,"_maxX",void 0),Oe(this,"_minY",void 0),Oe(this,"_maxY",void 0),Oe(this,"_width",void 0),Oe(this,"_height",void 0),Oe(this,"_sided",void 0),Oe(this,"element",void 0),Oe(this,"childElementContainer",void 0),Oe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=D(wn._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",zi((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(),D(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,E;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((E=this._proxyTab.outerHeight(!0))!==null&&E!==void 0?E:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(c=P==null?void 0:P.top)!==null&&c!==void 0?c:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(p=this.element.height())!==null&&p!==void 0?p:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.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,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Oe(wn,"_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 Cr(n,e,t){return(e=Wp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wp(n){var e=Up(n,"string");return typeof e=="symbol"?e:e+""}function Up(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tu{constructor(e,t,r){Cr(this,"_element",void 0),Cr(this,"_itemConfig",void 0),Cr(this,"_layoutManager",void 0),Cr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new sr(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 r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}function Sr(n,e,t){return(e=Vp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vp(n){var e=Kp(n,"string");return typeof e=="symbol"?e:e+""}function Kp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nu{constructor(e,t,r){Sr(this,"_element",D(window)),Sr(this,"_itemConfig",void 0),Sr(this,"_layoutManager",void 0),Sr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&this._layoutManager&&(this._dragListener=new sr(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 r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}}function ru(n,e,t){return(e=zp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zp(n){var e=Gp(n,"string");return typeof e=="symbol"?e:e+""}function Gp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class lr{constructor(){ru(this,"element",D(lr._template)),D(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()}}ru(lr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function di(n,e,t){return(e=qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qp(n){var e=Xp(n,"string");return typeof e=="symbol"?e:e+""}function Xp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gn{constructor(e,t,r,i){di(this,"element",void 0),di(this,"_header",void 0),di(this,"_action",void 0),this._header=e,this.element=D('<li class="'+r+'" 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 Zp(n,e,t){return(e=Yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yp(n){var e=Qp(n,"string");return typeof e=="symbol"?e:e+""}function Qp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mn extends Error{constructor(e,t){super(),Zp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Jp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:mn},Symbol.toStringTag,{value:"Module"}));function Te(n,e,t){return(e=eg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eg(n){var e=tg(n,"string");return typeof e=="symbol"?e:e+""}function tg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vn(n){return n.isStack}function Ae(n){return n.isComponent}function iu(n){return n.isRoot}class Ne extends Ze{constructor(e,t,r,i){super(),Te(this,"config",void 0),Te(this,"type",void 0),Te(this,"contentItems",void 0),Te(this,"parent",void 0),Te(this,"layoutManager",void 0),Te(this,"element",void 0),Te(this,"childElementContainer",void 0),Te(this,"componentName",void 0),Te(this,"isInitialised",!1),Te(this,"isMaximised",!1),Te(this,"isRoot",!1),Te(this,"isRow",!1),Te(this,"isColumn",!1),Te(this,"isStack",!1),Te(this,"isComponent",!1),Te(this,"tab",void 0),Te(this,"_pendingEventPropagations",void 0),Te(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Ze.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=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(r!==!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 r=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]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,vn(this)&&this.header.tabs[i].setContentItem(t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),r(o.contentItems[a])};return r(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),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$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"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&Ae(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r: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 Oi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new mn("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(Kl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof Oi&&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,Ki(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Wn(n,e,t){return(e=ng(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ng(n){var e=rg(n,"string");return typeof e=="symbol"?e:e+""}function rg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ou extends Ne{constructor(e,t,r){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,r,D()),Wn(this,"config",void 0),Wn(this,"componentName",void 0),Wn(this,"container",void 0),Wn(this,"parent",void 0),Wn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=D.extend(!0,{},this.config.componentState||{});if(o==null)throw new mn('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 Ti(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(){Ne.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Ne.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),Ne.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Ne.prototype._$destroy.call(this)}_$getArea(){return null}}function dt(n,e,t){return(e=ig(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ig(n){var e=og(n,"string");return typeof e=="symbol"?e:e+""}function og(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tr extends Ne{constructor(e,t,r,i){super(t,r,i,D('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),dt(this,"isRow",void 0),dt(this,"isColumn",void 0),dt(this,"childElementContainer",void 0),dt(this,"parent",void 0),dt(this,"_splitter",[]),dt(this,"_splitterSize",void 0),dt(this,"_splitterGrabSize",void 0),dt(this,"_isColumn",void 0),dt(this,"_dimension",void 0),dt(this,"_splitterPosition",null),dt(this,"_splitterMinPosition",null),dt(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,r){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),Ne.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!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 r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r: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(Ne.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var c;l=this.contentItems[0],this.contentItems=[],(c=this.parent)===null||c===void 0||c.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,r),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(Ne.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,r=(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-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,c,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));a+=h,s.push(h)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];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[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==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,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var h=u.itemSizes[c];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},r.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<r.length;f++){l=r[f];var p=Math.round((l.width-t)*v);a-=p,l.width-=p}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new au(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,r=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,c=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),h=this._isColumn?c.vertical:c.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(h||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r: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,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=c*h,s.after.config[this._dimension]=(1-c)*h,e.element.css({top:0,left:0}),Ki(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function xa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ia(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(r){xi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xi(n,e,t){return(e=ag(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ag(n){var e=sg(n,"string");return typeof e=="symbol"?e:e+""}function sg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ii extends Ne{constructor(e,t,r){super(e,Ia(Ia({},t),{},{type:"root"}),null,D('<div class="lm_goldenlayout lm_item lm_root"></div>')),xi(this,"childElementContainer",void 0),xi(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,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 r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r: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,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(Ae(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!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 tr)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var c,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((c=h.config[a])!==null&&c!==void 0?c:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}function Da(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Da(Object(t),!0).forEach(function(r){rt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Da(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function rt(n,e,t){return(e=lg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lg(n){var e=ug(n,"string");return typeof e=="symbol"?e:e+""}function ug(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Di extends Ne{constructor(e,t,r){var i,o,a,s,l,u,c,h,v;super(e,t,r,D('<div class="lm_item lm_stack"></div>')),rt(this,"_activeContentItem",null),rt(this,"_header",void 0),rt(this,"childElementContainer",D('<div class="lm_items"></div>')),rt(this,"header",void 0),rt(this,"parent",void 0),rt(this,"isStack",!0),rt(this,"_dropSegment",null),rt(this,"_contentAreaDimensions",null),rt(this,"_dropIndex",void 0),rt(this,"_side",void 0),rt(this,"_sided",!1),rt(this,"config",void 0),this.parent=r,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(h=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=Tn(Tn({},this._header),f.header)),t.header&&(this._header=Tn(Tn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Tn(Tn({},this._header),t.content[0].header)),this.header=new Rt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,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=((r=this.element.width())!==null&&r!==void 0?r: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),Ae(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,r=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(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Ne.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",r=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=this.parent instanceof tr&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Ae(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var h,v=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));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 r=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+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.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+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.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,r,i,o,a,s,l,u,c,h,v,f,p,g,b,w,E=this.header.tabs.length;if(E===0){var P,F,Z,re,Y,k,B,Q,q=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(F=q==null?void 0:q.left)!==null&&F!==void 0?F:0,x2:((Z=q==null?void 0:q.left)!==null&&Z!==void 0?Z:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((k=(B=this.header.element.offset())===null||B===void 0?void 0:B.top)!==null&&k!==void 0?k:0)+((Q=this.header.element.innerHeight())!==null&&Q!==void 0?Q:0)});return}var R=this.header.tabsContainer,U=(t=R.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),X=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!U||!X)){e<U.left?e=U.left+1:e>U.right&&(e=U.right-1);var $,V;if(!(X.left<e&&e<X.right)){for(var K=0;K<E;K++){var pe;if($=this.header.tabs[K].element,V=(pe=$.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=K;break}}if($&&V&&e<V.left+V.width*.5)$.before(this.layoutManager.tabDropPlaceholder);else if($){var ke;this._dropIndex=Math.min(((ke=this._dropIndex)!==null&&ke!==void 0?ke:0)+1,E),$.after(this.layoutManager.tabDropPlaceholder)}}var j=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;j=Math.max(j,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var C=j+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);C=Math.min(C,((u=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:j,x2:C,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===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,r=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}this._dropSegment=e}}const dg=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Ne,Component:ou,ContentItem:Ne,Root:Ii,RowOrColumn:tr,Stack:Di,isComponent:Ae,isRoot:iu,isStack:vn},Symbol.toStringTag,{value:"Module"}));function jt(n,e,t){return(e=cg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cg(n){var e=hg(n,"string");return typeof e=="symbol"?e:e+""}function hg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ur{constructor(e,t){var r;jt(this,"header",void 0),jt(this,"contentItem",void 0),jt(this,"element",D(ur._template)),jt(this,"titleElement",void 0),jt(this,"closeElement",void 0),jt(this,"isActive",!1),jt(this,"_layoutManager",void 0),jt(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,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new sr(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),Ae(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.text(e)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Ae(this.contentItem)&&this.contentItem.container._contentElement.off(),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 r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new wn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){Ae(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(D(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){Ae(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&Ae(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ae(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),Ae(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(),Ae(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()}_isInNestedLayout(e){var t=D(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!Ae(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}jt(ur,"_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(n,e,t){return(e=mg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mg(n){var e=vg(n,"string");return typeof e=="symbol"?e:e+""}function vg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rt extends Ze{constructor(e,t){var r,i;super(),se(this,"layoutManager",void 0),se(this,"element",D(Rt._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",D(Rt._nextButtonTemplate)),se(this,"tabPreviousButton",D(Rt._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,(r=this.layoutManager.config.settings)!==null&&r!==void 0&&r.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 r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===e)return;var i=new ur(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,r,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||(r=t.scrollIntoView)===null||r===void 0||r.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 r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_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 r,i,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,c;l.scrollLeft=(u=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r: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,r;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)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,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((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(c=>{var h,v,f=o||c,p=c-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(h=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),D(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,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Gn(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),r=this._getHeaderSetting("popout"),new Gn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Gn(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),r=this._getHeaderSetting("close"),this.closeButton=new Gn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),D(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"),D(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var c=(s+l+u.length)%u.length;c!==s;){if(u.eq(c).css("display")!=="none")return c;c=(c+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.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 r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-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,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.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(),D(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,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=(r=D(window).height())!==null&&r!==void 0?r:0,l=(i=D(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<s-u.bottom,h=!c&&u.bottom>s*.6,v=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}se(Rt,"_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(Rt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));se(Rt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Un(n,e,t){return(e=fg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fg(n){var e=pg(n,"string");return typeof e=="symbol"?e:e+""}function pg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class au{constructor(e,t,r){Un(this,"_isVertical",void 0),Un(this,"_size",void 0),Un(this,"_grabSize",void 0),Un(this,"_dragListener",void 0),Un(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new sr(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=D('<div class="lm_drag_handle"></div>'),t=D('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const gg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:eu,DragProxy:wn,DragSource:tu,DragSourceFromEvent:nu,DropTargetIndicator:lr,Header:Rt,HeaderButton:Gn,Splitter:au,Tab:ur},Symbol.toStringTag,{value:"Module"}));var bg={config:bp,container:Ep,controls:gg,errors:Jp,items:dg,utils:Rp};function Na(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Je(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(r){ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ue(n,e,t){return(e=yg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yg(n){var e=Cg(n,"string");return typeof e=="symbol"?e:e+""}function Cg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ma=["column","row","stack","component"];class Gr extends Ze{static isLayoutItemConfig(e){return Ma.includes(e.type)}static minifyConfig(e){return Gi(e)}static unminifyConfig(e){return _i(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":ql}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",D('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"_initialHeaderHeight",void 0),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Xl(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",D('<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&&D("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 r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}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 Ne))throw new Error("Root must be a ContentItem");var t={settings:Je({},this.config.settings),dimensions:Je({},this.config.dimensions),labels:Je({},this.config.labels),content:[]},r=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]={},r(a.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(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){D(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 lr,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 r=this._reactChildMap.get(e);r===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 r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r: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(),D(window).off("resize",this._onResize),D(window).off("unload beforeunload",this._onUnload),D(window).off("blur.lm").off("focus.lm"),D(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 r,i;if(typeof e.type!="string")throw new mn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Gr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Ma.join(","),new mn(i);return e.type==="component"&&!(t instanceof Di)&&t&&!(this.isSubWindow===!0&&t instanceof Ii)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Rr(),e.type==="stack"?new Di(this,e,t):e.type==="row"?new tr(!1,this,e,t):e.type==="column"?new tr(!0,this,e,t):new ou(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof Ne,s=this;if(a){var l;o=this.toConfig(e).content,r=Rr();for(var u=e.parent,c=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;c=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(c)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,E=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+E.left,top:w+E.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var P=new eu(o,t,r,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 r=new tu(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new nu(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,r;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((r=this.container.height())!==null&&r!==void 0?r: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 r=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&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Je({},this.root._$getArea()),r=[Je(Je({},t),{},{side:"left",x2:t.x1+e}),Je(Je({},t),{},{side:"right",x1:t.x2-e}),Je(Je({},t),{},{side:"top",y2:t.y1+e}),Je(Je({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$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 r=e[t];if(vn(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Je(Je({},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 Ne)return e;if(D.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.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=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&D(window).resize(this._onResize),D(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,r=Gl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=_i(e),localStorage.removeItem(r));var i=D.extend(!0,{},Ul,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=D('<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=zi((e=this.config.content[0].title)!==null&&e!==void 0?e:""),D("head").append(D("body link, body style, template, .gl_keep")),this.container=D("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?D(this._originalContainer):D("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,D("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 mn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new mn(t,e);this.root=new Ii(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,r=e*t;if(!(this.width==null||r<=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(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{vn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ue(Gr,"__lm",bg);const ka={"tab-height":"28px","drag-border-width":"5px"},ja=Object.freeze({tabHeight:parseInt(ka["tab-height"],10),dragBorderWidth:parseInt(ka["drag-border-width"],10)});function La(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?La(Object(t),!0).forEach(function(r){su(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):La(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function su(n,e,t){return(e=Sg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sg(n){var e=wg(n,"string");return typeof e=="symbol"?e:e+""}function wg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ut=W.module("LayoutUtils");function lu(n){return n.componentName!==void 0}function qt(n){var e=n;return(lu(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function wr(n){return n.focus!==void 0}function Aa(n){return n.type==="stack"}class _{static activateTab(e,t){var r=_.getStackForRoot(e,t,!1);if(!r){Ut.error("Could not find stack for config",t);return}var i=_.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=_.getStackForRoot(e,t,!1);if(!r)return Ut.error("Could not find stack for config",t),!1;var i=_.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(iu(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,c,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(c=s.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(s,h),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(r=>r.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=_.getAllStackContainers(e),r=_.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&vn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(vn(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 r;if(((r=e.config)===null||r===void 0?void 0:r.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]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&vn(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&&oo(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}return null}static getStackForRoot(e,t){var r=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&&r&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var r=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=_.getStackForRoot(e,{component:s},r&&l,i,o);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&oo(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i],{content:a}=o;if(qt(o)){var s=t(o.component,o);s!=null?r.push(s):Ut.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=kt(kt({},o),{},{content:_.dehydrateLayoutConfig(a,t)});r.push(l)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(Aa(r)&&delete r.activeItemIndex,_.dropLayoutMinorChange(i)):qt(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=_.cloneLayout(e),o=_.cloneLayout(t);return r?(_.dropLayoutMinorChange(i),_.dropLayoutMinorChange(o),Qn(i,o)):Qn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i];if(qt(o)){var a,{component:s,props:l={}}=o;r.push(kt(kt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Ot(),props:t(s,l)}))}else if(o.content!==void 0){var u=_.hydrateLayoutConfig(o.content,t);Aa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ut.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(kt(kt({},o),{},{content:u}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,c=kt({},t);if(c.id==null&&(c.id=Ot()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var h=o||{id:c.id,component:c.component};L(e);var v=r??(a?_.addStack(e):_.getStackForRoot(e,h));L(v);var f=_.getContentItemInStack(v,h);if(s!=null){var p=b=>{Ut.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:w}=b.origin;requestAnimationFrame(()=>{_.focusElement(w[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(c,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(c);s==null&&u&&wr(u)&&u.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=_.getContentItemInStack(e,o);if(r&&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&&wr(i)&&i.focus()}static closeComponent(e,t,r){var i=_.getStackForRoot(e,t,!1,!1,!1);if(!i){Ut.warn("Cannot find stack for component, ignoring close",t);return}var o=_.getContentItemInStack(i,t),a=document.activeElement;o&&(Ae(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&wr(a)&&a.focus()}static renameComponent(e,t,r){var i=_.getStackForRoot(e,t,!1);if(!i){Ut.error("Could not find stack for config",t);return}var o=_.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=_.getStackForRoot(e,t,!1);if(!r)return Ut.error("Could not find stack for config",t),null;var{props:i={}}=t,o=_.getPanelComponentState(t),a={type:"react-component",component:t.component,props:kt(kt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Ot()};return _.openComponentInStack(r,a),a}static getPanelComponentState(e){if(lu(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(qt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ja.tabHeight,borderWidth:ja.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=_.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return _.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=_.getComponentConfigFromContainer(t);if(r&&qt(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.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]:_.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(wr(r)&&r.focus(),r)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var r=()=>{e.off("initialised",r),t()};e.on("initialised",r)})}}su(_,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Eg=A.forwardRef((n,e)=>{var t=_.getComponentNameFromPanel({props:n});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Eg.displayName="PanelPlaceholder";var le=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:d0,emit:Pg,useListener:c0}=wt(le.OPEN),{listen:h0,emit:Ra,useListener:m0}=wt(le.CLOSE),qr=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:Tg,emit:v0,useListener:f0}=wt(qr.CYCLE_TO_NEXT_STACK),{listen:_g,emit:p0,useListener:g0}=wt(qr.CYCLE_TO_PREVIOUS_STACK),{listen:Og,emit:b0,useListener:y0}=wt(qr.CYCLE_TO_NEXT_TAB),{listen:xg,emit:C0,useListener:S0}=wt(qr.CYCLE_TO_PREVIOUS_TAB);function Ig(n){return typeof n.id=="string"&&n.layout instanceof Gr&&n.panelManager instanceof Xi&&typeof n.registerComponent=="function"}function Dg(n){if(!Ig(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function Fa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $a(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(r){At(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function At(n,e,t){return(e=Ng(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ng(n){var e=Mg(n,"string");return typeof e=="symbol"?e:e+""}function Mg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ct=W.module("PanelManager"),dn=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}(dn||{});class Xi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=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]:()=>{};At(this,"layout",void 0),At(this,"hydrateComponent",void 0),At(this,"dehydrateComponent",void 0),At(this,"onPanelsUpdated",void 0),At(this,"closed",void 0),At(this,"openedMap",void 0),At(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=r,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(le.FOCUS,this.handleFocus),e.on(le.MOUNT,this.handleMount),e.on(le.UNMOUNT,this.handleUnmount),e.on(le.REOPEN,this.handleReopen),e.on(le.REOPEN_LAST,this.handleReopenLast),e.on(le.DELETE,this.handleDeleted),e.on(le.CLOSED,this.handleClosed),e.on(le.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(Tg(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(_g(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(Og(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(xg(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(le.FOCUS,this.handleFocus),e.off(le.MOUNT,this.handleMount),e.off(le.UNMOUNT,this.handleUnmount),e.off(le.REOPEN,this.handleReopen),e.off(le.REOPEN_LAST,this.handleReopenLast),e.off(le.DELETE,this.handleDeleted),e.off(le.CLOSED,this.handleClosed),e.off(le.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 _.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&qt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=_.getStackForConfig(this.layout.root,{id:e});return(t=r&&_.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>Mr(r)&&t instanceof r.WrappedComponent||!Mr(r)&&t instanceof r))}updatePanel(e){var t=_.getIdFromPanel(e);if(t==null){ct.error("updatePanel Panel did not have an ID",e);return}ct.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=_.getIdFromPanel(e);if(t==null){ct.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ct.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ct.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ct.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){ct.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ct.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ct.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=_.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=_.getFocusedStackIndex(t);if(r===-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===dn.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,c=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack(dn.Next)}handleCycleToPreviousStack(){this.cycleStack(dn.Previous)}cycleTab(e){var t,r=_.getFocusedStack(this.layout);if(r!==void 0){var{contentItems:i}=r;if(!(i.length<=1)){var o=(t=r.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===dn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];r.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(dn.Next)}handleCycleToPreviousTab(){this.cycleTab(dn.Previous)}handleReopen(e,t){ct.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=$a($a({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:_.getStackById(a,e.parentStackId);_.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 r=(t=_.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===r){this.handleReopen(o);return}}}}handleDeleted(e){ct.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ct.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;_.closeComponent(r,t)}addClosedPanel(e){var t=_.getComponentConfigFromContainer(e);if(t&&qt(t)){var r=this.dehydrateComponent(t.component,t);if(r!=null){var i;r.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(r)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}At(Xi,"MAX_CLOSED_PANEL_COUNT",100);var kg=W.module("PanelErrorBoundary");class jg 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,r=_.getIdFromContainer(e);kg.debug("componentWillUnmount",r),t.emit(le.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(bn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Ha(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ha(Object(t),!0).forEach(function(r){Lg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lg(n,e,t){return(e=Ag(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Rg(n,"string");return typeof e=="symbol"?e:e+""}function Rg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function uu(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return r!=null&&(o.metadata=r),i!=null&&(o.panelState=i),$r($r({},n),{},{componentState:null,props:o,type:"react-component"})}function du(n,e){return $r($r({},n),{},{localDashboardId:e})}const Fg={dehydrate:uu,hydrate:du};var cu=A.createContext(void 0);cu.displayName="LayoutManagerContext";var $g=ye.shape({on:ye.func,off:ye.func,isHidden:ye.bool,tab:ye.shape({header:ye.shape({tabs:ye.arrayOf(ye.shape({contentItem:ye.shape({})}))})}),title:ye.string,setTitle:ye.func,close:ye.func}),hu=ye.shape({on:ye.func,off:ye.func,emit:ye.func}),Hg=ye.shape({registerComponent:ye.func,root:ye.shape({addChild:ye.func}),on:ye.func,off:ye.func,eventHub:hu}),w0=Object.freeze({Container:$g,EventHub:hu,Layout:Hg});function Vn(n,e,t,r){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.");A.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}function Le(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var mu="SET_DASHBOARD_DATA";const Bg=Dm(mu,{},!1),Wg={dashboardData:Bg};var Ug=new Map,vu=Object.freeze({}),Vg=Object.freeze([]),E0=Ai,Kg=ws,P0=Gu,zg=n=>n.dashboardData,He=(n,e)=>{var t;return(t=zg(n)[e])!==null&&t!==void 0?t:vu},T0=(n,e)=>{var t;return(t=He(n,e).closed)!==null&&t!==void 0?t:Vg},_0=(n,e)=>{var t;return(t=He(n,e).openedMap)!==null&&t!==void 0?t:Ug},fu=(n,e)=>{var t;return(t=He(n,e).pluginDataMap)!==null&&t!==void 0?t:vu},O0=(n,e,t)=>fu(n,e)[t];function Ba(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Nn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ba(Object(t),!0).forEach(function(r){Gg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Gg(n,e,t){return(e=qg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qg(n){var e=Xg(n,"string");return typeof e=="symbol"?e:e+""}function Xg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var pu=(n,e)=>({type:mu,id:n,payload:e}),nn=(n,e)=>(t,r)=>t(pu(n,Nn(Nn({},He(r(),n)),e))),x0=(n,e,t)=>(r,i)=>r(pu(n,Nn(Nn({},He(i(),n)),{},{pluginDataMap:Nn(Nn({},fu(i(),n)),{},{[e]:t})})));Object.entries(Wg).map(n=>{var[e,t]=n;return Md.register(e,t)});var gu=m.createContext(null);gu.displayName="PersistentStateContext";function Er(n,e){return"".concat(n,"::").concat(e)}function Zg(n){var{initialState:e,onChange:t,children:r}=n,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),[a]=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=m.useRef(new Map),l=m.useCallback((p,g,b)=>{var{type:w}=b,E=Er(g,w),P=s.current.get(E);if(P!=null&&P!==p)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));s.current.set(E,p),i.current&&a.get(E)!==b&&(a.set(E,b),t([...a.entries()]))},[i,t,a]),u=m.useRef(e[Symbol.iterator]()),c=m.useCallback((p,g)=>{var b=Er(p,g),w=a.get(b);if(w==null&&o.current){var{value:E}=u.current.next(),P=E;return a.set(b,P),P}return w},[a]),h=m.useCallback((p,g,b)=>{var w=Er(g,b),E=s.current.get(w);E===p&&(a.delete(w),s.current.delete(w),i.current&&t([...a.entries()]))},[i,t,a]),v=m.useCallback((p,g,b)=>{var w=Er(g,b),E=s.current.get(w);E===p&&s.current.delete(w)},[]),f=m.useMemo(()=>({addState:l,removeState:h,deregisterHook:v,getState:c}),[l,c,h,v]);return d.jsx(gu.Provider,{value:f,children:r})}var Yg=W.module("DashboardPanelWrapper");function Qg(n){var{glContainer:e,children:t}=n,r=m.useCallback(a=>{e.setPersistedState(a)},[e]),{persistedState:i}=e.getConfig(),[o]=m.useState(()=>i!=null&&!Array.isArray(i)?(Yg.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return d.jsx(Zg,{initialState:o,onChange:r,children:t})}var Zi=m.createContext(null);Zi.displayName="PanelIdContext";function Jg(){return m.useContext(Zi)}function Wa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function an(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wa(Object(t),!0).forEach(function(r){eb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function eb(n,e,t){return(e=tb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tb(n){var e=nb(n,"string");return typeof e=="symbol"?e:e+""}function nb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _n=W.module("DashboardLayout"),rb=Object.freeze({}),ib=[],Ua=()=>{},ob=1e3,Va=n=>n;function I0(n){var e,t,{id:r,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=ib,onLayoutChange:l=Ua,onLayoutInitialized:u=Ua,hydrate:c=du,dehydrate:h=uu,panelWrapper:v}=n,f=Ai(),p=(e=ws(j=>He(j,r)))!==null&&e!==void 0?e:rb,[g,b]=m.useState(!1),[w,E]=m.useState(!1),P=m.useRef(),[F]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[Z,re]=m.useState(a.getReactChildren()),Y=m.useMemo(()=>new Map,[]),k=m.useMemo(()=>new Map,[]),B=m.useCallback(function(j,C){var S,M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h;_n.debug2("registerComponent",j,C,M,z);function ie(x,J){var oe=C,fe=v,Be=sl(oe),Et=Be?d.jsx(oe,an(an({},x),{},{ref:J})):d.jsx(oe,an({},x)),{glContainer:Pt,glEventHub:ti}=x,Bn=_.getIdFromContainer(Pt);return d.jsx(jg,{glContainer:Pt,glEventHub:ti,children:d.jsx(Zi.Provider,{value:Bn,children:d.jsx(Qg,an(an({},x),{},{children:fe==null?Et:d.jsx(fe,an(an({},x),{},{children:Et}))}))})})}ie.displayName="DashboardWrapper(".concat((S=C.displayName)!==null&&S!==void 0?S:j,")");var mt=a.registerComponent(j,A.forwardRef(ie));return Y.set(j,M),k.set(j,z),mt},[c,h,Y,k,a,v]),Q=m.useCallback((j,C)=>{var S;return((S=Y.get(j))!==null&&S!==void 0?S:Va)(C,r)},[Y,r]),q=m.useCallback((j,C)=>{var S;return((S=k.get(j))!==null&&S!==void 0?S:Va)(C,r)},[k,r]),R=m.useMemo(()=>new Xi(a,Q,q,new Map,F,j=>{var{closed:C,openedMap:S}=j;f(nn(r,{closed:C,openedMap:S}))}),[q,f,Q,r,F,a]),U=Mc(j=>{var C=P.current,S=C==null||!_.isEqual(C,j);_n.debug("handleLayoutStateChanged",S,j),S&&(_n.debug("Layout config has changed","lastConfig",C,"dehydratedLayoutConfig",j),b(a.root.contentItems.length===0),P.current=j,l(j),re(a.getReactChildren()))},ob,{flushOnUnmount:!0});m.useEffect(()=>()=>U.flush(),[U]);var X=m.useCallback(()=>{if(!w){var j=a.toConfig(),C=j.content,S=_.dehydrateLayoutConfig(C,q);U(S)}},[q,w,a,U]),$=m.useCallback(j=>{var C=_.getIdFromContainer(j);a.eventHub.emit(le.DRAGGING,C),E(!0)},[a.eventHub]),V=m.useCallback(j=>{var C=_.getIdFromContainer(j);a.eventHub.emit(le.DROPPED,C),E(!1)},[a.eventHub]),K=m.useCallback(j=>{if(_n.debug2("handleComponentCreated",j),!(j==null||j.config==null||!qt(j.config)||j.config.component==null||j.element==null)){var C=j.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),S="".concat(C,"-component");j.element.addClass(S)}},[]),pe=m.useCallback(()=>{re(a.getReactChildren())},[a]);Le(a,"stateChanged",X),Le(a,"itemPickedUp",$),Le(a,"itemDropped",V),Le(a,"componentCreated",K),Le(a.eventHub,le.TITLE_CHANGED,X),Le(a,"reactChildrenChanged",pe);var ke=Nc(s);return m.useEffect(function(){if(ke!==s&&s!==P.current){_n.debug("loadNewConfig effect triggered. previousLayoutConfig",ke,"layoutConfig",s,"lastConfig",P.current),_n.debug("Setting new layout content...");for(var C=_.hydrateLayoutConfig(s,Q);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var S=0;S<C.length;S+=1)a.root.addChild(C[S]);b(a.root.contentItems.length===0)}},[Q,a,s,R,ke]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,Z,A.Children.map(i,j=>j!=null?d.jsx(Xh,{fallback:[],children:A.cloneElement(j,{id:r,layout:a,panelManager:R,registerComponent:B})}):null)]})}var bu=m.createContext(null);bu.displayName="DashboardIdContext";function D0(){var n=m.useContext(bu);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function ab(n,e,t){return(e=sb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sb(n){var e=lb(n,"string");return typeof e=="symbol"?e:e+""}function lb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function yu(n,e,t){if(n){if(t(n)===!0)return n;for(var r=n.child;r;){var i=yu(r,e,t);if(i)return i;r=r.sibling}}}function ub(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var Yi=ub(m.createContext(null));Yi.displayName="FiberContext";class N0 extends m.Component{constructor(){super(...arguments),ab(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Yi.Provider,{value:this._reactInternals,children:e})}}function db(){var n=m.useContext(Yi);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>Ot()),t=m.useMemo(()=>{for(var r of[n,n==null?void 0:n.alternate].filter(o=>o!=null)){var i=yu(r,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[n,e]);return t}var M0="default",cb="CREATE_DASHBOARD",hb="CLOSE_DASHBOARD",{listen:k0,emit:mb,useListener:j0}=wt(cb),{listen:L0,emit:vb,useListener:A0}=wt(hb);function fb(n,e,t){return(e=pb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pb(n){var e=gb(n,"string");return typeof e=="symbol"?e:e+""}function gb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cu 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:r}=this.props;return[...(e=r==null||(t=r.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 r;return(r=(t==null?void 0:t.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s;if(((i=t[r].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[r])===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(le.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!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){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o=!!(!((i=e[r])===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:r,glContainer:i}=this.props,o=(e=_.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:r}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:ne.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var o=(e=r.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:ne.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:ne.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:ne.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(ne,{actions:i})}}fb(Cu,"defaultProps",{additionalActions:[]});var bb=n=>({workspace:Sl(n)}),yb=$n(bb,{setWorkspace:El})(Cu);function Su(n,e,t){return(e=Cb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cb(n){var e=Sb(n,"string");return typeof e=="symbol"?e:e+""}function Sb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wu extends m.PureComponent{constructor(e){super(e),Su(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=A.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!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,r=t==null?void 0:t.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return d.jsxs("form",{className:G("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(r,"-input"),children:["Rename ",r]}),d.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),d.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(ae,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(ae,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Ur,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Su(wu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var Pr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Ka(n,e,t){return(e=wb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wb(n){var e=Eb(n,"string");return typeof e=="symbol"?e:e+""}function Eb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pb=W.module("Panel");class Tb extends m.PureComponent{constructor(e){super(e),Ka(this,"ref",void 0),Ka(this,"getAdditionalActions",Qt((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),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=A.createRef();var{glContainer:t}=this.props;this.state={title:_.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,{componentPanel:t,glContainer:r,glEventHub:i}=this.props;r.on("resize",this.handleResize),r.on("show",this.handleBeforeShow),r.on("shown",this.handleShow),r.on("hide",this.handleHide),r.on("tab",this.handleTab),r.on("tabClicked",this.handleTabClicked),i.on(Pr.focus,this.handleTabFocus),i.on(Pr.blur,this.handleTabBlur),i.emit(le.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:r}=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),r.off(Pr.focus,this.handleTabFocus),r.off(Pr.blur,this.handleTabBlur),r.emit(le.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:_.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:r}=this.props;r.emit(le.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,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleResize(){for(var{onResize:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=_.getRootFromContainer(t),i=_.getComponentConfigFromContainer(t);L(i),_.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=_.getRootFromContainer(e),i=_.getComponentConfigFromContainer(e);if(i==null){Pb.error("Could not get component config from container",e);return}var o=_.cloneComponent(r,i);o!==null&&t.emit(le.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ne.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ne.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a=Ws,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:c=!1,isRenamable:h=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:G("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(bn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Wr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(yb,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,c,h)}),h&&d.jsx(wu,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),v.element[0])]})}}var _b=vl(Tb),Ob=W.module("useDhId"),ci="__dhId";function R0(){var n,e,t=(n=(e=db())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[ci],i=Jg();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(ci," to be a string, but got ").concat(typeof r));return r}return i??(Ob.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(ci," prop. Defaulting to null.")),null)}function dr(n,e,t){return(e=xb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xb(n){var e=Ib(n,"string");return typeof e=="symbol"?e:e+""}function Ib(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qe{}dr(qe,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");dr(qe,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");dr(qe,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");dr(qe,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");dr(qe,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function rn(n,e,t){return(e=Db(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Db(n){var e=Nb(n,"string");return typeof e=="symbol"?e:e+""}function Nb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class It{}rn(It,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");rn(It,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");rn(It,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");rn(It,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");rn(It,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");rn(It,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");rn(It,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");rn(It,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const F0=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function $t(n,e,t){return(e=Mb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mb(n){var e=kb(n,"string");return typeof e=="symbol"?e:e+""}function kb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class te{}$t(te,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");$t(te,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");$t(te,"CLOSE_FILE","NotebookEvent.closeFile");$t(te,"RENAME","NotebookEvent.rename");$t(te,"RENAME_FILE","NotebookEvent.renameFile");$t(te,"REGISTER_FILE","NotebookEvent.registerFile");$t(te,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");$t(te,"UNREGISTER_FILE","NotebookEvent.unregisterFile");$t(te,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Qi=wt(qe.SESSION_OPENED),jb=Qi.listen,$0=Qi.emit,H0=Qi.useListener,Ji=wt(qe.SESSION_CLOSED),Lb=Ji.listen,B0=Ji.emit,W0=Ji.useListener,Ab=["children"];function za(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ga(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?za(Object(t),!0).forEach(function(r){Ni(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):za(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Rb(n,e){if(n==null)return{};var t,r,i=Fb(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Fb(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function Ni(n,e,t){return(e=$b(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $b(n){var e=Hb(n,"string");return typeof e=="symbol"?e:e+""}function Hb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Bb extends m.PureComponent{constructor(e){super(e),Ni(this,"stopListenForSessionClosed",void 0),Ni(this,"stopListenForSessionOpened",void 0),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;this.stopListenForSessionClosed=Lb(e,this.handleSessionClosed),this.stopListenForSessionOpened=jb(e,this.handleSessionOpened),e.on(It.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var e,t,{glEventHub:r}=this.props;(e=this.stopListenForSessionClosed)===null||e===void 0||e.call(this),(t=this.stopListenForSessionOpened)===null||t===void 0||t.call(this),r.off(It.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var{onClearAllFilters:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e){var{onSessionOpen:t}=this.props;t==null||t(e)}render(){var e=this.props,{children:t}=e,r=Rb(e,Ab);return d.jsx(_b,Ga(Ga({},r),{},{children:t}))}}var cr=vl(Bb);const U0=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Wb=Object.freeze({}),Ub=new Map,Xr=Object.freeze([]),V0=(n,e)=>{var t;return(t=He(n,e).columns)!==null&&t!==void 0?t:Xr},K0=(n,e)=>{var t;return(t=He(n,e).filterSets)!==null&&t!==void 0?t:Xr},z0=(n,e)=>{var t;return(t=He(n,e).filters)!==null&&t!==void 0?t:Xr},G0=(n,e)=>{var t;return(t=He(n,e).tableMap)!==null&&t!==void 0?t:Ub},q0=(n,e)=>He(n,e).isolatedLinkerPanelId,Eu=(n,e)=>{var t;return(t=He(n,e).links)!==null&&t!==void 0?t:Xr},X0=(n,e)=>He(n,e).columnSelectionValidator,Z0=(n,e)=>{var t;return(t=He(n,e).consoleSettings)!==null&&t!==void 0?t:Wb},Y0=(n,e)=>He(n,e).connection,hr=(n,e)=>He(n,e).sessionWrapper,Q0=(n,e)=>t=>t(nn(n,{connection:e})),J0=(n,e)=>t=>t(nn(n,{sessionWrapper:e})),Pu=(n,e)=>t=>t(nn(n,{links:e})),eS=(n,e)=>(t,r)=>{var i=Eu(r(),n),o=e.filter(a=>i.findIndex(s=>Qn(s.start,a.start)&&Qn(s.end,a.end))<0);return t(Pu(n,i.concat(o)))},tS=(n,e)=>(t,r)=>{var i=Eu(r(),n),o=i.filter(a=>!e.includes(a.id));return t(Pu(n,o))},nS=(n,e)=>t=>t(nn(n,{isolatedLinkerPanelId:e})),rS=(n,e)=>t=>t(nn(n,{columnSelectionValidator:e})),Vb=(n,e)=>t=>t(nn(n,{consoleSettings:e})),iS=(n,e)=>t=>t(nn(n,{filterSets:e}));function Hr(n,e,t){return(e=Kb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kb(n){var e=zb(n,"string");return typeof e=="symbol"?e:e+""}function zb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Tr=W.module("CommandHistoryPanel");class mr extends m.Component{static handleError(e){Tr.error(e)}constructor(e){super(e),Hr(this,"container",void 0),Hr(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=A.createRef(),this.pending=new rr;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(qe.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(qe.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){var{session:t,language:r,sessionId:i}=e;this.setState({session:t,sessionId:i,language:r},()=>{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:r,language:i}=this.state;if(Tr.debug("handleSendToNotebook",r,e),!r){Tr.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?te.CREATE_NOTEBOOK:te.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Tr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(qe.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;L(t),L(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(mr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(cr,{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(Ve,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),d.jsx(ne,{actions:o})]})]})}}Hr(mr,"COMPONENT","CommandHistoryPanel");Hr(mr,"TITLE","Command History");var Gb=(n,e)=>{var t=yl(n),r=hr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},qb=$n(Gb,null,null,{forwardRef:!0})(mr),Tu=m.createContext(null);Tu.displayName="PluginsContext";var on=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",ELEMENT_PLUGIN:"ElementPlugin",MIDDLEWARE_PLUGIN:"MiddlewarePlugin",MULTI_PLUGIN:"MultiPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",WIDGET_PLUGIN:"WidgetPlugin"});function Xb(n){return"DashboardPlugin"in n}function Zb(n){return"AuthPlugin"in n}function Yb(n){return"TablePlugin"in n}function Qb(n){return Xb(n)||Zb(n)||Yb(n)}function Jb(n){return"type"in n&&n.type===on.DASHBOARD_PLUGIN}function Mi(n){return"type"in n&&n.type===on.MIDDLEWARE_PLUGIN}function vr(n){return"type"in n&&n.type===on.WIDGET_PLUGIN}function _u(n){return vr(n)&&"dashboardTypes"in n&&n.dashboardTypes!=null}function ey(n){return"type"in n&&n.type===on.TABLE_PLUGIN}function ty(n){return"type"in n&&n.type===on.AUTH_PLUGIN}function Ou(n){return"type"in n&&n.type===on.THEME_PLUGIN}function xu(n){return"type"in n&&n.type===on.ELEMENT_PLUGIN}function Iu(n){return"type"in n&&n.type===on.MULTI_PLUGIN}function ki(n){return Jb(n)||ty(n)||xu(n)||Iu(n)||ey(n)||Ou(n)||vr(n)||Mi(n)}var ny=["metadata"],ry=["metadata"],iy=["Component"],oy=["Component"];function qa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qa(Object(t),!0).forEach(function(r){ay(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ay(n,e,t){return(e=sy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sy(n){var e=ly(n,"string");return typeof e=="symbol"?e:e+""}function ly(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Zr(n,e){if(n==null)return{};var t,r,i=uy(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function uy(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var nt=W.module("@deephaven/plugin.PluginUtils");function kn(n){var e,t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Component";return(e=(t=n.displayName)!==null&&t!==void 0?t:n.name)!==null&&e!==void 0?e:r}function Xa(n,e){return n==null||!vr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function oS(n,e){return n==null||!_u(n)?!1:[n.dashboardTypes].flat().some(t=>t===e)}function dy(n){var e=d.jsx(ve,{icon:Ns});if(!vr(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function aS(n){var e=[...n.entries()].filter(t=>Ou(t[1]));return nt.debug("Getting theme data from plugins",e),e.map(t=>{var[r,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:kd(r,s),name:s,styleContent:u}})}).flat()}function sS(n){var e=[...n.entries()].filter(t=>xu(t[1])&&t[1].mapping!=null);return nt.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,r]=t;return Object.entries(r.mapping)}))}function cy(n,e){return e.length===0?(nt.debug("No middleware to chain for component",kn(n)),n):(nt.debug("Chaining component middleware",kn(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function a(s){var{metadata:l}=s,u=Zr(s,ny);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?d.jsx(t,Fe(Fe({},u),{},{metadata:l})):d.jsx(i,Fe(Fe({},u),{},{metadata:l,Component:t}))}return a.displayName="".concat(r.name,"(").concat(kn(t),")"),a},n))}function lS(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(nt.debug("No panel middleware to chain for panel component",kn(n)),n):(nt.debug("Chaining panel middleware",kn(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var o=i.panelComponent,a=[i.supportedTypes].flat(),s=A.forwardRef((l,u)=>{var{metadata:c}=l,h=Zr(l,ry),v=u!=null?{ref:u}:{};return(c==null?void 0:c.type)!=null&&!a.includes(c.type)?d.jsx(r,Fe(Fe(Fe({},v),h),{},{metadata:c})):d.jsx(o,Fe(Fe(Fe({},v),h),{},{metadata:c,Component:r}))});return s.displayName="".concat(i.name,"Panel(").concat(kn(r,"Panel"),")"),s},n))}function uS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"PanelMiddleware",t=A.forwardRef((r,i)=>{var{Component:o}=r,a=Zr(r,iy),{inject:s,wrap:l}=n(a),u=o,c=d.jsx(u,Fe(Fe({ref:i},a),s));return l!=null?l(c):c});return t.displayName=e,t}function dS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"WidgetMiddleware";function t(r){var{Component:i}=r,o=Zr(r,oy),{inject:a,wrap:s}=n(o),l=i,u=d.jsx(l,Fe(Fe({},o),a));return s!=null?s(u):u}return t.displayName=e,t}function hy(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function my(n){return ki(n)?n:hy(n)&&ki(n.default)?n.default:Qb(n)?n:null}function Za(n,e,t,r){if(n.has(e)){nt.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,Fe(Fe({},t),{},{version:r}))}function cS(n,e,t,r,i,o){i!=null&&(e[i]=t,nt.debug("Registered plugin '".concat(i,"' in module resolve map")));var a=my(t);if(a==null){nt.error("Plugin '".concat(r,"' is missing an exported value."));return}Iu(a)?(nt.debug("MultiPlugin '".concat(r,"' contains ").concat(a.plugins.length," plugins")),a.plugins.forEach(s=>{if(!ki(s)){nt.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),s);return}var l=typeof s.name=="string"?s.name.trim():"";if(l.length===0){nt.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),s);return}Za(n,l,s,o)})):Za(n,r,a,o)}function hS(n){var e=new Map;n.forEach(s=>{s.package!=null&&e.set(s.package,s)});var t=new Map;n.forEach(s=>{var l=new Set;s.dependencies!=null&&s.dependencies.forEach(u=>{var c=e.get(u);c!=null?l.add(c):nt.warn("Plugin '".concat(s.name,"' depends on '").concat(u,"' which is not in the manifest"))}),t.set(s,l)});for(var r=[],i=new Set(n),o=new Set,a=function(){var l=[];if(i.forEach(c=>{var h=t.get(c);if(h==null||h.size===0){l.push(c);return}var v=!0;h.forEach(f=>{o.has(f)||(v=!1)}),v&&l.push(c)}),l.length===0){var u=[...i].map(c=>c.name);return nt.error("Circular plugin dependency detected among: ".concat(u.join(", "),". Loading remaining plugins together.")),r.push([...i]),1}r.push(l),l.forEach(c=>{i.delete(c),o.add(c)})};i.size>0&&!a(););return r}function vy(n,e){var t;return(t=[...n.values()].find(r=>_u(r)&&[r.dashboardTypes].flat().some(i=>i===e)))!==null&&t!==void 0?t:null}function fy(){return or(Tu,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Ya=W.module("@deephaven/plugin.WidgetView");function mS(n){var{fetch:e,type:t}=n,r=fy(),{basePlugin:i,middleware:o}=m.useMemo(()=>{var s,l=[];return r.forEach(u=>{if(!(!vr(u)&&!Mi(u))){var c=[u.supportedTypes].flat().includes(t);c&&(Mi(u)?l.push(u):(s!=null&&Ya.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(s.name," with ").concat(u.name)),s=u))}}),{basePlugin:s,middleware:l}},[r,t]),a=m.useMemo(()=>i==null?(Ya.debug("No base plugin found for widget type ".concat(t)),null):cy(i.component,o),[i,o,t]);if(a!=null)return d.jsx(a,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}function Qa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qa(Object(t),!0).forEach(function(r){fn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fn(n,e,t){return(e=py(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function py(n){var e=gy(n,"string");return typeof e=="symbol"?e:e+""}function gy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var On=W.module("ConsolePanel"),by=500,yy=Object.freeze({consoleSettings:{},itemIds:[]});class Yr extends m.PureComponent{constructor(e){super(e),fn(this,"consoleRef",void 0),fn(this,"objectSubscriptionCleanup",void 0),fn(this,"savePanelState",gn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};On.debug("Saving panel state",l),this.setState({panelState:l})},by)),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=A.createRef();var{panelState:t}=e,r=_r(_r({},yy),t||{}),{consoleSettings:i,itemIds:o}=r;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(le.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(le.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(r=>{On.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,u=[...a,...l],c=new Map(o);u.forEach(v=>{var{title:f}=v;f!==void 0&&c.delete(f)});var h=[...a,...s];return h.forEach(v=>{v.title!==void 0&&c.set(v.title,v)}),{objectMap:c}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,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:r}=this.state,i=r.get(e);return i==null&&t&&(i=Ot(),this.setItemId(e,i)),i}deleteItemId(e){this.setState(t=>{var{itemIds:r}=t;On.debug("Delete item",e,r);var i=[...r.keys()].find(a=>r.get(a)===e);if(i===void 0)return null;var o=new Map(r);return o.delete(i),{itemIds:o}})}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,{itemIds:i}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(r=e.props)===null||r===void 0||(r=r.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handlePanelClosed(e){var{glContainer:t}=this.props,r=_.getRootFromContainer(t),i=_.getStackForConfig(r,{id:e});i!==null&&_.getContentItemInStack(i,{id:e})!==null||this.deleteItemId(e)}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(qe.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:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&_.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;Ra(i,r),vb(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;On.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(qe.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,plugins:r}=this.props,{type:i}=e,o=vy(r,i);if(o!=null){var a=o.createDashboardPayload(e);On.debug("openDashboardWidget",a),mb(t,a)}else this.openPanelWidget(e)}openPanelWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;L(r);var{config:i,session:o}=r,{title:a=e.name}=e;L(a);var s=this.getItemId(a);L(s);var l={fetch:()=>o.getObject(e),panelId:s,widget:_r(_r({},fm(e)),{},{sessionId:i.id})};On.debug("openPanelWidget",l),Pg(t,l)}addCommand(e){var t,r=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,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{Ra(a,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(r=>Xa(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Xa(i,e));return r!=null?dy(r):d.jsx(Pl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(bn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:c,session:h,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:w,type:E}=c;return d.jsx(cr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:h!=null&&d.jsx(Yt,{dh:p,ref:this.consoleRef,settings:s,session:h,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:E,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:_l.LANGUAGE_MAP.get(E)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),b,d.jsx("div",{children:"•"})]}),d.jsx(pp,{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})})}}fn(Yr,"COMPONENT","ConsolePanel");fn(Yr,"TITLE","Console");fn(Yr,"contextType",cu);var Cy=(n,e)=>({commandHistoryStorage:yl(n),sessionWrapper:hr(n,e.localDashboardId),timeZone:bm(n),plugins:ym(n)}),hi=$n(Cy,null,null,{forwardRef:!0})(Yr);function vS(n){return n==="file"||n==="directory"}function yt(n){return n.type==="directory"}function Sy(n,e,t){return(e=wy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wy(n){var e=Ey(n,"string");return typeof e=="symbol"?e:e+""}function Ey(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eo extends Error{constructor(){super("No file exists at the path specified"),Sy(this,"isFileNotFound",!0)}}function Ja(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function es(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ja(o,r,i,a,s,"next",l)}function s(l){Ja(o,r,i,a,s,"throw",l)}a(void 0)})}}var cn=function(n){return n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN="",n}({});class N{static fileExists(e,t){return es(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof eo))throw r;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(!N.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var r=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return r.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var r;return(r=t.pop())!==null&&r!==void 0?r:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),r=null,i=null;t<0?i=e:(i=e.substring(0,t),r=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return r!==null?"".concat(o,".").concat(r):o}static getUniqueCopyFileName(e,t){return es(function*(){for(var r=N.getCopyFileName(t);yield N.fileExists(e,r);)r=N.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return cn.GROOVY;case"py":return cn.PYTHON;case"pyc":return cn.PYTHON_COMPILED;case"scala":return cn.SCALA;case"txt":return cn.PLAIN_TEXT;default:return cn.UNKNOWN}}static getParent(e){if(!N.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(!N.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]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=N.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Xn("Name cannot be empty");if(t.includes(e))throw new Xn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new Xn('Invalid characters in name: "'.concat((o=(a=e.match(r))===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(r=>N.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.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 to=26;function ji(n){return yt(n)?N.makePath(n.filename):N.getPath(n.filename)}function ts(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=ji(e);if(n.some(r=>{var{filename:i}=r;return N.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>yt(r)&&t.startsWith(N.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Py(n){if(yt(n))return n.isExpanded?jd:Ld;var e=N.getMimeType(n.basename);switch(e){case cn.PYTHON:return Rd;default:return Ad}}function Li(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:c,onDragOver:h,onDragEnd:v,onDragExit:f,onDrop:p}=n,g=(e=r==null?void 0:r.some(k=>k.id===s.id))!==null&&e!==void 0?e:!1,b=ji(s),w=i&&u?ji(u):null,E=i&&o&&yt(s)&&w===b,P=i&&o&&w===b,F=i&&!o&&w===b,Z=Py(s),re=N.getDepth(s.filename),Y=Array(re).fill(null).map((k,B)=>d.jsx("span",{className:"file-list-depth-line"},B));return d.jsxs("div",{className:G("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":E,"is-in-drop-target":P,"is-invalid-drop-target":F,"is-selected":a}),onDragStart:k=>c(l,k),onDragOver:k=>h(l,k),onDragEnd:k=>v(l,k),onDragExit:f,onDrop:k=>p(l,k),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:Z,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function ns(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ns(Object(t),!0).forEach(function(r){Ty(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ns(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ty(n,e,t){return(e=_y(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _y(n){var e=Oy(n,"string");return typeof e=="symbol"?e:e+""}function Oy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var We=W.module("FileList"),xy=500,rs="item-list-scroll-pane";function Iy(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Li,rowHeight:l=to,overscanCount:u=Ct.DEFAULT_OVERSCAN}=n,[c,h]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,w]=m.useState(),[E,P]=m.useState(),[F,Z]=m.useState([]),re=m.useRef(),Y=m.useRef(null),k=m.useRef(null),B=m.useCallback(x=>{if(x.length===0||c==null)return[];for(var J=[],oe=0;oe<x.length;oe+=1)for(var fe=x[oe],Be=fe[0];Be<=fe[1];Be+=1)Be>=c.offset&&Be<c.offset+c.items.length&&J.push(c.items[Be-c.offset]);return J},[c]),Q=m.useCallback(x=>{var J=B([[x,x]]);if(J.length>0)return J[0]},[B]),q=m.useCallback(()=>{var x=pt.count(F);if(x===0)return null;if(x===1){var J=F[0][0],oe=Q(J);if(oe!=null)return oe.filename}return"".concat(x," items")},[Q,F]),R=m.useCallback(x=>{if(!(!b||!p)){We.debug("dropItems",b,"to",x);try{var{files:J,targetPath:oe}=ts(b,p);if(i==null||i(J,oe),x!=null){var fe;Z([[x,x]]),(fe=Y.current)===null||fe===void 0||fe.focusItem(x)}}catch(Be){We.error("Unable to complete move",Be)}}},[b,p,i]),U=m.useCallback((x,J)=>{var oe=c.items[x-c.offset];oe!==void 0&&(We.debug("handleItemClick",oe),o(oe,J),yt(oe)&&(t==null||t.setExpanded(oe.filename,!oe.isExpanded)))},[c,o,t]),X=m.useCallback((x,J)=>{var oe,fe;We.debug2("handleItemDragStart",x,F);var Be=F;pt.isSelected(F,x)||(Be=[[x,x]],Z(Be)),w(B(Be)),(oe=Y.current)===null||oe===void 0||oe.resetMouseState();var Et=document.createElement("div"),Pt=document.createElement("div");Pt.className="dnd-placeholder-content",Pt.innerText=(fe=q())!==null&&fe!==void 0?fe:"",Et.appendChild(Pt),Et.className="file-list-dnd-placeholder",document.body.appendChild(Et),J.dataTransfer.setDragImage(Et,0,0),J.dataTransfer.effectAllowed="move",P(Et)},[q,B,F]),$=m.useCallback((x,J)=>{J.preventDefault(),We.debug2("handleItemDragOver",J),g(Q(x))},[Q]),V=m.useCallback((x,J)=>{We.debug("handleItemDragEnd",x),E==null||E.remove(),w(void 0),g(void 0),P(void 0)},[E]),K=m.useCallback((x,J)=>{R(x)},[R]),pe=m.useCallback(()=>{We.debug2("handleItemDragExit"),g(void 0)},[]),ke=m.useCallback(x=>{x.target instanceof Element&&x.target.classList.contains(rs)&&(x.preventDefault(),We.debug2("handleListDragOver",x),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),j=m.useCallback(x=>{x.target instanceof Element&&x.target.classList.contains(rs)&&(We.debug("handleListDrop"),R())},[R]),C=m.useCallback(function(x){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(We.debug2("handleSelectionChange",x),J===!0||x!==F){Z(x);var oe=B(x);a(oe)}},[B,a,F]),S=m.useCallback(x=>{if(We.debug2("handleFocusChange",x),x!=null){var[J]=B([[x,x]]);r(J)}else r();re.current=x},[B,r]),M=m.useCallback((x,J)=>{We.debug("handleViewportChange",x,J),(x!==v.top||J!==v.bottom)&&f({top:x,bottom:J})},[v]),z=m.useMemo(()=>{if(!b||!p)return!1;try{return ts(b,p),We.debug("handleValidateDropTarget true"),!0}catch{return We.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:ie}=n;m.useEffect(()=>{ie!==void 0&&(ie==="/"?t.collapseAll():(t.setExpanded(ie,!1),t.setExpanded(ie,!0)))},[t,ie]),m.useEffect(function(){We.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 J=t.onUpdate(oe=>{h({items:oe.items.map(fe=>Or(Or({},fe),{},{itemName:fe.basename})),offset:oe.offset,itemCount:t.size})});return()=>{J()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),F.length>0&&C(F,!0)},[c,S,C,F]),m.useEffect(function(){if(p!=null&&yt(p)&&p.filename!=="/"){var J=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},xy);return()=>clearTimeout(J)}},[p,t]);var mt=m.useCallback(x=>s(Or(Or({},x),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:z,onDragStart:X,onDragEnd:V,onDragOver:$,onDragExit:pe,onDrop:K})),[V,pe,$,X,K,b,p,z,s]);return d.jsx("div",{ref:k,className:G("file-list",{"is-dragging":b!=null}),onDragOver:ke,onDrop:j,children:d.jsx(Ct,{ref:Y,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:S,onSelect:U,onSelectionChange:C,onViewportChange:M,selectedRanges:F,renderItem:mt,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Dy={DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[O.DELETE],macShortcut:[I.CMD,O.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[O.ENTER],macShortcut:[O.ENTER]})};const is={FILE_EXPLORER:Dy};var os=W.module("FileListItemEditor"),Ny=()=>Promise.resolve();function My(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Ny}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[c,h]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var E;(E=o.current)===null||E===void 0||E.focus()},[o]),f=m.useCallback(E=>E.stopPropagation(),[]),p=m.useCallback(()=>{c.then(()=>{r(a)}).catch(E=>os.info("Unable to validate name",E))},[r,a,c]);m.useEffect(function(){var P=_e.makeCancelable(i(a));return P.then(()=>u(void 0)).catch(F=>{_e.isCanceled(F)||u(F)}),h(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{os.debug2("handleBlur"),p()},[p]),b=m.useCallback(E=>{var{value:P}=E.target;s(P)},[]),w=m.useCallback(E=>{E.stopPropagation();var{key:P}=E;switch(P){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:G("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function as(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?as(Object(t),!0).forEach(function(r){ky(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):as(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ky(n,e,t){return(e=jy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jy(n){var e=Ly(n,"string");return typeof e=="symbol"?e:e+""}function Ly(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Du(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:c,onSelectionChange:h,table:v,rowHeight:f=to,validateRename:p=()=>Promise.resolve()}=n,[g,b]=m.useState(),[w,E]=m.useState([]),[P,F]=m.useState(),Z=m.useCallback(K=>{E(K),h==null||h(K)},[h]),re=m.useCallback(K=>{F(K)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),k=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),B=m.useCallback(()=>{i==null||i()},[i]),Q=m.useCallback(()=>{P&&(o==null||o(N.getPath(P.filename)))},[P,o]),q=m.useCallback(()=>{P&&b(P)},[P]),R=m.useCallback(()=>{b(void 0)},[]),U=m.useCallback(K=>{g&&(u==null||u(g,K),b(void 0))},[u,g]),X=m.useMemo(()=>{if(g)return[];var K=[];return i&&K.push({title:"New File",description:"Create new file",action:B,group:ne.groups.medium}),o&&K.push({title:"New Folder",description:"Create new folder",action:Q,group:ne.groups.medium}),a&&K.push({title:"Copy File",description:"Copy the selected file",action:Y,group:ne.groups.low,disabled:P==null||yt(P)}),s&&w.length>0&&K.push({title:"Delete",description:"Delete",shortcut:is.FILE_EXPLORER.DELETE,action:k,group:ne.groups.low}),u&&K.push({title:"Rename",description:"Rename",shortcut:is.FILE_EXPLORER.RENAME,action:q,group:ne.groups.low,disabled:P==null}),K},[Y,k,B,Q,q,P,a,i,o,s,u,w,g]),$=m.useCallback(K=>(L(g),p(g,K)),[g,p]),V=m.useCallback(K=>{var{item:pe}=K;return g&&g.filename===pe.filename?d.jsx(Li,mi(mi({},K),{},{children:d.jsx(My,{item:pe,validate:$,onSubmit:U,onCancel:R})})):d.jsx(Li,mi({},K))},[R,U,g,$]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(Iy,{onMove:l,onSelect:c,onSelectionChange:Z,onFocusChange:re,renderItem:V,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),r&&d.jsx(ne,{actions:X})]})}Du.displayName="FileListContainer";function ss(n,e,t){return(e=Ay(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ay(n){var e=Ry(n,"string");return typeof e=="symbol"?e:e+""}function Ry(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nr extends Xn{constructor(e){super("Name already exists"),ss(this,"isExistingFile",!0),ss(this,"info",void 0),this.info=e}}function ls(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function us(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ls(o,r,i,a,s,"next",l)}function s(l){ls(o,r,i,a,s,"throw",l)}a(void 0)})}}var Tt=W.module("FileExplorer");function no(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:c,rowHeight:h=to}=n,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var U;function X(){return $.apply(this,arguments)}function $(){return $=us(function*(){Tt.debug("initTable"),U=_e.makeCancelable(e.getTable(),V=>V.close());try{g(yield U)}catch(V){_e.isCanceled(V)||Tt.error("Unable to initialize table",V)}}),$.apply(this,arguments)}return X(),()=>{U.cancel()}},[e]);var b=m.useCallback(R=>{_e.isCanceled(R)||Tt.error(R)},[]),w=m.useCallback(()=>{Tt.debug("handleCreateFile"),s()},[s]),E=m.useCallback(()=>{Tt.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(R=>{Tt.debug("handleCopyFile",R.filename),i(R)},[i]),F=m.useCallback(R=>{Tt.debug("handleDelete, pending confirmation",R),f(R)},[]),Z=m.useCallback(()=>{Tt.debug("handleDeleteConfirm",v),v.forEach(R=>e.deleteFile(yt(R)?N.makePath(R.filename):R.filename)),o(v),f([])},[v,o,e]),re=m.useCallback(()=>{Tt.debug("handleDeleteCancel"),f([])},[]),Y=m.useCallback((R,U)=>{var X=N.reducePaths(R.map($=>yt($)?N.makePath($.filename):$.filename));X.forEach($=>{var V=N.isPath($)?"".concat(U).concat(N.getBaseName($.substring(0,$.length-1)),"/"):"".concat(U).concat(N.getBaseName($));e.moveFile($,V).then(()=>{a($,V)}).catch(b)})},[b,a,e]),k=m.useCallback((R,U)=>{var X=R.filename,$=yt(R);$&&!X.endsWith("/")&&(X="".concat(X,"/"));var V="".concat(N.getParent(X)).concat(U);$&&!V.endsWith("/")&&(V="".concat(V,"/")),Tt.debug2("handleRename",X,V),e.moveFile(X,V).catch(b),a(X,V)},[b,a,e]),B=m.useCallback(function(){var R=us(function*(U,X){if(X!==U.basename){N.validateName(X);var $="".concat(N.getPath(U.filename)).concat(X);try{var V=yield e.info($);throw new Nr(V)}catch(K){if(!(K instanceof eo))throw K}}});return function(U,X){return R.apply(this,arguments)}}(),[e]),Q=v.length>0,q=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return d.jsxs("div",{className:"file-explorer",children:[p&&d.jsx(Du,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:P,onCreateFolder:E,onCreateFile:w,onMove:Y,onDelete:F,onRename:k,onSelect:u,onSelectionChange:c,rowHeight:h,table:p,validateRename:B}),d.jsx(Jn,{isOpen:Q,headerText:q,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:Z,confirmButtonText:"Delete"})]})}no.displayName="FileExplorer";function ds(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Fy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ds(o,r,i,a,s,"next",l)}function s(l){ds(o,r,i,a,s,"throw",l)}a(void 0)})}}function hn(n,e,t){return(e=$y(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $y(n){var e=Hy(n,"string");return typeof e=="symbol"?e:e+""}function Hy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var sn=W.module("NewItemModal");class pn extends m.PureComponent{static getValidationMessage(e){return e instanceof Nr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){_e.isCanceled(e)||sn.error(e)}constructor(e){super(e),hn(this,"inputRef",A.createRef()),hn(this,"cancelableValidatePromise",void 0),hn(this,"cancelableExistingItemPromise",void 0),hn(this,"pending",new rr),hn(this,"pathMap",new Map),hn(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,r=N.hasPath(t)?N.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:N.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:N.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!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=N.hasPath(e)?N.getPath(e):"/";this.setState({path:t,value:N.getBaseName(e),validationError:void 0,prevExtension:N.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=_e.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return Fy(function*(){N.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Nr(l)}catch(u){if(!(u instanceof eo))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(pn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(sn.debug("handleSelect",e),e.type==="directory")this.setState({path:N.makePath(e.filename)});else{var t=e.basename,r=N.getPath(e.filename);this.setState({value:t,path:r},()=>{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:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof Xn))throw e;sn.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:r}=this.state;sn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){sn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=N.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){sn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;sn.debug("submitModal",r,i);var l=N.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(u=>{if(u instanceof Nr&&s!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw _e.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).catch(this.handleValidationError).catch(pn.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((r,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),d.jsxs(A.Fragment,{children:[d.jsx(ae,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:Fd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:c,validationError:h,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=N.fileExtensionToString(f),w=N.fileExtensionToString(p),E=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(_s,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(Os,{toggle:r,children:o}),d.jsx(xs,{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:G("form-control",{"is-invalid":h}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d.jsx("div",{className:"invalid-feedback",children:pn.getValidationMessage(h)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(no,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(nl,{children:[d.jsx(ae,{kind:"secondary",onClick:r,children:"Cancel"}),d.jsx(ae,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:E})]})]}),d.jsx(Jn,{isOpen:c,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(Jn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}hn(pn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function By(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(ae,{kind:"ghost",icon:$s,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(ae,{kind:"ghost",icon:$d,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(cl,{value:i,onChange:r,placeholder:"Search by name"})})]})}function cs(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Wy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){cs(o,r,i,a,s,"next",l)}function s(l){cs(o,r,i,a,s,"throw",l)}a(void 0)})}}function Nu(n,e,t){return(e=Uy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uy(n){var e=Vy(n,"string");return typeof e=="symbol"?e:e+""}function Vy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ln=W.module("FileExplorerPanel"),Ky=(n,e)=>{var t=Cl(n),r=hr(n,e.localDashboardId),{session:i,config:o}=r??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},zy=$n(Ky,null,null,{forwardRef:!0});function Gy(n){var e=n;return e!=null&&typeof e.button=="number"}class Fn extends A.Component{static handleError(e){ln.error(e)}static isFocusEvent(e){return Gy(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};ln.debug("handleCreateFile",t,r,i),e.emit(te.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){ln.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){ln.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Fn.handleError)}handleCopyFile(e){var t=this;return Wy(function*(){var{fileStorage:r}=t.props;if(yt(e)){ln.error("Invalid item in handleCopyItem",e);return}var i=yield N.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(te.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=N.makePath(e[0].filename):t=N.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(ln.debug("fileSelect",e),e.type!=="directory"){var r=Fn.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(te.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;ln.debug("handleRename",e,t),r.emit(te.RENAME_FILE,e,t)}handleSessionOpened(e){var{session:t,language:r}=e;this.setState({session:t,language:r})}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:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return d.jsxs(cr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(By,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(no,{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(pn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}Nu(Fn,"COMPONENT","FileExplorerPanel");Nu(Fn,"TITLE","File Explorer");var qy=zy(Fn);function nr(n,e,t){return(e=Xy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xy(n){var e=Zy(n,"string");return typeof e=="symbol"?e:e+""}function Zy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var hs=W.module("LogPanel");class Qr extends m.PureComponent{constructor(e){super(e),nr(this,"isBottomVisible",void 0),nr(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){var{session:t}=e;hs.debug("Session opened",[t]),this.setState({session:t})}handleSessionClosed(e){hs.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return d.jsxs(cr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&d.jsx(we,{session:r,ref:i=>{this.logView=i}})]})}}nr(Qr,"defaultProps",{session:null});nr(Qr,"COMPONENT","LogPanel");nr(Qr,"TITLE","Log");var Yy=(n,e)=>{var t;return{session:(t=hr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},Qy=$n(Yy,null,null,{forwardRef:!0})(Qr);function ms(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function xr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ms(o,r,i,a,s,"next",l)}function s(l){ms(o,r,i,a,s,"throw",l)}a(void 0)})}}function vs(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function et(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vs(Object(t),!0).forEach(function(r){Re(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Re(n,e,t){return(e=Jy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jy(n){var e=eC(n,"string");return typeof e=="symbol"?e:e+""}function eC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tC=m.lazy(()=>Bs(()=>import("./MarkdownNotebook-wb8Y8t0p.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),de=W.module("NotebookPanel"),fs=400;class xe extends m.Component{static handleError(e){_e.isCanceled(e)||de.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(xe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(xe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=N.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",Qt((v,f)=>et(et({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",Qt((v,f,p)=>{var g=[{title:"Find",icon:Wd,action:this.handleFind,group:ne.groups.high,shortcut:Ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Is,action:this.handleCopy,group:ne.groups.medium,order:20},{title:"Rename File",icon:Ud,action:this.handleShowRename,group:ne.groups.medium,order:30},{title:"Delete File",icon:Ls,action:this.handleDelete,group:ne.groups.medium,order:40},{title:"Show Minimap",icon:v?Mn:void 0,action:this.handleMinimapChange,group:ne.groups.low,shortcut:Ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?Mn:void 0,action:this.handleWordWrapChange,group:ne.groups.low,shortcut:Ke.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:ne.groups.low,order:10}),g.push({title:"Format on Save",icon:p?Mn:void 0,action:this.handleFormatOnSaveChange,group:ne.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 rr,this.debouncedSavePanelState=gn(this.savePanelState.bind(this),fs),this.debouncedLoad=gn(this.load.bind(this),fs),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,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&&N.hasPath(s.itemName),c=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,h=c?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},de.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(te.RENAME_FILE,this.handleRenameFile),t.on(le.DROPPED,this.handlePanelDropped),e.on(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;r!==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:r,isPreview:i}=this.state;e.off(te.RENAME_FILE,this.handleRenameFile),e.off(le.DROPPED,this.handlePanelDropped),t.off(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(te.UNREGISTER_FILE,r,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:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);L(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r==null||r.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){de.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){de.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(te.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(te.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(te.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;L(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;de.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:c}=u;this.renameTab(c,N.getBaseName(s))}var h=et(et({},t),{},{language:(a=xe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(h.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:h}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&N.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){de.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.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;de.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:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,u=et(et({},a),{},{value:s}),c=et(et({},a),{},{value:l}),h={settings:c,fileMetadata:i,isPreview:o};return de.debug("Saving panel state",h),{settings:u,panelState:h}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(te.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return xr(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;L(o);var{language:s}=a,{itemName:l}=o,u=yield N.getUniqueCopyFileName(t,l);de.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var c={id:u,itemName:u},h={value:null,language:s};r.emit(te.SELECT_NOTEBOOK,i,s,h,c,!0)})()}handleDelete(){de.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return xr(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;de.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(N.hasPath(o.itemName)&&(yield N.fileExists(t,o.itemName))?(i.emit(te.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){de.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+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:r}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};r(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,r=t.wordWrap==="on"?"off":"on";return{settings:et(et({},t),{},{wordWrap:r})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:r}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};r(i)}handleLinkClick(e){var{notebooksUrl:t,session:r,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==="/"){de.debug("Ignoring invalid notebook link",a);return}de.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},u={id:a,itemName:a};s.emit(te.SELECT_NOTEBOOK,r,i,l,u)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;_e.isCanceled(t)||(_e.isTimedOut(t)&&(t=new Error("File not found.")),de.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return xr(function*(){de.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:r=!1}=t;r&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=xe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=et(et({},a.settings),{},{language:o});return de.debug("handleSaveSuccess",i,s,l),s&&N.hasPath(s.itemName)&&s.itemName!==i.itemName&&(de.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(xe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){_e.isCanceled(e)||(this.setState({savedChangeCount:0}),de.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),de.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}),N.getBaseName(o)!==N.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,N.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 xr(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield me.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){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){de.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){de.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e){var{session:t,language:r}=e;this.setState({session:t,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;de.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){de.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];de.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){de.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){de.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r==null?void 0:r.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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=et(et({},s),{},{language:t,value:r}),u={id:null,itemName:e};de.debug("handleCreateNotebook",o,a,l,u),i.emit(te.CREATE_NOTEBOOK,o,a,l,u)}runCommand(e){if(e===void 0||e===""){de.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(qe.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:r}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",r??!1)}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:c,error:h,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:w,sessionLanguage:E,settings:P,showCloseModal:F,showDeleteModal:Z,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,k=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:xe.DEFAULT_NAME,B=k.endsWith(".md"),Q=(b==null?void 0:b.id)!=null,q=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),R=w!=null,U=E===q.language,X=!f||!R||!U,$=!f,V=[{action:this.handleSave,shortcut:Xt.SAVE},{action:this.handleMinimapChange,shortcut:Ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ke.NOTEBOOK.WORDWRAP}],K=Pi.getDisabledRunTooltip(R,U,"Notebook extension","Run"),pe=Pi.getDisabledRunTooltip(R,U,"Notebook extension","Run Selected"),ke=[{title:Q?"Rename":"Save As…",order:10,group:ne.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ne.groups.high,order:20}],j=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[j!=null&&Wr.createPortal(d.jsx("span",{className:G(xe.UNSAVED_INDICATOR_CLASS_NAME,{[xe.UNSAVED_STATUS_CLASS_NAME]:u!==c})}),j),d.jsxs(cr,{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:ke,renderTabTooltip:()=>k,children:[!B&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(ae,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:X,icon:d.jsx(ve,{icon:Fs,transform:"grow-4"}),tooltip:"Run ".concat(Ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),K!=null&&d.jsx(he,{children:K})]}),d.jsxs("span",{children:[d.jsx(ae,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:X,icon:d.jsx(ve,{icon:Hd,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(ae,{kind:"ghost",className:"mr-auto",disabled:$,onClick:this.handleSave,icon:Bd,tooltip:"Save ".concat(Xt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(ae,{kind:"ghost",className:"btn-overflow",disabled:$,icon:Rs,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(ar,{actions:this.getDropdownOverflowActions,popperOptions:xe.POPPER_OPTIONS})})]}),d.jsx(Bl,{isLoaded:f,isLoading:p,error:h,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:E,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:q,focusOnMount:Y,ref:C=>{this.notebook=C}})]}),B&&d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(tC,{content:(r=q.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(pn,{isOpen:re,type:"file",defaultValue:k,title:Q?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(Jn,{isOpen:Z,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(Jn,{isOpen:F,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(ne,{actions:V})]})]})}}Re(xe,"COMPONENT","NotebookPanel");Re(xe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(xe,"DEFAULT_NAME","Untitled");Re(xe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(xe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(xe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var nC=(n,e)=>{var t=Cl(n),r=wl(n),i=hr(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:r,session:o,sessionLanguage:s}},un=$n(nC,{updateNotebookSettings:Tm},null,{forwardRef:!0})(xe);function rC(){var{python:{linter:n={}}={}}=Kg(wl),{isEnabled:e=!1,config:t}=n;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function ps(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gs(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ps(Object(t),!0).forEach(function(r){iC(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ps(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function iC(n,e,t){return(e=oC(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oC(n){var e=aC(n,"string");return typeof e=="symbol"?e:e+""}function aC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=W.module("ConsolePlugin");function bs(n){return n.notebook!==void 0}function sC(n){Dg(n)}function fS(n){sC(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,u]=m.useState(new Map),[c,h]=m.useState(new Map);rC();var v=Ai(),f=m.useCallback(()=>i.getLastUsedPanelOfType(hi),[i]),p=m.useCallback((C,S)=>{u(M=>new Map(M.set(C,S)))},[u]),g=m.useCallback(C=>{u(S=>(S.delete(C),new Map(S)))},[u]),b=m.useCallback((C,S)=>{h(M=>new Map(M.set(C,S)))},[h]),w=m.useCallback(C=>{h(S=>(S.delete(C),new Map(S)))},[h]),E=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,z=C&&C.trim();if(!z)be.info("Ignoring empty code");else{var ie=f();if(!ie||!(ie instanceof hi.WrappedComponent)){be.error("Console panel not found");return}be.debug("Send command: ",C,S,M),ie.addCommand(C,S,M)}},[f]),P=m.useCallback(C=>{v(Vb(e,C))},[v,e]),F=m.useCallback(C=>{var{language:S}=C,M=S==="python"?"py":S,z=null;return M==null?(be.debug("No extension for language",S),z="Untitled-".concat(s.current)):z="Untitled-".concat(s.current,".").concat(M),s.current+=1,z},[]),Z=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:M}=C;if(M!=null&&l.has(M))return l.get(M);if(M!=null&&c.has(M))return c.get(M);if(S)return Ot()},[l,c]),re=m.useCallback((C,S)=>{_.renameComponent(r.root,{id:C},S)},[r.root]),Y=m.useCallback((C,S)=>{be.debug("Rename file panel",C,S);var M;if(l.has(C)&&(M=l.get(C),g(C),M!=null&&p(S,M)),c.has(C)&&(M=c.get(C),w(C),M!=null&&b(S,M)),M===void 0){be.debug2("File ".concat(C," isn't open, no need to rename the tab"));return}re(M,N.getBaseName(S))},[l,c,re,p,b,g,w]),k=m.useCallback(C=>{var S=Z(C,!1);if(S==null){be.error("Could not find panel id for file metadata",C);return}_.activateTab(r.root,{id:S})},[Z,r.root]),B=m.useCallback((C,S,M)=>{if(be.debug("registerFilePanel",C,S,M),S==null||S.id==null){be.debug("Ignore empty file id",S);return}var{id:z}=S;if(M){b(z,C);return}if(l.has(z)){var ie=l.get(z);if(C===ie){be.debug("Update tab title for file ".concat(z));var{itemName:mt}=S;Y(z,mt)}else be.error("File ".concat(z," already associated with a different tab ").concat(ie));return}p(z,C),c.has(z)&&w(z)},[l,c,Y,p,b,w]),Q=m.useCallback((C,S)=>{if(be.debug("unregisterFileTab",C,S),C==null||C.id==null){be.debug("Ignore empty file id",C);return}var{id:M}=C;if(S){w(M);return}g(M)},[g,w]),q=m.useCallback((C,S)=>{be.debug("closeFilePanel",C);var{id:M}=C;if(M==null){be.warn("File ID is null, ignore close event");return}var z=null,ie=!1;if(l.has(M))z=l.get(M);else if(c.has(M))z=c.get(M),ie=!0;else{be.debug("File ".concat(M," isn't open, ignore close event"));return}Q(C,ie),_.closeComponent(r.root,{id:z},S)},[r.root,l,c,Q]),R=m.useCallback(C=>{var{itemName:S}=C;return N.getBaseName(S)},[]),U=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpen",C,S,l),S!=null&&l.has(S)},[l]),X=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpenAsPreview",C,S,c),S!=null&&c.has(S)},[c]),$=m.useCallback(C=>{if(C!=null){var S=i.getOpenedPanelById(C);S&&bs(S)&&S.focus()}},[i]),V=m.useCallback(C=>{var{id:S,settings:M,fileMetadata:z,session:ie,sessionLanguage:mt,isPreview:x=!1}=C,J={settings:M,fileMetadata:z},oe=R(z);return{type:"react-component",component:un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ie,sessionLanguage:mt,panelState:J,isPreview:x,notebooksUrl:a},title:oe,id:S}},[R,e,a]),K=m.useCallback(function(C,S,M){var z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(M)},ie=Z(z);if(U(z)&&ie!=null){be.debug("File is already open, focus panel"),k(z),$(ie);return}if(ie==null){be.error("Panel ID for file metadata is null");return}var mt=_.getStackForComponentTypes(r.root,[un.COMPONENT]),x=V({id:ie,settings:M,fileMetadata:z,session:C,sessionLanguage:S});be.debug("createNotebook",x,l),_.openComponentInStack(mt,x)},[U,$,F,Z,r.root,V,l,k]),pe=m.useCallback(function(C,S,M,z){var ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;be.debug("selectNotebook",z,ie);var mt=U(z),x=X(z),[J]=[...c.values()],oe=!ie,fe=oe&&J?J:Z(z);if(fe==null||fe==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(z)));if(mt||x)k(z);else{var Be=_.getStackForComponentTypes(r.root,[un.COMPONENT]),Et=V({id:fe,settings:M,fileMetadata:z,session:C,sessionLanguage:S,isPreview:oe});_.openComponentInStack(Be,Et)}if(x&&ie){var Pt=z.id,ti=_.getStackForConfig(r.root,{component:un.COMPONENT,id:fe}),Bn=_.getContentItemInStack(ti,{component:un.COMPONENT,id:fe});Pt!=null&&Bn&&Ae(Bn)&&(Bn.container.emit(te.PROMOTE_FROM_PREVIEW),w(Pt),p(Pt,fe))}ie&&$(fe)},[k,U,X,$,Z,r.root,V,c,w,p]),ke=m.useCallback(function(C,S){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,ie=i.getLastUsedPanelOfType(un);ie&&bs(ie)?M!=null&&M.value!=null&&ie.notebook!=null&&ie.notebook.append(M.value):z&&K(C,S,M)},[K,i]),j=m.useCallback((C,S)=>Fg.hydrate(gs(gs({},C),{},{notebooksUrl:a}),S),[a]);return Vn(o,hi,t),Vn(o,qb),Vn(o,qy),Vn(o,Qy),Vn(o,un,j),Le(r.eventHub,qe.SEND_COMMAND,E),Le(r.eventHub,qe.SETTINGS_CHANGED,P),Le(r.eventHub,te.CLOSE_FILE,q),Le(r.eventHub,te.CREATE_NOTEBOOK,K),Le(r.eventHub,te.SELECT_NOTEBOOK,pe),Le(r.eventHub,te.RENAME,re),Le(r.eventHub,te.RENAME_FILE,Y),Le(r.eventHub,te.SEND_TO_NOTEBOOK,ke),Le(r.eventHub,te.REGISTER_FILE,B),Le(r.eventHub,te.UNREGISTER_FILE,Q),null}function Jr(n,e,t){return(e=lC(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lC(n){var e=uC(n,"string");return typeof e=="symbol"?e:e+""}function uC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ei{}Jr(ei,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Jr(ei,"INPUT_FILTER","ControlType.INPUT_FILTER");Jr(ei,"MARKDOWN","ControlType.MARKDOWN");Jr(ei,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{Pm as $,$C as A,ae as B,ol as C,Ge as D,HC as E,Al as F,Js as G,tl as H,xt as I,el as J,O as K,$e as L,wl as M,Tm as N,er as O,_e as P,H as Q,Ev as R,ml as S,T,Xt as U,ll as V,ei as W,U0 as X,ar as Y,Pl as Z,Vr as _,gt as a,I as a$,nn as a0,x0 as a1,pu as a2,qC as a3,Sl as a4,_C as a5,hr as a6,Y0 as a7,ym as a8,He as a9,UC as aA,ZC as aB,zC as aC,GC as aD,Q0 as aE,J0 as aF,WC as aG,KC as aH,El as aI,VC as aJ,me as aK,gC as aL,Ic as aM,or as aN,Lc as aO,Dc as aP,Ys as aQ,Zs as aR,Nc as aS,Mc as aT,pt as aU,Ct as aV,Ac as aW,il as aX,cl as aY,Xh as aZ,Kr as a_,M0 as aa,zg as ab,BC as ac,Fg as ad,Xd as ae,zs as af,te as ag,It as ah,v0 as ai,p0 as aj,b0 as ak,C0 as al,le as am,F0 as an,k0 as ao,L0 as ap,un as aq,Pg as ar,fm as as,Ws as at,Ur as au,fS as av,ne as aw,Jn as ax,fy as ay,XC as az,Dt as b,kr as b$,nl as b0,oh as b1,Ri as b2,yC as b3,Zh as b4,Fi as b5,SC as b6,sl as b7,Qs as b8,vl as b9,t0 as bA,of as bB,i0 as bC,o0 as bD,cf as bE,hf as bF,s0 as bG,a0 as bH,Vi as bI,l0 as bJ,hp as bK,ap as bL,mp as bM,Yt as bN,Tl as bO,Ve as bP,Ar as bQ,qf as bR,Wl as bS,_l as bT,Wm as bU,Dl as bV,Mm as bW,jn as bX,Ol as bY,Ln as bZ,kf as b_,al as ba,Rc as bb,Sh as bc,Mr as bd,dm as be,gl as bf,pl as bg,fl as bh,wC as bi,EC as bj,PC as bk,Uv as bl,Vv as bm,Ee as bn,Zv as bo,df as bp,ee as bq,ef as br,Me as bs,YC as bt,jl as bu,Ll as bv,e0 as bw,r0 as bx,QC as by,JC as bz,y as c,lS as c$,Nl as c0,pp as c1,we as c2,wi as c3,Ke as c4,Bl as c5,Pi as c6,Us as c7,_ as c8,Vn as c9,Ig as cA,Tg as cB,Og as cC,_g as cD,xg as cE,h0 as cF,d0 as cG,Wg as cH,E0 as cI,P0 as cJ,A0 as cK,j0 as cL,f0 as cM,y0 as cN,g0 as cO,S0 as cP,D0 as cQ,R0 as cR,Le as cS,m0 as cT,Jg as cU,aS as cV,sS as cW,on as cX,Tu as cY,mS as cZ,cy as c_,c0 as ca,O0 as cb,_b as cc,hb as cd,cb as ce,ci as cf,bu as cg,I0 as ch,w0 as ci,cu as cj,jg as ck,Zi as cl,Xi as cm,gu as cn,Zg as co,mu as cp,Pr as cq,Dg as cr,uu as cs,vb as ct,mb as cu,Ra as cv,T0 as cw,_0 as cx,fu as cy,du as cz,Xe as d,Vb as d$,uS as d0,dS as d1,dy as d2,my as d3,vy as d4,hS as d5,ty as d6,Jb as d7,xu as d8,Zb as d9,qy as dA,qs as dB,mC as dC,cr as dD,Xs as dE,wt as dF,nS as dG,G0 as dH,q0 as dI,Eu as dJ,z0 as dK,X0 as dL,rr as dM,V0 as dN,iS as dO,K0 as dP,yt as dQ,rS as dR,tS as dS,eS as dT,Pu as dU,qe as dV,B0 as dW,$0 as dX,Z0 as dY,Lb as dZ,jb as d_,Xb as da,Qb as db,Yb as dc,Iu as dd,ki as de,ey as df,Ou as dg,_u as dh,Mi as di,vr as dj,Xa as dk,oS as dl,cS as dm,Za as dn,pC as dp,ho as dq,Eg as dr,Gr as ds,N0 as dt,N as du,eo as dv,vS as dw,hi as dx,Qy as dy,qb as dz,_m as e,rC as e0,W0 as e1,H0 as e2,vC as e3,bC as e4,fC as e5,ri as e6,ec as e7,ni as e8,n0 as e9,Xn as ea,bm as f,OC as g,RC as h,AC as i,LC as j,jC as k,kC as l,MC as m,TC as n,DC as o,IC as p,xC as q,Se as r,ce as s,he as t,vm as u,Pe as v,FC as w,NC as x,CC as y,Kg as z};
25
+ //# sourceMappingURL=ControlType-DQcTi2TW.js.map