@deephaven/embed-widget 1.19.1-console-types-fixes.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/build/assets/{App-DGG5i7aH.js → App-DB2ALvjW.js} +2 -2
  2. package/build/assets/{App-DGG5i7aH.js.map → App-DB2ALvjW.js.map} +1 -1
  3. package/build/assets/{Chart-DKHh5Uao.js → Chart-B3tA7j40.js} +2 -2
  4. package/build/assets/{Chart-DKHh5Uao.js.map → Chart-B3tA7j40.js.map} +1 -1
  5. package/build/assets/{IrisGrid-BPzHFgId.js → IrisGrid-D70Mca2_.js} +5 -5
  6. package/build/assets/IrisGrid-D70Mca2_.js.map +1 -0
  7. package/build/assets/{IrisGridThemeProvider-Cwryl7U7.js → IrisGridThemeProvider-BN7Uf3rs.js} +3 -3
  8. package/build/assets/{IrisGridThemeProvider-Cwryl7U7.js.map → IrisGridThemeProvider-BN7Uf3rs.js.map} +1 -1
  9. package/build/assets/{LocalWorkspaceStorage-D4ztC6j2.js → LocalWorkspaceStorage-CYV0tWOj.js} +2 -2
  10. package/build/assets/{LocalWorkspaceStorage-D4ztC6j2.js.map → LocalWorkspaceStorage-CYV0tWOj.js.map} +1 -1
  11. package/build/assets/LogPanel-DoNH0VZo.js +22 -0
  12. package/build/assets/LogPanel-DoNH0VZo.js.map +1 -0
  13. package/build/assets/{MarkdownEditor-QbBDn7vq.js → MarkdownEditor-6EfnAIfX.js} +2 -2
  14. package/build/assets/{MarkdownEditor-QbBDn7vq.js.map → MarkdownEditor-6EfnAIfX.js.map} +1 -1
  15. package/build/assets/{MarkdownNotebook-DYEUeoZY.js → MarkdownNotebook-DbLY2Ii4.js} +2 -2
  16. package/build/assets/{MarkdownNotebook-DYEUeoZY.js.map → MarkdownNotebook-DbLY2Ii4.js.map} +1 -1
  17. package/build/assets/{index-C6GbaYN7.js → index-D_Z2Er8S.js} +4 -4
  18. package/build/assets/{index-C6GbaYN7.js.map → index-D_Z2Er8S.js.map} +1 -1
  19. package/build/assets/{index-DeCsn-jO.js → index-Dms3SQTc.js} +3 -3
  20. package/build/assets/{index-DeCsn-jO.js.map → index-Dms3SQTc.js.map} +1 -1
  21. package/build/assets/index-fg-vlmrx.js +13 -0
  22. package/build/assets/index-fg-vlmrx.js.map +1 -0
  23. package/build/index.html +2 -2
  24. package/package.json +17 -17
  25. package/build/assets/IrisGrid-BPzHFgId.js.map +0 -1
  26. package/build/assets/LogPanel-BmImrjX0.js +0 -22
  27. package/build/assets/LogPanel-BmImrjX0.js.map +0 -1
  28. package/build/assets/index-DheYrF9m.js +0 -13
  29. package/build/assets/index-DheYrF9m.js.map +0 -1
@@ -1,22 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-ERtG8jGQ.js","./Plotly-DmMXXqmC.js","./plotly-Dgibcuuy.js","./helpers-BosuxZz1.js","./vendor-B6iGzW5m.js","./vendor-CdNlUFKS.css"])))=>i.map(i=>d[i]);
2
- import{ao as El,a as A,aO as Ts,T as Pl,z as Tl,X as Ol,Y as xl,V as Il,a4 as Dl,O as Ml,a8 as jl,d as Os,G as xs,e as Is,q as kl,aP as Nl,aH as Ll,aQ as Ds,aR as Al,aS as Rl,L as On,ac as Fl,_ as $l,aT as Ms,u as F,t as js,Z as Hl,aU as Ul,aN as Bl,aJ as ks,aK as Kl,f as Ns,n as Wl,aL as Lr,aV as zl,aW as Vl,aX as _i,aY as Gl,aZ as ql,a_ as Xl,a$ as Zl,v as Yl,k as Ls,aF as Jl,h as Er,aA as Ql,b0 as ed,b1 as Ei,aD as td,b2 as Pi,b3 as As,b4 as nd,au as rd,b5 as id,b6 as od,b7 as sd,b8 as ad,b9 as ld,ba as dd}from"./index-DeCsn-jO.js";import{r as h,af as xn,bn as dr,D as u,bD as ud,J as O,bE as Rs,bF as Ar,H as cd,G as R,R as ii,bG as hd,bp as md,I as ae,C as ft,bH as pd,a6 as fd,a7 as vd,E as Fs,ae as en,bI as gd,bJ as bd,bK as yd,bL as Cd,bA as Rr,bM as T,bN as Ti,bC as le,L as $s,N as Hs,bO as wd,bB as In,bx as sn,_ as Sd,bc as Pe,bP as _d,aa as Ed,au as Pd,bf as Oi,bQ as Td,bR as xi,be as Ge,bS as Us,bT as Od,by as Ve,bz as Kt,bU as Ii,bd as xd,bw as Id,bV as wn}from"./vendor-B6iGzW5m.js";var Dd=Object.freeze([]),sb=new Map,Bs=()=>{};function ab(n){return Array.isArray(n)?n:[n]}function lb(){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 Md(n,e,t){return(e=jd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jd(n){var e=kd(n,"string");return typeof e=="symbol"?e:e+""}function kd(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 Error{constructor(){super(...arguments),Md(this,"isCanceled",!0)}}function Nd(n,e,t){return(e=Ld(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ld(n){var e=Ad(n,"string");return typeof e=="symbol"?e:e+""}function Ad(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 Rd extends Error{constructor(){super(...arguments),Nd(this,"isClipboardPermissionsDeniedError",!0)}}function Fd(n,e,t){return(e=$d(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $d(n){var e=Hd(n,"string");return typeof e=="symbol"?e:e+""}function Hd(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 Pr extends Error{constructor(){super(...arguments),Fd(this,"isClipboardUnavailableError",!0)}}function Ud(n,e,t){return(e=Bd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bd(n){var e=Kd(n,"string");return typeof e=="symbol"?e:e+""}function Kd(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 Ks extends Error{constructor(){super(...arguments),Ud(this,"isPermissionUnsupported",!0)}}function Mi(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function Wd(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Mi(o,r,i,s,a,"next",l)}function a(l){Mi(o,r,i,s,a,"throw",l)}s(void 0)})}}function ji(n){return Fr.apply(this,arguments)}function Fr(){return Fr=Wd(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Ks:t}}),Fr.apply(this,arguments)}function ki(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function Ws(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){ki(o,r,i,s,a,"next",l)}function a(l){ki(o,r,i,s,a,"throw",l)}s(void 0)})}}function zs(n){return $r.apply(this,arguments)}function $r(){return $r=Ws(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}zd(n)}),$r.apply(this,arguments)}function zd(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 db(){return Hr.apply(this,arguments)}function Hr(){return Hr=Ws(function*(){try{var{clipboard:n}=navigator;if(n===void 0)throw new Pr;var e=yield ji("clipboard-read");if(e==="granted"){var t=yield n.readText();return t}if(e==="prompt"){try{yield n.readText()}catch{}if(e=yield ji("clipboard-read"),e==="granted"){var r=yield n.readText();return r}}if(e==="prompt"||e==="denied")throw new Rd}catch(i){throw i instanceof Ks?new Pr:i}throw new Pr}),Hr.apply(this,arguments)}var fn;function Vt(n,e,t){return(e=Vd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vd(n){var e=Gd(n,"string");return typeof e=="symbol"?e:e+""}function Gd(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 qd="table_",Vs="column_",Xd=new Set(["in","not","i","ii","k"]),Zd=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"]),Yd=/[^a-zA-Z0-9_$\-+@]/g,Jd=/[^A-Za-z0-9_$]/g,Qd=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,eu=/[^a-zA-Z0-9_]/g;function tu(n){return n.replace(/[ -]/g,"_")}function nu(n){return n.replace(/\s/g,"_")}class at{}fn=at;Vt(at,"legalize",(n,e,t,r,i,o)=>{var s=e(n.trim());return i&&(Xd.has(s)||Zd.has(s))&&(s=t+s),s=s.replace(r,""),s?(/^[0-9-]/.test(s)&&(s=t+s),s):t+o});Vt(at,"legalizeTableName",n=>fn.legalize(n,nu,qd,Yd,!1,0));Vt(at,"makeVariableName",n=>fn.legalizeTableName(n).replace(eu,"_"));Vt(at,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=fn.legalizeColumnName(t,r);e.includes(i)&&(i=Vs+r),e.push(i)}),e});Vt(at,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return fn.legalize(n,tu,Vs,Jd,!0,e)});Vt(at,"isValidTableName",n=>Qd.test(n));Vt(at,"isValidColumnName",n=>fn.legalizeColumnName(n)===n);class Gs extends CustomEvent{constructor(e,t){super(e,t)}}class He{static makeCancelable(e,t){var r=!1,i,o,s=new Promise((a,l)=>{o=l,Promise.resolve(e).then(d=>{r?t&&t(d):(i=d,a(d))}).catch(d=>l(d))});return s.cancel=()=>{r=!0,o(new Di),i!=null&&t&&t(i)},s}static isCanceled(e){return e instanceof Di}static isTimedOut(e){return e instanceof El}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function Ni(n,e,t){return(e=ru(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ru(n){var e=iu(n,"string");return typeof e=="symbol"?e:e+""}function iu(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(){Ni(this,"pending",[]),Ni(this,"resolved",[])}add(e,t){var r=He.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 ub(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 Je{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(!Je.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],s=i[1];if(o<=t&&t<=s)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],s=o.length-1;s>=0;s-=1){var a=o[s],l=a[0],d=a[1];if(l<=r&&i<=d)return o;r<=d&&l<=i&&(r=Math.min(r,l),i=Math.max(i,d),o.splice(s,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],s=o.length-1;s>=0;s-=1){var a=o[s],l=a[0],d=a[1];if(!(i<l||d<r))if(l<r&&i<d){o[s]=[l,r-1],o.splice(s+1,0,[i+1,d]);break}else r<=l&&d<=i?o.splice(s,1):l<r?o[s]=[l,r-1]:o[s]=[i+1,d]}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],s=i[0];s<=i[1];s+=1)o.push(e[s]);return o},[])}}function*cb(n,e){for(var t=n;t<=e;++t)yield t}var hb=" ";class ou{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 Dn;function kt(n,e,t){return(e=su(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function su(n){var e=au(n,"string");return typeof e=="symbol"?e:e+""}function au(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,s=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(s)}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,s=null;if(r==="ms")i=1e3,o=new Date(e).valueOf(),s=new Date(t).valueOf();else if(r==="ns")i=1e9,o=Number(e),s=Number(t);else return null;var a=(s-o)/i;return this.formatDuration(a)}}Dn=xe;kt(xe,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");kt(xe,"MILLIS_PER_SECOND",1e3);kt(xe,"NANOS_PER_SECOND",1e9);kt(xe,"NANOS_PER_MIN",60*Dn.NANOS_PER_SECOND);kt(xe,"NANOS_PER_HOUR",60*Dn.NANOS_PER_MIN);kt(xe,"MILLIS_PER_MIN",60*Dn.MILLIS_PER_SECOND);kt(xe,"MILLIS_PER_HOUR",60*Dn.MILLIS_PER_MIN);kt(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 lu(n,e,t){return(e=du(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function du(n){var e=uu(n,"string");return typeof e=="symbol"?e:e+""}function uu(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 Sn extends Error{constructor(){super(...arguments),lu(this,"isInvalid",!0)}}function qs(){var n=h.useRef(!1);return h.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function Li(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function cu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Li(o,r,i,s,a,"next",l)}function a(l){Li(o,r,i,s,a,"throw",l)}s(void 0)})}}var hu=A.module("useAsyncInterval");function mu(n,e){var t=qs(),r=h.useRef(0),i=h.useRef(0),o=h.useRef(null),s=h.useCallback(cu(function*(){var a=Date.now();i.current+=1;var l=o.current==null?e:a-o.current;o.current=a;try{yield n()}catch(m){hu.error("A tick error occurred:",m)}if(t.current){l+=Date.now()-o.current;var d=Math.max(0,l-e),c=Math.max(0,e-d);r.current=window.setTimeout(s,c)}}),[n,t,e]);h.useEffect(()=>(o.current=null,s(),()=>{window.clearTimeout(r.current)}),[e,s])}function Mn(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=h.useContext(n);if(t==null)throw new Error(e);return t}function pu(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:r=!1,trailing:i=!0,maxWait:o}=t,s=h.useMemo(()=>xn(n,e,o!=null?{leading:r,trailing:i,maxWait:o}:{leading:r,trailing:i}),[n,e,r,i,o]);return h.useEffect(()=>()=>s.cancel(),[s]),s}function fu(n){var e=h.useRef();return h.useEffect(function(){e.current=n}),e.current}function vu(n,e,t){var r=h.useRef(t),i=h.useRef(n);i.current=n;var o=h.useMemo(()=>dr(function(){return i.current(...arguments)},e,r.current),[e]);return h.useEffect(()=>()=>{var s,a;(s=(a=r.current)===null||a===void 0?void 0:a.flushOnUnmount)!==null&&s!==void 0&&s?o.flush():o.cancel()},[o]),o}function Xs(n){var e=h.useRef(null);return h.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var gu=3500,bu=A.module("useCopyToClipboard");function yu(){var[n,e]=h.useState(!1),t=h.useRef(null),r=h.useCallback(i=>{zs(i).then(()=>{e(!0)}).catch(o=>bu.error("Unable to copy ".concat(i),`
3
- `,o))},[]);return h.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},gu)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var Cu=["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 wu(n){return typeof n=="string"&&Cu.includes(n)}function Zs(n){return n!=null&&wu(n)?"var(--dh-color-".concat(n,")"):n}var Su=["color","UNSAFE_style"];function Ai(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 Fn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ai(Object(t),!0).forEach(function(r){_u(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ai(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _u(n,e,t){return(e=Eu(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Eu(n){var e=Pu(n,"string");return typeof e=="symbol"?e:e+""}function Pu(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 Tu(n,e){if(n==null)return{};var t,r,i=Ou(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 Ou(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 Ys=h.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=Tu(n,Su),o=h.useMemo(()=>Fn(Fn({},r),{},{color:Zs(t)}),[t,r]);return u.jsx(ud,Fn(Fn({},i),{},{ref:e,UNSAFE_style:o}))});Ys.displayName="Text";function Ri(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 St(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ri(Object(t),!0).forEach(function(r){tn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ri(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function tn(n,e,t){return(e=xu(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xu(n){var e=Iu(n,"string");return typeof e=="symbol"?e:e+""}function Iu(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 Fi="popper",Du={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(n,e)=>{var t,r,i=(t=Rs.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 cr extends h.Component{constructor(e){super(e),tn(this,"element",void 0),tn(this,"container",void 0),tn(this,"nodeRef",O.createRef()),tn(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=O.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props,{popper:r}=this.state;e.isShown!==t&&(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t?this.show():this.hide()})),r&&r.scheduleUpdate()}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var e,t,{popper:r}=this.state,{closeOnBlur:i,referenceObject:o}=this.props;if(!r&&this.container.current!==null){var{options:s,keepInParent:a}=this.props,l=a?Du:{placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},d=St(St(St({},l),s),{},{modifiers:St(St(St({},l.modifiers),s.modifiers),{},{preventOverflow:St(St({},(e=l.modifiers)===null||e===void 0?void 0:e.preventOverflow),(t=s.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 m=new Rs(o||c,this.element,d);m.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(i){var p=this.element.querySelector(".".concat(Fi));p instanceof HTMLElement&&!p.contains(document.activeElement)&&p.focus()}}),Ar.flushSync(()=>{this.setState({popper:m})})}}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(),Ar.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:s}=this.state;return u.jsx(Ts,{isPortal:!0,children:u.jsx(cd,{in:s,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,nodeRef:this.nodeRef,children:u.jsx("div",{ref:this.nodeRef,onClick:a=>{a.stopPropagation()},onKeyDown:a=>{a.key==="Escape"&&this.hide()},className:R(Fi,{interactive:i},e),onBlur:this.handleBlur,tabIndex:o?-1:void 0,role:"presentation",children:u.jsxs("div",{className:"popper-content",children:[t,u.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return u.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&ii.createPortal(this.renderContent(),this.element)})}}tn(cr,"defaultProps",{options:{},className:"",timeout:Pl.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,referenceObject:null,"data-testid":void 0});var Ur;function $i(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 Mu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$i(Object(t),!0).forEach(function(r){Qe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$i(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qe(n,e,t){return(e=ju(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ju(n){var e=ku(n,"string");return typeof e=="symbol"?e:e+""}function ku(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 Nu=A.module("Tooltip");class ie extends h.Component{static handleHidden(){ie.shownTooltipCount-=1,ie.shownTooltipCount===0&&(ie.lastHiddenTime=Date.now())}static handleShown(){ie.shownTooltipCount+=1}constructor(e){super(e),Qe(this,"container",void 0),Qe(this,"popper",void 0),Qe(this,"parent",void 0),Qe(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=O.createRef(),this.popper=O.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?ie.handleShown():ie.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&ie.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Nu.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(),s=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=s.left&&t<=s.left+s.width&&r>=s.top&&r<=s.top+s.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(ie.shownTooltipCount>0||Date.now()-ie.lastHiddenTime<ie.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(),Ar.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:s}=this.props,{isShown:a}=this.state,{options:l}=this.props;return l=Mu({placement:"bottom"},l),u.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:u.jsx(cr,{className:R(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:s,onExited:this.handleExited,interactive:e,referenceObject:r,children:u.jsxs("div",{className:"tooltip-content",children:[" ",a&&t]})})})}}Ur=ie;Qe(ie,"defaultTimeout",500);Qe(ie,"defaultReshowTimeout",100);Qe(ie,"triggerReshowThreshold",300);Qe(ie,"shownTooltipCount",0);Qe(ie,"lastHiddenTime",Date.now());Qe(ie,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:Ur.defaultReshowTimeout,timeout:Ur.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var Lu=A.module("ThemeProvider"),oi=h.createContext(null);oi.displayName="ThemeContext";function mb(n){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:r=Tl,children:i}=n,o=h.useMemo(()=>Ol(),[]),[s,a]=h.useState(null),[l,d]=h.useState(xl),c=h.useMemo(()=>e==null?null:Il(l,{base:o,custom:e??[]}),[o,l,e]),m=h.useMemo(()=>[...o,...e??[]],[o,e]);return h.useEffect(function(){if(!(c==null||e==null)){Dl(r);var f=Ml(r);Lu.debug2("updateThemePreloadData:",{active:c.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:f,selectedThemeKey:l}),jl({themeKey:l,preloadStyleContent:f})}},[c,l,e,r]),h.useEffect(()=>{a({activeThemes:c,selectedThemeKey:l,themes:m,setSelectedThemeKey:d})},[c,l,m]),t&&c==null?null:u.jsxs(u.Fragment,{children:[c==null?null:u.jsx(u.Fragment,{children:c.map(p=>u.jsx("style",{"data-theme-key":p.themeKey,children:p.styleContent},p.themeKey))}),s==null?null:u.jsx(oi.Provider,{value:s,children:u.jsx(Ts,{children:i})})]})}function Js(){return Mn(oi,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var Au=["color","UNSAFE_style"];function Hi(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 $n(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hi(Object(t),!0).forEach(function(r){Ru(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ru(n,e,t){return(e=Fu(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fu(n){var e=$u(n,"string");return typeof e=="symbol"?e:e+""}function $u(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 Hu(n,e){if(n==null)return{};var t,r,i=Uu(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 Uu(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 Qs=h.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=Hu(n,Au),o=h.useMemo(()=>$n($n({},r),{},{color:Zs(t)}),[t,r]);return u.jsx(hd,$n($n({},i),{},{ref:e,UNSAFE_style:o}))});Qs.displayName="Heading";function Bu(n){var{children:e,className:t,style:r,"data-testid":i}=n;return u.jsx("div",{className:R("btn-group",t),style:r,role:"group","data-testid":i,children:e})}var Ku=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Ui(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 Bi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ui(Object(t),!0).forEach(function(r){Wu(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ui(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wu(n,e,t){return(e=zu(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zu(n){var e=Vu(n,"string");return typeof e=="symbol"?e:e+""}function Vu(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 Gu(n,e){if(n==null)return{};var t,r,i=qu(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 qu(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 Xu(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 R("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Zu(n){switch(n){case"group-end":return R("pl-2","pr-3")}}var ne=O.forwardRef((n,e)=>{var{kind:t,variant:r,type:i="button",tooltip:o,icon:s,disabled:a=!1,active:l,onClick:d,onContextMenu:c,onMouseDown:m,onMouseUp:p,onMouseEnter:f,onMouseLeave:v,onKeyDown:g,className:b,style:w,children:C,tabIndex:y,"data-testid":I,"aria-label":X}=n,Q=Gu(n,Ku),{UNSAFE_className:z}=md({},"button"),j;r&&(j=Zu(r));var N;s&&(N=O.isValidElement(s)?s:u.jsx(ae,{icon:s}));var G=N!=null&&C==null,H=Xu(t,G),M;o!==void 0&&(M=typeof o=="string"?u.jsx(ie,{children:o}):o);var K=X;X===void 0&&G&&o!=null&&typeof o=="string"&&(K=o);var W=u.jsxs("button",Bi(Bi({"data-testid":I,ref:e,type:i,className:R("btn",H,j,{active:l},b,z),onClick:d,onContextMenu:c,onMouseUp:p,onMouseDown:m,onMouseEnter:f,onMouseLeave:v,onKeyDown:g,style:w,disabled:a,tabIndex:y,"aria-label":K},Q),{},{children:[s&&N,C,o!=null&&!a&&M]}));return a&&o!=null?u.jsxs("span",{className:"btn-disabled-wrapper",children:[W,M]}):W});ne.displayName="Button";function ea(n){var{className:e,children:t,"data-testid":r}=n;return u.jsx("div",{className:R("modal-footer",e),"data-testid":r,children:t})}function Br(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:s,onModalDisable:a,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:c="Discard",isConfirmDanger:m=!1,children:p,"data-testid":f}=n,v=h.useRef(null),g=h.useRef(null),b=h.useCallback(()=>{g.current!==null&&g.current.checked&&a&&a(),o()},[o,a]),w=h.useCallback(()=>{var y;(y=v.current)===null||y===void 0||y.focus()},[]),C="";return e&&(C=typeof r=="function"?r():r),u.jsxs(Os,{isOpen:e,onOpened:w,children:[u.jsx(xs,{closeButton:!1,children:t}),u.jsx(Is,{children:C}),u.jsxs(ea,{children:[a&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),s&&u.jsx(ne,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:s,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:c}),i&&u.jsx(ne,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),u.jsxs(Bu,{children:[u.jsx(ne,{kind:m?"danger":"primary",onClick:b,ref:v,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:d}),p]})]})]})}function Yu(n,e,t){return(e=Ju(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ju(n){var e=Qu(n,"string");return typeof e=="symbol"?e:e+""}function Qu(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 Tr(n){return n.then!==void 0}class ce{static disableAllActions(){ce.actionsDisabled=!0}static enableAllActions(){ce.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,s;return((o=e.order)!==null&&o!==void 0?o:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var a,l;return((a=e.title)!==null&&a!==void 0?a:"")>((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(ce.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ce.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ce.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 s=i[o],a=void 0;typeof s=="function"?a=s():a=s,a!=null&&(a instanceof Promise?t&&r.push(a):Array.isArray(a)?r=r.concat(a):r.push(a))}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 s=(i+t*o+r.length)%r.length,a=r[s];if(!(a instanceof Promise)&&a.disabled!==!0)return s}return e}}Yu(ce,"actionsDisabled",!1);var Ki=A.module("GlobalContextAction");class ec extends h.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),Ki.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!ce.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;Ki.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class tc extends h.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:s}=o;if(o.title!=null||o.menuElement||s){var a=u.jsx(ec,{action:o,"data-testid":t},"".concat(o.title,".").concat(s==null?void 0:s.id));r.push(a)}}return r}}function ta(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)}var Hn=A.module("ContextActions");class oe extends h.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),ta(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=O.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=>!Tr(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!Tr(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:d}=r,c=t.find(m=>d.contains(m));if(c!==void 0)return Hn.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(ce.isContextActionEvent(e)||(e.contextActions=[]),!!ce.isContextActionEvent(e)){var{actions:s}=this.props;if(s!=null){var a=s;Array.isArray(a)&&(a=a.filter(l=>Tr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(a)}Hn.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(!ce.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;Hn.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),Hn.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return u.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:u.jsx(tc,{actions:t})})}}ta(oe,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var na=O.forwardRef((n,e)=>{var t,r,{closeMenu:i,children:o,menuItem:s,onMenuItemClick:a,onMenuItemMouseMove:l,onMenuItemContextMenu:d,isKeyboardSelected:c=!1,isMouseSelected:m=!1,"data-testid":p}=n,f=h.useCallback(H=>{a(s,H)},[s,a]),v=h.useCallback(H=>{l(s,H)},[s,l]),g=h.useCallback(H=>{d(s,H)},[s,d]);function b(H,M,K){if(typeof H.type=="string")return H;var W={menuItem:s,closeMenu:i,isKeyboardSelected:c,isMouseSelected:m,iconElement:M,displayShortcut:K,"data-testid":p};return O.cloneElement(H,{forwardedProps:W})}var w=(t=s.shortcutText)!==null&&t!==void 0?t:(r=s.shortcut)===null||r===void 0?void 0:r.getDisplayText(),C=null;if(s.icon){var y=s.icon;if(O.isValidElement(y))C=y;else{var I;s.iconColor!=null&&(s.disabled===void 0||!s.disabled)&&(I={color:s.iconColor}),C=u.jsx(ae,{icon:y,style:I})}}var X=null,Q=!!o;s.actions&&(X=u.jsx(ae,{icon:kl}));var z=null;if(s.menuElement)z=u.jsx("div",{className:"custom-menu-item",onMouseMove:v,children:b(s.menuElement,C,w)});else{var j,N=s.disabled,G=s.iconOutline;z=u.jsx("button",{type:"button",className:R("btn-context-menu",{disabled:N},{active:(Q||m)&&(N===void 0||!N)},{"keyboard-active":c&&(N===void 0||!N)}),onClick:f,onMouseMove:v,onContextMenu:g,title:(j=s.description)!==null&&j!==void 0?j:"",children:u.jsxs("div",{className:"btn-context-menu-wrapper",children:[u.jsx("span",{className:R("icon",{outline:G}),children:C}),u.jsx("span",{className:"title",children:s.title}),w!==void 0&&u.jsx("span",{className:"shortcut",children:w}),X&&u.jsx("span",{className:R("submenu-indicator",{disabled:N}),children:X})]})})}return u.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":p,children:[o,z]})});na.displayName="ContextMenuItem";var ra=O.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o=!1,inputClassName:s,isInvalid:a=!1,labelClassName:l,name:d,onChange:c,"data-testid":m}=n,[p]=h.useState(ft()),f=Xs(e);h.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var v=h.useCallback(g=>{f.current&&(f.current.indeterminate=t===null),c&&c(g)},[f,t,c]);return u.jsxs("div",{className:R("custom-control custom-checkbox",i),children:[u.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:R("custom-control-input",s,{"is-invalid":a}),disabled:o,id:p,name:d,onChange:v,"data-testid":m}),u.jsx("label",{className:R("custom-control-label",l),htmlFor:p,children:r})]})});ra.displayName="Checkbox";function tr(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function ia(n){return tr(n)&&ia(n.WrappedComponent)?!0:n.prototype!=null&&n.prototype.isReactComponent!=null}function ic(n){return!tr(n)&&"$$typeof"in n&&n.$$typeof===pd.ForwardRef}function oa(n){return ia(n)||ic(n)}var oc=["copy","tooltip","children"];function Wi(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 zi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wi(Object(t),!0).forEach(function(r){sc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function sc(n,e,t){return(e=ac(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ac(n){var e=lc(n,"string");return typeof e=="symbol"?e:e+""}function lc(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 dc(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 Vi="Copy";function sa(n){var{copy:e,tooltip:t=Vi,children:r}=n,i=dc(n,oc),[o,s]=yu(),a=o?"Copied":t;return u.jsxs(fd,zi(zi({},i),{},{"aria-label":a,onPress:()=>{s(typeof e=="function"?e():e)},children:[u.jsx(vd,{UNSAFE_className:r==null?"action-button-icon-with-tooltip":void 0,children:u.jsx(ae,{icon:o?Nl:Ll})}),r!=null&&u.jsx(Ys,{children:r}),(r==null||a!==Vi)&&u.jsx(ie,{children:a})]}))}sa.displayName="CopyButton";function Gi(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 cc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gi(Object(t),!0).forEach(function(r){_n(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Gi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _n(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=mc(n,"string");return typeof e=="symbol"?e:e+""}function mc(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 aa extends h.PureComponent{constructor(e){var t;super(e),_n(this,"container",void 0),_n(this,"oldFocus",void 0),_n(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=O.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=ce.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:ce.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=ce.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=ce.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,s=0;s<i.length;s+=1){var a=i[s];s>0&&a.group!==i[s-1].group&&e.push(u.jsx("hr",{},"".concat(s,".separator")));var l=u.jsx(na,{isKeyboardSelected:r===s,isMouseSelected:o===s,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},s);e.push(l)}var{menuStyle:d}=this.props;return u.jsx("div",{className:"context-menu-container",style:cc({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}_n(aa,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function qi(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 Xi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qi(Object(t),!0).forEach(function(r){nn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nn(n,e,t){return(e=pc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pc(n){var e=fc(n,"string");return typeof e=="symbol"?e:e+""}function fc(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 hr extends h.PureComponent{constructor(e){super(e),nn(this,"container",void 0),nn(this,"parent",void 0),nn(this,"popper",void 0),nn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=O.createRef(),this.parent=null,this.popper=O.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:s,popperOptions:a}=this.props;return a=Xi({placement:"bottom"},a),s=Xi({separateKeyboardMouse:!0},s),u.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:u.jsx(cr,{ref:this.popper,options:a,className:R("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:u.jsx(aa,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:s,menuStyle:o})})})}}nn(hr,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Tt(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=gc(n,"string");return typeof e=="symbol"?e:e+""}function gc(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 Zi=A.module("Shortcut"),_=function(n){return n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n}({}),S=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}({}),bc=new Set([S.ENTER,S.DELETE,S.F1,S.F2,S.F3,S.F4,S.F5,S.F6,S.F7,S.F8,S.F9,S.F10,S.F11,S.F12]);class de extends Fs{static isAllowedKey(e){return Object.values(S).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!de.isMacPlatform&&e.metaKey||!de.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||bc.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 _.CTRL:t.ctrlKey=!0;break;case _.ALT:case _.OPTION:t.altKey=!0;break;case _.CMD:t.metaKey=!0;break;case _.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="":!de.isAllowedKey(t)&&de.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===S.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 S.ENTER:t+="⏎";break;case S.ESCAPE:t+="⎋";break;case S.BACKSPACE:t+="⌫";break;case S.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?"":de.isMacPlatform?de.getMacDisplayText(e):de.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:s,tooltip:a}=e;super(),Tt(this,"id",void 0),Tt(this,"name",void 0),Tt(this,"tooltip",void 0),Tt(this,"isEditable",void 0),Tt(this,"defaultKeyState",void 0),Tt(this,"keyState",void 0),this.id=t,this.name=s,this.tooltip=a,this.isEditable=o;var l=de.isMacPlatform,d=l?i:r;this.defaultKeyState=de.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return de.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){de.isValidKeyState(e)?(Zi.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Gs("onUpdate",{detail:this}))):Zi.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return de.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(de.NULL_KEY_STATE)}isNull(){return de.doKeyStatesMatch(this.keyState,de.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return de.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(de.getKeyStateFromEvent(e))}}Tt(de,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Tt(de,"isMacPlatform",ce.isMacPlatform());function Yi(n,e,t){return(e=yc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yc(n){var e=Cc(n,"string");return typeof e=="symbol"?e:e+""}function Cc(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 Ji=A.module("ShortcutRegistry");class wc extends Fs{constructor(){super(...arguments),Yi(this,"shortcutMap",new Map),Yi(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new de(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return Ji.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;Ji.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:s}=o;return this.dispatchEvent(new Gs("onUpdate",{detail:s}))});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 re=Object.freeze(new wc),rn={COPY:re.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[_.CTRL,S.C],macShortcut:[_.CMD,S.C],isEditable:!1}),PASTE:re.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[_.CTRL,S.V],macShortcut:[_.CMD,S.V],isEditable:!1}),SAVE:re.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[_.CTRL,S.S],macShortcut:[_.CMD,S.S],isEditable:!1}),SELECT_ALL:re.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[_.CTRL,S.A],macShortcut:[_.CMD,S.A],isEditable:!1}),REOPEN_CLOSED_PANEL:re.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[_.ALT,_.SHIFT,S.T],macShortcut:[_.OPTION,_.SHIFT,S.T],isEditable:!0}),LINKER:re.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[_.CTRL,S.L],macShortcut:[_.CMD,S.L]}),LINKER_CLOSE:re.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[S.ESCAPE],macShortcut:[S.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:re.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[_.CTRL,_.ALT,S.I],macShortcut:[_.CMD,_.SHIFT,S.I],isEditable:!0}),EXPORT_LOGS:re.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[_.CTRL,_.ALT,_.SHIFT,S.L],macShortcut:[_.CMD,_.OPTION,_.SHIFT,S.L],isEditable:!0}),OPEN_DASHBOARD_LIST:re.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[_.CTRL,_.SHIFT,S.D],macShortcut:[_.CMD,_.SHIFT,S.D],isEditable:!0}),NEXT:re.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[S.ENTER],macShortcut:[S.ENTER],isEditable:!1}),PREVIOUS:re.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[_.SHIFT,S.ENTER],macShortcut:[_.SHIFT,S.ENTER],isEditable:!1}),UNDO:re.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[_.CTRL,S.Z],macShortcut:[_.CMD,S.Z],isEditable:!1}),REDO:re.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[_.CTRL,_.SHIFT,S.Z],macShortcut:[_.CMD,_.SHIFT,S.Z],isEditable:!1})};function Kr(n,e,t){return(e=Sc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sc(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 mr extends h.PureComponent{constructor(e){super(e),Kr(this,"inputField",void 0),Kr(this,"searchChangeSelection",void 0),this.inputField=O.createRef(),this.searchChangeSelection=O.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:s,disabled:a,matchCount:l,id:d,onKeyDown:c,"data-testid":m,cursor:p}=this.props,f,v=[{action:()=>p==null?void 0:p.next("forward"),shortcut:rn.NEXT},{action:()=>p==null?void 0:p.next("back"),shortcut:rn.PREVIOUS}];return p&&l>1?f=u.jsxs(u.Fragment,{children:[u.jsx(ne,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{p.next("back")},icon:Ds,tooltip:"Previous match (".concat(rn.PREVIOUS.getDisplayText(),")")}),u.jsxs("span",{className:"search-change-text",children:[p.index!==void 0&&"".concat(p.index+1," of "),l]}),u.jsx(ne,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{p.next("forward")},icon:Al,tooltip:"Next match (".concat(rn.NEXT.getDisplayText(),")")})]}):f=l>0&&u.jsx("span",{className:"search-match",children:l}),u.jsxs("div",{className:R("search-group",s),children:[u.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:c,className:"form-control",disabled:a,placeholder:t,ref:this.inputField,id:d,"data-testid":m}),l!=null?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),u.jsx(oe,{actions:v})]}):u.jsxs("span",{className:"search-end-content",children:[(r??"")!==""&&e===""&&u.jsx("span",{className:"search-end-placeholder",children:r}),u.jsx(ae,{icon:Rl})]})]})}}Kr(mr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function la(n,e,t){return(e=Ec(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ec(n){var e=Pc(n,"string");return typeof e=="symbol"?e:e+""}function Pc(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 da extends h.PureComponent{constructor(e){super(e),la(this,"searchInput",void 0),this.searchInput=O.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=xn(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:s}=this.state;return u.jsx(mr,{value:s,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}la(da,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function ua(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=Oc(n,"string");return typeof e=="symbol"?e:e+""}function Oc(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 xc=A.module("ItemListItem");class pr extends h.Component{static handleKeyDown(){return xc.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),ua(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=O.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":s}=this.props;return u.jsx("div",{className:R("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:pr.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":s,children:o})}}ua(pr,"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 Jn;function Qi(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 eo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qi(Object(t),!0).forEach(function(r){qe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function qe(n,e,t){return(e=Ic(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ic(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 to=A.module("ItemList"),no=5;class tt extends h.PureComponent{static renderItem(e){var t,r,{item:i}=e;return u.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),qe(this,"list",void 0),qe(this,"listContainer",void 0),qe(this,"getItemSelected",en((i,o)=>Je.isSelected(o,i),{max:tt.CACHE_SIZE})),qe(this,"getCachedItem",en((i,o,s,a,l,d,c,m)=>{var p=d({item:s,itemIndex:i,isFocused:a,isSelected:l,style:c});return u.jsx(pr,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:m,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:a,isSelected:l,itemIndex:i,style:c,children:p},o)},{max:tt.CACHE_SIZE})),qe(this,"getOuterElement",en(i=>{var o=O.forwardRef((s,a)=>u.jsx("div",eo({ref:a,tabIndex:-1,onKeyDown:i,role:"presentation"},s)));return o.displayName="ItemListOuterElement",o},{max:1e3})),qe(this,"getInnerElement",en(()=>{var i=O.forwardRef((o,s)=>u.jsx("div",eo({className:"item-list-inner-element",ref:s},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),qe(this,"getItemData",en((i,o,s)=>({items:i,selectedRanges:o,renderItem:s}),{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=O.createRef(),this.listContainer=O.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:s,scrollOffset:a,height:l,selectedRanges:d}=this.state;if(s&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(a!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==d)this.setSelectedRanges(r);else if(d!==t.selectedRanges){var{onSelectionChange:c}=this.props;c(d)}if(o!==t.focusIndex){var{onFocusChange:m}=this.props;m(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=Je.isSelected(r,e),o=i||ce.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:s}=o;return{selectedRanges:Je.selectRange(s,[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){to.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){to.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:s,selectedRanges:a,mouseX:l,mouseY:d}=this.state;if(!(s==null||o)){var c=Math.abs(t.clientX-(l??0)),m=Math.abs(t.clientY-(d??0));c>no&&m>no&&this.setState({isDragging:!0}),(r||s===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,a)&&!ce.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(s,e),Math.max(s,e)])):this.toggleSelect(e,t.shiftKey,ce.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:s,isDragging:a}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(s===e&&!a){var l=t.shiftKey,d=ce.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,r),!i&&!l&&!d&&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,s=o;if(e.key==="Enter"||e.key===" "){!t&&s!=null&&this.setState({selectedRanges:[[s,s]]},()=>{s!=null&&i(s,e)});return}if(e.key==="ArrowUp")s!=null&&s>=0?s=Math.max(0,s-1):s=r-1;else if(e.key==="ArrowDown")s!=null&&s>=0?s=Math.min(s+1,r-1):s=0;else return;if(o!==s){e.stopPropagation(),e.preventDefault(),this.focusItem(s);var{selectedRanges:a}=this.state;if(e.shiftKey&&a.length>0){var l=a[a.length-1];this.selectRange([Math.min(s,l[0]),Math.max(s,l[1])])}else if(this.deselectAll(),s!==null)this.selectItem(s);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(s)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:s}=i,a=o&&this.isListAtBottom({scrollOffset:r,height:s});return{isStuckToBottom:a,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:s}=this.state;if(o&&t&&s.length>0){var a=s[s.length-1];this.selectRange([Math.min(a[0],e),Math.max(e,a[1])])}else o&&s.length===1&&s[0][0]===e&&s[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,s)?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){Je.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:Je.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){Je.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:Je.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),s=o+Math.ceil(t/i);r(o,s)}}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:s,disableSelect:a}=this.props,{focusIndex:l,selectedRanges:d}=this.state;if(t<o||t>=o+i.length)return null;var c=i[t-o];return this.getCachedItem(t,t,c,t===l&&!a,this.getItemSelected(t,d),s,r,a)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":s}=this.props,{selectedRanges:a,isStuckToBottom:l}=this.state;return u.jsx(gd,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:c,height:m}=d;return u.jsx(bd,{className:"item-list-scroll-pane",height:m,width:c,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,a,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":s,children:this.renderInnerElement})}})}}Jn=tt;qe(tt,"CACHE_SIZE",1e3);qe(tt,"DEFAULT_ROW_HEIGHT",20);qe(tt,"DEFAULT_OVERSCAN",10);qe(tt,"defaultProps",{offset:0,items:[],rowHeight:Jn.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Jn.DEFAULT_OVERSCAN,renderItem:Jn.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var Mc=A.module("ErrorBoundary");class jc extends h.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;Mc.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??u.jsx("div",{className:t,children:u.jsx(On,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function kc(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:s,"data-testid":a}=n;return u.jsx("button",{type:"button",className:R("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:s,disabled:o,"data-testid":a,children:u.jsx("div",{className:"handle"})})}var Nc=["children","className","isInvalid","onChange","data-testid"];function ro(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 io(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ro(Object(t),!0).forEach(function(r){Lc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ro(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lc(n,e,t){return(e=Ac(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ac(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)}function Fc(n,e){if(n==null)return{};var t,r,i=$c(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 $c(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 ca=O.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":s}=n,a=Fc(n,Nc),l=Xs(e),d=h.useCallback(c=>{o(c.target.value)},[o]);return u.jsx("select",io(io({ref:l,className:R("custom-select",r,{"is-invalid":i}),onChange:d,"data-testid":s},a),{},{children:t}))});ca.displayName="Select";var si=O.createContext(new Map);si.displayName="XComponentMapContext";var pb=si.Provider;function Hc(n){var e,t=h.useContext(si);return(e=t.get(n))!==null&&e!==void 0?e:n.Original}function oo(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?oo(Object(t),!0).forEach(function(r){Uc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Uc(n,e,t){return(e=Bc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bc(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)}function ha(n){var e,t;function r(i,o){var s=Hc(t);return oa(n)?u.jsx(s,Or(Or({},i),{},{ref:o})):u.jsx(s,Or({},i))}return r.displayName="XComponent(".concat((e=n.displayName)!==null&&e!==void 0?e:n.name,")"),t=h.forwardRef(r),t.Original=n,t.isXComponent=!0,t}function Wc(){return Mn(Fl,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function ma(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function pa(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function fb(n){return ma(n)||pa(n)}var fa=h.createContext(null);fa.displayName="ObjectFetcherContext";function vb(n){if(pa(n))return{id:n.id,type:n.type};if(ma(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function zc(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 gb(){return Mn(fa,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var Vc=Object.freeze({}),Gc=new Map,bb=n=>n.api,yb=n=>n.user,va=n=>n.storage,ga=n=>va(n).commandHistoryStorage,qc=n=>va(n).fileStorage,Xc=n=>n.defaultWorkspaceSettings,ba=n=>{var{workspace:e}=n;return e},ai=yd(n=>{var e,t,r=(e=(t=ba(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=Xc(n),o=Cd({},i,r,(s,a)=>{if(Array.isArray(s)&&Array.isArray(a))return a});return o}),Zc=n=>ai(n).timeZone,Cb=n=>{var e;return(e=ai(n).notebookSettings)!==null&&e!==void 0?e:Vc},wb=n=>n.activeTool,Yc=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:Gc},Jc="SET_ACTIVE_TOOL",Qc="SET_API",Sb="SET_COMMAND_HISTORY_STORAGE",_b="SET_FILE_STORAGE",Eb="SET_PLUGINS",eh="SET_USER",th="SET_WORKSPACE",nh="SET_DEFAULT_WORKSPACE_SETTINGS",Pb="SET_WORKSPACE_STORAGE",rh="SET_SERVER_CONFIG_VALUES";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 ht(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){ih(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 ih(n,e,t){return(e=oh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oh(n){var e=sh(n,"string");return typeof e=="symbol"?e:e+""}function sh(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 Tb=n=>({type:eh,payload:n}),Ob=n=>({type:Qc,payload:n}),ya=n=>({type:th,payload:n}),xb=n=>({type:nh,payload:n}),ah=n=>(e,t)=>{e(ya(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i==null?void 0:i.save(n)},lh=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=ht(ht({},r),{},{data:ht(ht(ht({},i),n),{},{settings:ht(ht({},i==null?void 0:i.settings),n.settings)})});return e(ah(o))},Ib=n=>(e,t)=>{var{notebookSettings:r}=ai(t()),i=ht(ht({},r),n);return e(dh({notebookSettings:i}))},dh=n=>e=>e(lh({settings:n})),Db=n=>({type:Jc,payload:n}),Mb=n=>({type:rh,payload:n});function ao(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 lo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ao(Object(t),!0).forEach(function(r){uh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ao(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function uh(n,e,t){return(e=ch(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ch(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)}function mh(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:s}=i;return t&&Rr({payload:s},{payload:r[o]})?r:lo(lo({},r),{},{[o]:s})}default:return r}}}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 co(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){Wr(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 Wr(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=fh(n,"string");return typeof e=="symbol"?e:e+""}function fh(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 vh{constructor(){Wr(this,"reducers",{}),Wr(this,"listener",null)}register(e,t){var r;this.reducers=co(co({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var gh=new vh;function li(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=yh(n,"string");return typeof e=="symbol"?e:e+""}function yh(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 $e{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""}}li($e,"TYPE_GLOBAL","type-global");li($e,"TYPE_CONTEXT_PRESET","type-context-preset");li($e,"TYPE_CONTEXT_CUSTOM","type-context-custom");function Ot(n,e,t){return(e=Ch(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ch(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)}var ho=A.module("DateTimeColumnFormatter");class pt extends $e{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]:$e.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=pt.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=pt.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=pt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ot(this,"dh",void 0),Ot(this,"dhTimeZone",void 0),Ot(this,"defaultDateTimeFormatString",void 0),Ot(this,"showTimeZone",void 0),Ot(this,"showTSeparator",void 0),Ot(this,"formatStringMap",void 0);var s=t||pt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(s)}catch{ho.error("Unsupported time zone id",s),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(pt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=pt.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{ho.error("Invalid format arguments")}return""}}Ot(pt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Ot(pt,"DEFAULT_TIME_ZONE_ID","America/New_York");var bt;function nt(n,e,t){return(e=Sh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sh(n){var e=_h(n,"string");return typeof e=="symbol"?e:e+""}function _h(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 Eh=A.module("DecimalColumnFormatter");class ke extends $e{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]:$e.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 ke.makeFormat(e,t,$e.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 ke.makeFormat("Custom Format",e,$e.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=ke.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),nt(this,"defaultFormatString",void 0),nt(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{Eh.error("Invalid format arguments")}return""}}bt=ke;nt(ke,"DEFAULT_FORMAT_STRING","###,##0.0000");nt(ke,"FORMAT_PERCENT",bt.makePresetFormat("Percent","##0.00%"));nt(ke,"FORMAT_BASIS_POINTS",bt.makePresetFormat("Basis Points","###,##0 bp",1e4));nt(ke,"FORMAT_THOUSANDS",bt.makePresetFormat("Thousands","##0.000 k",.001));nt(ke,"FORMAT_MILLIONS",bt.makePresetFormat("Millions","###,##0.000 mm",1e-6));nt(ke,"FORMAT_SCIENTIFIC_NOTATION",bt.makePresetFormat("Scientific Notation","0.0000E0"));nt(ke,"FORMAT_ROUND",bt.makePresetFormat("Round","###,##0"));nt(ke,"FORMAT_ROUND_TWO_DECIMALS",bt.makePresetFormat("0.00","###,##0.00"));nt(ke,"FORMAT_ROUND_FOUR_DECIMALS",bt.makePresetFormat("0.0000","###,##0.0000"));var fr;function un(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)}var Oh=A.module("IntegerColumnFormatter");class vt extends $e{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]:$e.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 vt.makeFormat(e,t,$e.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 vt.makeFormat("Custom Format",e,$e.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=vt.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),un(this,"dh",void 0),un(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{Oh.error("Invalid format arguments")}return""}}fr=vt;un(vt,"DEFAULT_FORMAT_STRING","###,##0");un(vt,"FORMAT_THOUSANDS",fr.makePresetFormat("Thousands","##0.000 k",.001));un(vt,"FORMAT_MILLIONS",fr.makePresetFormat("Millions","###,##0.000 mm",1e-6));un(vt,"FORMAT_SCIENTIFIC_NOTATION",fr.makePresetFormat("Scientific Notation","0.0000E0"));function Gt(n,e,t){return(e=xh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xh(n){var e=Ih(n,"string");return typeof e=="symbol"?e:e+""}function Ih(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 B{}Gt(B,"INTEGER","int");Gt(B,"LONG","long");Gt(B,"DOUBLE","double");Gt(B,"BOOLEAN","bool");Gt(B,"STRING","string");Gt(B,"DATE_TIME","datetime");Gt(B,"LOCAL_TIME","localtime");var Ca=h.createContext(null);Ca.displayName="PluginsContext";var Nt=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 Dh(n){return"DashboardPlugin"in n}function Mh(n){return"AuthPlugin"in n}function jh(n){return"TablePlugin"in n}function kh(n){return Dh(n)||Mh(n)||jh(n)}function Nh(n){return"type"in n&&n.type===Nt.DASHBOARD_PLUGIN}function zr(n){return"type"in n&&n.type===Nt.MIDDLEWARE_PLUGIN}function vr(n){return"type"in n&&n.type===Nt.WIDGET_PLUGIN}function Lh(n){return"type"in n&&n.type===Nt.TABLE_PLUGIN}function Ah(n){return"type"in n&&n.type===Nt.AUTH_PLUGIN}function wa(n){return"type"in n&&n.type===Nt.THEME_PLUGIN}function Sa(n){return"type"in n&&n.type===Nt.ELEMENT_PLUGIN}function _a(n){return"type"in n&&n.type===Nt.MULTI_PLUGIN}function Vr(n){return Nh(n)||Ah(n)||Sa(n)||_a(n)||Lh(n)||wa(n)||vr(n)||zr(n)}var Rh=["metadata"],Fh=["metadata"];function mo(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 ot(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mo(Object(t),!0).forEach(function(r){$h(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $h(n,e,t){return(e=Hh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hh(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 Ea(n,e){if(n==null)return{};var t,r,i=Bh(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 Bh(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 Fe=A.module("@deephaven/plugin.PluginUtils");function an(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 po(n,e){return n==null||!vr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function Kh(n){var e=u.jsx(ae,{icon:Ms});if(!vr(n))return e;var{icon:t}=n;return t==null?e:h.isValidElement(t)?t:u.jsx(ae,{icon:t})}function jb(n){var e=[...n.entries()].filter(t=>wa(t[1]));return Fe.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(s=>{var{name:a,baseTheme:l,styleContent:d}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:$l(r,a),name:a,styleContent:d}})}).flat()}function kb(n){var e=[...n.entries()].filter(t=>Sa(t[1])&&t[1].mapping!=null);return Fe.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,r]=t;return Object.entries(r.mapping)}))}function Wh(n,e){return e.length===0?(Fe.debug("No middleware to chain for component",an(n)),n):(Fe.debug("Chaining component middleware",an(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function s(a){var{metadata:l}=a,d=Ea(a,Rh);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?u.jsx(t,ot(ot({},d),{},{metadata:l})):u.jsx(i,ot(ot({},d),{},{metadata:l,Component:t}))}return s.displayName="".concat(r.name,"(").concat(an(t),")"),s},n))}function Nb(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(Fe.debug("No panel middleware to chain for panel component",an(n)),n):(Fe.debug("Chaining panel middleware",an(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var{panelComponent:o}=i,s=[i.supportedTypes].flat();function a(l){var{metadata:d}=l,c=Ea(l,Fh);return(d==null?void 0:d.type)!=null&&!s.includes(d.type)?u.jsx(r,ot(ot({},c),{},{metadata:d})):u.jsx(o,ot(ot({},c),{},{metadata:d,Component:r}))}return a.displayName="".concat(i.name,"Panel(").concat(an(r,"Panel"),")"),a},n))}function zh(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function Vh(n){return Vr(n)?n:zh(n)&&Vr(n.default)?n.default:kh(n)?n:null}function fo(n,e,t,r){if(n.has(e)){Fe.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,ot(ot({},t),{},{version:r}))}function Lb(n,e,t,r,i,o){i!=null&&(e[i]=t,Fe.debug("Registered plugin '".concat(i,"' in module resolve map")));var s=Vh(t);if(s==null){Fe.error("Plugin '".concat(r,"' is missing an exported value."));return}_a(s)?(Fe.debug("MultiPlugin '".concat(r,"' contains ").concat(s.plugins.length," plugins")),s.plugins.forEach(a=>{if(!Vr(a)){Fe.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),a);return}var l=typeof a.name=="string"?a.name.trim():"";if(l.length===0){Fe.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),a);return}fo(n,l,a,o)})):fo(n,r,s,o)}function Ab(n){var e=new Map;n.forEach((m,p)=>{m.package!=null&&e.set(m.package,p)});var t=new Map;if(n.forEach((m,p)=>{if(m.dependencies!=null&&m.dependencies.length>0){var f=[];m.dependencies.forEach(v=>{var g=e.get(v);g!=null?f.push(g):Fe.warn("Plugin '".concat(m.name,"' depends on '").concat(v,"' which is not in the manifest"))}),f.length>0&&t.set(p,f)}}),t.size===0)return[...n];var r=new Array(n.length).fill(0),i=new Map;t.forEach((m,p)=>{m.forEach(f=>{i.has(f)||i.set(f,[]);var v=i.get(f);v!=null&&v.push(p),r[p]+=1})});for(var o=[],s=0;s<n.length;s+=1)r[s]===0&&o.push(s);for(var a=[];o.length>0;){var l=o.shift();if(l==null)break;a.push(n[l]);var d=i.get(l);d!=null&&(d.sort((m,p)=>m-p),d.forEach(m=>{r[m]-=1,r[m]===0&&o.push(m)}))}if(a.length!==n.length){var c=n.filter((m,p)=>r[p]>0).map(m=>m.name);throw new Error("Circular plugin dependency detected among: ".concat(c.join(", ")))}return a}function Gh(){return Mn(Ca,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var vo=A.module("@deephaven/plugin.WidgetView");function Rb(n){var{fetch:e,type:t}=n,r=Gh(),{basePlugin:i,middleware:o}=h.useMemo(()=>{var a,l=[];return r.forEach(d=>{if(!(!vr(d)&&!zr(d))){var c=[d.supportedTypes].flat().includes(t);c&&(zr(d)?l.push(d):(a!=null&&vo.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(a.name," with ").concat(d.name)),a=d))}}),{basePlugin:a,middleware:l}},[r,t]),s=h.useMemo(()=>i==null?(vo.debug("No base plugin found for widget type ".concat(t)),null):Wh(i.component,o),[i,o,t]);if(s!=null)return u.jsx(s,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}var Pa=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 Ta(n){return n.componentName!==void 0}function qh(n){return n.component!==void 0}var Oa=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Xh=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Pa,isGLComponentConfig:Ta,isReactComponentConfig:qh,itemDefaultConfig:Oa},Symbol.toStringTag,{value:"Module"}));function Qn(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=Yh(n,"string");return typeof e=="symbol"?e:e+""}function Yh(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 Ie{constructor(){Qn(this,"_mSubscriptions",void 0),Qn(this,"off",this.unbind),Qn(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ie.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 s=0;s<t.length;s++){var a=t[s].ctx||{};try{t[s].fn.apply(a,i)}catch(m){console.error("Error while emitting event:",m)}}i.unshift(e);for(var l=this._mSubscriptions[Ie.ALL_EVENT],d=0;d<l.length;d++){var c=l[d].ctx||{};try{l[d].fn.apply(c,i)}catch(m){console.error("Error while emitting event to allEventSubs:",m)}}}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)}}Qn(Ie,"ALL_EVENT","__all");function Ze(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=Qh(n,"string");return typeof e=="symbol"?e:e+""}function Qh(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 Gr extends Ie{constructor(e,t,r){super(),Ze(this,"width",void 0),Ze(this,"height",void 0),Ze(this,"title",void 0),Ze(this,"parent",void 0),Ze(this,"layoutManager",void 0),Ze(this,"tab",void 0),Ze(this,"_config",void 0),Ze(this,"isHidden",!1),Ze(this,"beforeCloseHandler",void 0),Ze(this,"_element",T(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Ze(this,"_contentElement",void 0),this.title=Ta(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,s=this.parent,a=null;s&&!s.isColumn&&!s.isRow;){var l;if(a=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!a)return!1;for(var d=s.isColumn?"height":"width",c=d==="height"?t:e,m=((r=this[d])!==null&&r!==void 0?r:0)*(1/(((i=a.config[d])!==null&&i!==void 0?i:0)/100)),p=c/m*100,f=(((o=a.config[d])!==null&&o!==void 0?o:0)-p)/(s.contentItems.length-1),v=0;v<s.contentItems.length;v++)if(s.contentItems[v]===a)s.contentItems[v].config[d]=p;else{var g;s.contentItems[v].config[d]=((g=s.contentItems[v].config[d])!==null&&g!==void 0?g:0)+f}return s.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 em=Object.freeze(Object.defineProperty({__proto__:null,Container:Gr,ItemContainer:Gr},Symbol.toStringTag,{value:"Module"}));function xa(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Ia(n){if(window.location.hash)return xa(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 di(n){return window.requestAnimationFrame(n)}function tm(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 nr(){return ft()}function nm(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 ui(n){return T.trim(n.replace(/(<([^>]+)>)/gi,""))}function De(n,e,t){return(e=rm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rm(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)}class jn extends Ie{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),De(this,"_eElement",void 0),De(this,"_oDocument",void 0),De(this,"_eBody",void 0),De(this,"_root",void 0),De(this,"_destroyAfterMouseUp",void 0),De(this,"_nDelay",400),De(this,"_timeout",void 0),De(this,"timeout",void 0),De(this,"_nDistance",10),De(this,"_nX",0),De(this,"_nY",0),De(this,"_nOriginalX",0),De(this,"_nOriginalY",0),De(this,"_bDragging",!1),this._eElement=e,this._oDocument=T(document),this._eBody=T(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,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=s.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,s;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"),(s=this._root)===null||s===void 0||s.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var a;(a=this._eElement)===null||a===void 0||a.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 Zt(n,e,t){return(e=om(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function om(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)}class Da{constructor(e,t){Zt(this,"_container",void 0),Zt(this,"_reactComponent",null),Zt(this,"_portalComponent",null),Zt(this,"_originalComponentWillUpdate",void 0),Zt(this,"_initialState",void 0),Zt(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=ii.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 h.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=T.extend(e,this._container._config.props);return O.createElement(this._reactClass,t)}}var rr=["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"],am=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ci(n){if(rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return hi(n,e,"_min"),e}function qr(n){if(rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return hi(n,e,"_max"),e}function hi(n,e,t){var r=t==="_min"?lm:dm;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 s=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=s;else{var a=r(i,rr);e[a]=s}hi(o,s,t)}else{var l=r(o,am);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=r(i,rr);e[d]=l}}}}function lm(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function dm(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function xr(n,e,t){return(e=um(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function um(n){var e=cm(n,"string");return typeof e=="symbol"?e:e+""}function cm(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 Xr{constructor(e,t){xr(this,"name",void 0),xr(this,"origin",void 0),xr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Un(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)}let Ma=class extends Ie{constructor(e){super(),Un(this,"_layoutManager",void 0),Un(this,"_dontPropagateToParent",void 0),Un(this,"_childEventSource",void 0),Un(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ie.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),T(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(){T(window).off("gl_child_event",this._boundOnEventFromChild)}};function ja(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function ka(n){return(e,t)=>ja(e,n,t)}function Na(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 La(n){return(e,t)=>{var r=h.useRef(null),i=h.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,h.useEffect(()=>()=>{var s;return(s=r.current)===null||s===void 0?void 0:s.off(n,i.current)},[])}}function lt(n){return{listen:ka(n),emit:Na(n),useListener:La(n)}}const pm=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Xr,DragListener:jn,EventEmitter:Ie,EventHub:Ma,ReactComponentHandler:Da,animFrame:di,filterXss:nm,getHashValue:xa,getQueryStringParam:Ia,getUniqueId:nr,listenForEvent:ja,makeEmitFunction:Na,makeEventFunctions:lt,makeListenFunction:ka,makeUseListenerFunction:La,minifyConfig:ci,removeFromArray:tm,stripTags:ui,unminifyConfig:qr},Symbol.toStringTag,{value:"Module"}));function _t(n,e,t){return(e=fm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fm(n){var e=vm(n,"string");return typeof e=="symbol"?e:e+""}function vm(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 Aa extends Ie{constructor(e,t,r,i,o){super(),_t(this,"isInitialised",!1),_t(this,"_config",void 0),_t(this,"_dimensions",void 0),_t(this,"_parentId",void 0),_t(this,"_indexInParent",void 0),_t(this,"_layoutManager",void 0),_t(this,"_popoutWindow",null),_t(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,s,a,l,d,c,m;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:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&r!==void 0?r:0,top:(a=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&a!==void 0?a:0},content:(m=this.getGlInstance())===null||m===void 0?void 0:m.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=T.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;T(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__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-"+nr();e=ci(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 pe(n,e,t){return(e=gm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gm(n){var e=bm(n,"string");return typeof e=="symbol"?e:e+""}function bm(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 qt extends Ie{constructor(e,t,r,i,o,s){var a,l,d,c,m,p,f,v;if(super(),pe(this,"_dragListener",void 0),pe(this,"_layoutManager",void 0),pe(this,"_contentItem",void 0),pe(this,"_originalParent",void 0),pe(this,"_area",null),pe(this,"_lastValidArea",null),pe(this,"_minX",void 0),pe(this,"_maxX",void 0),pe(this,"_minY",void 0),pe(this,"_maxY",void 0),pe(this,"_width",void 0),pe(this,"_height",void 0),pe(this,"_sided",void 0),pe(this,"element",void 0),pe(this,"childElementContainer",void 0),pe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var 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=T(qt._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",ui((a=this._contentItem.config.title)!==null&&a!==void 0?a:"")),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(),T(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,C;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((C=this._proxyTab.outerHeight(!0))!==null&&C!==void 0?C:0)}var y=this._layoutManager.container.offset();this._minX=(d=y==null?void 0:y.left)!==null&&d!==void 0?d:0,this._minY=(c=y==null?void 0:y.top)!==null&&c!==void 0?c:0,this._maxX=((m=this._layoutManager.container.width())!==null&&m!==void 0?m:0)+this._minX,this._maxY=((p=this._layoutManager.container.height())!==null&&p!==void 0?p:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(v=this.element.height())!==null&&v!==void 0?v:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,s=(i=r.pageX)!==null&&i!==void 0?i:0,a=(o=r.pageY)!==null&&o!==void 0?o:0,l=s>this._minX&&s<this._maxX&&a>this._minY&&a<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,a)}_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")}}pe(qt,"_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 Bn(n,e,t){return(e=ym(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ym(n){var e=Cm(n,"string");return typeof e=="symbol"?e:e+""}function Cm(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 Ra{constructor(e,t,r){Bn(this,"_element",void 0),Bn(this,"_itemConfig",void 0),Bn(this,"_layoutManager",void 0),Bn(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new jn(this._element,this._layoutManager.root,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(T.extend(!0,{},r));new qt(e,t,this._dragListener,this._layoutManager,i,null)}}function Kn(n,e,t){return(e=wm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wm(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)}class Fa{constructor(e,t,r){Kn(this,"_element",T(window)),Kn(this,"_itemConfig",void 0),Kn(this,"_layoutManager",void 0),Kn(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 jn(this._element,this._layoutManager.root,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(T.extend(!0,{},r));new qt(e,t,this._dragListener,this._layoutManager,i,null)}}}function $a(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=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)}class kn{constructor(){$a(this,"element",T(kn._template)),T(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()}}$a(kn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Ir(n,e,t){return(e=Pm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pm(n){var e=Tm(n,"string");return typeof e=="symbol"?e:e+""}function Tm(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 yn{constructor(e,t,r,i){Ir(this,"element",void 0),Ir(this,"_header",void 0),Ir(this,"_action",void 0),this._header=e,this.element=T('<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 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)}class Bt extends Error{constructor(e,t){super(),Om(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Dm=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Bt},Symbol.toStringTag,{value:"Module"}));function me(n,e,t){return(e=Mm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mm(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)}function Wt(n){return n.isStack}function _e(n){return n.isComponent}function Ha(n){return n.isRoot}class ve extends Ie{constructor(e,t,r,i){super(),me(this,"config",void 0),me(this,"type",void 0),me(this,"contentItems",void 0),me(this,"parent",void 0),me(this,"layoutManager",void 0),me(this,"element",void 0),me(this,"childElementContainer",void 0),me(this,"componentName",void 0),me(this,"isInitialised",!1),me(this,"isMaximised",!1),me(this,"isRoot",!1),me(this,"isRow",!1),me(this,"isColumn",!1),me(this,"isStack",!1),me(this,"isComponent",!1),me(this,"tab",void 0),me(this,"_pendingEventPropagations",void 0),me(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(Ie.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,Wt(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 s=0;s<o.contentItems.length;s++)e(o.contentItems[s])===!0&&t.push(o.contentItems[s]),r(o.contentItems[s])};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&&_e(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},s=(r=e.width())!==null&&r!==void 0?r:0,a=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+s,y2:o.top+a,surface:s*a,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 Xr(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Bt("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(Oa)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof Xr&&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,di(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function gn(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=Nm(n,"string");return typeof e=="symbol"?e:e+""}function Nm(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 Ua extends ve{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(a=>{var[l,d]=a;t[l]===void 0&&(t[l]=d)}),super(e,t,r,T()),gn(this,"config",void 0),gn(this,"componentName",void 0),gn(this,"container",void 0),gn(this,"parent",void 0),gn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),s=T.extend(!0,{},this.config.componentState||{});if(o==null)throw new Bt('Unknown component "'+this.config.componentName+'"');s.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Gr(this.config,this,e),this.instance=new o(this.container,s),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(){ve.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),ve.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),ve.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),ve.prototype._$destroy.call(this)}_$getArea(){return null}}function Be(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 Pn extends ve{constructor(e,t,r,i){super(t,r,i,T('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),Be(this,"isRow",void 0),Be(this,"isColumn",void 0),Be(this,"childElementContainer",void 0),Be(this,"parent",void 0),Be(this,"_splitter",[]),Be(this,"_splitterSize",void 0),Be(this,"_splitterGrabSize",void 0),Be(this,"_isColumn",void 0),Be(this,"_dimension",void 0),Be(this,"_splitterPosition",null),Be(this,"_splitterMinPosition",null),Be(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,s,a;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(a),a.after(e.element)):(this.contentItems[0].element.before(a),a.before(e.element))):this.childElementContainer.append(e.element),ve.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[s].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),s=Math.max(o-1,0),a,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),a=0;a<this.contentItems.length;a++)if(this.contentItems[a]!==e){var d;this.contentItems[a].config[this._dimension]=((d=this.contentItems[a].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}if(ve.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(ve.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,s=0,a=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var d,c,m=this._isColumn?Math.floor(o*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));s+=m,a.push(m)}var p=Math.floor((this._isColumn?o:i)-s);return{itemSizes:a,additionalPixel:p,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 s=0;s<t.length;s++)t[s].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var a=0;a<t.length;a++)t[a].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[r]=((d=this.contentItems[l].config[r])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,s=0,a=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var m=d.itemSizes[c];m<t?(o+=t-m,l={width:t}):(i+=m-t,l={width:m},r.push(l)),a.push(l)}if(!(o===0||o>i)){var p=o/i;s=o;for(var f=0;f<r.length;f++){l=r[f];var v=Math.round((l.width-t)*p);s-=v,l.width-=v}s!==0&&(a[a.length-1].width-=s);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=a[g].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new Ba(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,s;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((s=e[i].minHeight)!==null&&s!==void 0?s:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,s=this._getItemsForSplitter(e),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,c=this._getMinimumDimensions((r=s.after.config.content)!==null&&r!==void 0?r:[]),m=this._isColumn?c.vertical:c.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=s.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||a)),this._splitterMaxPosition=((o=s.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(m||a)}_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,s,a=this._getItemsForSplitter(e),l=(t=a.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(r=a.after.element[this._dimension]())!==null&&r!==void 0?r:0,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),m=((o=a.before.config[this._dimension])!==null&&o!==void 0?o:0)+((s=a.after.config[this._dimension])!==null&&s!==void 0?s:0);a.before.config[this._dimension]=c*m,a.after.config[this._dimension]=(1-c)*m,e.element.css({top:0,left:0}),di(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function go(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 bo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?go(Object(t),!0).forEach(function(r){Zr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):go(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zr(n,e,t){return(e=Rm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rm(n){var e=Fm(n,"string");return typeof e=="symbol"?e:e+""}function Fm(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 Yr extends ve{constructor(e,t,r){super(e,bo(bo({},t),{},{type:"root"}),null,T('<div class="lm_goldenlayout lm_item lm_root"></div>')),Zr(this,"childElementContainer",void 0),Zr(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(_e(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",s=i==="left"||i==="right"?"width":"height",a=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Pn)||l.type!=o){var d=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,d),d.addChild(e,a?0:void 0,!0),d.addChild(l,a?void 0:0,!0),l.config[s]=50,e.config[s]=50,d.callDownwards("setSize")}else{var c,m=l.contentItems[a?0:l.contentItems.length-1];l.addChild(e,a?0:void 0,!0),m.config[s]=((c=m.config[s])!==null&&c!==void 0?c:0)*.5,e.config[s]=m.config[s],l.callDownwards("setSize")}}}}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 Yt(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){Le(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 Le(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)}class Jr extends ve{constructor(e,t,r){var i,o,s,a,l,d,c,m,p;super(e,t,r,T('<div class="lm_item lm_stack"></div>')),Le(this,"_activeContentItem",null),Le(this,"_header",void 0),Le(this,"childElementContainer",T('<div class="lm_items"></div>')),Le(this,"header",void 0),Le(this,"parent",void 0),Le(this,"isStack",!0),Le(this,"_dropSegment",null),Le(this,"_contentAreaDimensions",null),Le(this,"_dropIndex",void 0),Le(this,"_side",void 0),Le(this,"_sided",!1),Le(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?(s=f.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=f.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=f.settings)!==null&&d!==void 0&&d.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(m=(p=f.labels)===null||p===void 0?void 0:p.minimise)!==null&&m!==void 0?m:void 0},f.header&&(this._header=Yt(Yt({},this._header),f.header)),t.header&&(this._header=Yt(Yt({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Yt(Yt({},this._header),t.content[0].header)),this.header=new gt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,a=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?s:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:s);for(this.childElementContainer.width(a),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(a).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),_e(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(){ve.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 Pn&&(t&&this.parent.isColumn||r&&this.parent.isRow),s=t?"column":"row",a=t?"height":"width";if(_e(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var d,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+1,!0),this.config[a]=((d=this.config[a])!==null&&d!==void 0?d:0)*.5,e.config[a]=this.config[a],this.parent.callDownwards("setSize")}else{var m,p=this.layoutManager.createContentItem({type:s},this);(m=this.parent)===null||m===void 0||m.replaceChild(this,p),p.addChild(e,i?0:void 0,!0),p.addChild(this,i?void 0:0,!0),this.config[a]=50,e.config[a]=50,p.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,s,a,l,d,c,m,p,f,v,g,b,w,C=this.header.tabs.length;if(C===0){var y,I,X,Q,z,j,N,G,H=this.header.element.offset();(y=this.layoutManager.dropTargetIndicator)===null||y===void 0||y.highlightArea({x1:(I=H==null?void 0:H.left)!==null&&I!==void 0?I:0,x2:((X=H==null?void 0:H.left)!==null&&X!==void 0?X:0)+100,y1:(Q=(z=this.header.element.offset())===null||z===void 0?void 0:z.top)!==null&&Q!==void 0?Q:0,y2:((j=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&j!==void 0?j:0)+((G=this.header.element.innerHeight())!==null&&G!==void 0?G:0)});return}var M=this.header.tabsContainer,K=(t=M.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),W=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!K||!W)){e<K.left?e=K.left+1:e>K.right&&(e=K.right-1);var L,$;if(!(W.left<e&&e<W.right)){for(var U=0;U<C;U++){var he;if(L=this.header.tabs[U].element,$=(he=L.get(0))===null||he===void 0?void 0:he.getBoundingClientRect(),$&&$.left<e&&e<$.right){this._dropIndex=U;break}}if(L&&$&&e<$.left+$.width*.5)L.before(this.layoutManager.tabDropPlaceholder);else if(L){var Ue;this._dropIndex=Math.min(((Ue=this._dropIndex)!==null&&Ue!==void 0?Ue:0)+1,C),L.after(this.layoutManager.tabDropPlaceholder)}}var x=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;x=Math.max(x,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var q=x+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);q=Math.min(q,((d=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&d!==void 0?d:0)+((m=this.header.tabsContainer.innerWidth())!==null&&m!==void 0?m:0)),(p=this.layoutManager.dropTargetIndicator)===null||p===void 0||p.highlightArea({x1:x,x2:q,y1:(f=(v=this.header.element.offset())===null||v===void 0?void 0:v.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 Um=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:ve,Component:Ua,ContentItem:ve,Root:Yr,RowOrColumn:Pn,Stack:Jr,isComponent:_e,isRoot:Ha,isStack:Wt},Symbol.toStringTag,{value:"Module"}));function ct(n,e,t){return(e=Bm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bm(n){var e=Km(n,"string");return typeof e=="symbol"?e:e+""}function Km(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 Nn{constructor(e,t){var r;ct(this,"header",void 0),ct(this,"contentItem",void 0),ct(this,"element",T(Nn._template)),ct(this,"titleElement",void 0),ct(this,"closeElement",void 0),ct(this,"isActive",!1),ct(this,"_layoutManager",void 0),ct(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 jn(this.element,this._layoutManager.root),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.element.on("mouseup",this._onMouseUp),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),_e(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),_e(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 qt(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){_e(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(T(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){_e(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&&_e(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):_e(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),_e(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(),_e(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=T(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!_e(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}ct(Nn,"_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 Z(n,e,t){return(e=Wm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wm(n){var e=zm(n,"string");return typeof e=="symbol"?e:e+""}function zm(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 gt extends Ie{constructor(e,t){var r,i;super(),Z(this,"layoutManager",void 0),Z(this,"element",T(gt._template)),Z(this,"tabsContainer",void 0),Z(this,"tabDropdownContainer",void 0),Z(this,"tabDropdownSearch",void 0),Z(this,"tabDropdownList",null),Z(this,"controlsContainer",void 0),Z(this,"parent",void 0),Z(this,"tabs",[]),Z(this,"activeContentItem",null),Z(this,"closeButton",null),Z(this,"tabDropdownButton",null),Z(this,"tabNextButton",T(gt._nextButtonTemplate)),Z(this,"tabPreviousButton",T(gt._previousButtonTemplate)),Z(this,"holdTimer",null),Z(this,"rAF",null),Z(this,"CLICK_TIMEOUT",500),Z(this,"START_SPEED",.01),Z(this,"ACCELERATION",5e-4),Z(this,"PADDING",10),Z(this,"SCROLL_LEFT","left"),Z(this,"SCROLL_RIGHT","right"),Z(this,"isDraggingTab",!1),Z(this,"isOverflowing",!1),Z(this,"isDropdownShown",!1),Z(this,"dropdownKeyIndex",0),Z(this,"_lastVisibleTabIndex",-1),Z(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 Nn(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,s=0;s<this.tabs.length;s++)o=this.tabs[s].contentItem===e,this.tabs[s].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(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,s,a;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&o!==void 0?o:0)+((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var d,c;l.scrollLeft=(d=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.scrollWidth)!==null&&d!==void 0?d: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 s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,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,s=this.tabsContainer.get(0);if(s){var a=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(c=>{var m,p,f=o||c,v=c-f,g=this.START_SPEED*v+.5*this.ACCELERATION*(v*v);g=Math.min(g,(m=(p=this.tabsContainer.get(0))===null||p===void 0?void 0:p.scrollWidth)!==null&&m!==void 0?m: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(),T(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 yn(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 yn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new yn(this,s,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",a??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new yn(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"),T(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"),T(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(a,l,d){if(d==null||d.length<2)return-1;for(var c=(a+l+d.length)%d.length;c!==a;){if(d.eq(c).css("display")!=="none")return c;c=(c+l+d.length)%d.length}return a}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,s;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),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var 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(),T(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 s=this.tabDropdownContainer[0].getBoundingClientRect(),a=(r=T(window).height())!==null&&r!==void 0?r:0,l=(i=T(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<a-d.bottom,m=!c&&d.bottom>a*.6,p=Math.min(d.left+(m?d.width:0),l-s.width-this.PADDING),f=m?Math.max(d.top-o,this.PADDING):d.bottom,v=a-f-this.PADDING;this.tabDropdownContainer.css({"max-height":v,top:f,left:p})}}}}_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()}}}}Z(gt,"_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(""));Z(gt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));Z(gt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function bn(n,e,t){return(e=Vm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vm(n){var e=Gm(n,"string");return typeof e=="symbol"?e:e+""}function Gm(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 Ba{constructor(e,t,r){bn(this,"_isVertical",void 0),bn(this,"_size",void 0),bn(this,"_grabSize",void 0),bn(this,"_dragListener",void 0),bn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new jn(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=T('<div class="lm_drag_handle"></div>'),t=T('<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 qm=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Aa,DragProxy:qt,DragSource:Ra,DragSourceFromEvent:Fa,DropTargetIndicator:kn,Header:gt,HeaderButton:yn,Splitter:Ba,Tab:Nn},Symbol.toStringTag,{value:"Module"}));var Xm={config:Xh,container:em,controls:qm,errors:Dm,items:Um,utils:pm};function Co(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 Me(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(t),!0).forEach(function(r){Y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Co(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Y(n,e,t){return(e=Zm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zm(n){var e=Ym(n,"string");return typeof e=="symbol"?e:e+""}function Ym(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 wo=["column","row","stack","component"];class mi extends Ie{static isLayoutItemConfig(e){return wo.includes(e.type)}static minifyConfig(e){return ci(e)}static unminifyConfig(e){return qr(e)}constructor(e,t){super(),Y(this,"isInitialised",!1),Y(this,"_isFullPage",!1),Y(this,"_resizeTimeoutId",void 0),Y(this,"_components",{"lm-react-component":Da}),Y(this,"_fallbackComponent",void 0),Y(this,"_itemAreas",[]),Y(this,"_maximisedItem",null),Y(this,"_maximisePlaceholder",T('<div class="lm_maximise_place"></div>')),Y(this,"_creationTimeoutPassed",!1),Y(this,"_subWindowsCreated",!1),Y(this,"_dragSources",[]),Y(this,"_updatingColumnsResponsive",!1),Y(this,"_firstLoad",!0),Y(this,"_reactChildMap",new Map),Y(this,"_reactChildren",null),Y(this,"_initialHeaderHeight",void 0),Y(this,"width",null),Y(this,"height",null),Y(this,"root",void 0),Y(this,"openPopouts",[]),Y(this,"selectedItem",null),Y(this,"isSubWindow",!1),Y(this,"eventHub",new Ma(this)),Y(this,"config",void 0),Y(this,"container",void 0),Y(this,"_originalContainer",void 0),Y(this,"dropTargetIndicator",null),Y(this,"tabDropPlaceholder",T('<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&&T("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 ve))throw new Error("Root must be a ContentItem");var t={settings:Me({},this.config.settings),dimensions:Me({},this.config.dimensions),labels:Me({},this.config.labels),content:[]},r=function(s,a){for(var l in a.config)l!=="content"&&(s[l]=a.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),a.contentItems.length){s.content=[];for(var d=0;d<a.contentItems.length;d++)s.content[d]={},r(s.content[d],a.contentItems[d])}};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){T(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 kn,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,s;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),T(window).off("resize",this._onResize),T(window).off("unload beforeunload",this._onUnload),T(window).off("blur.lm").off("focus.lm"),T(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 Bt("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!mi.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+wo.join(","),new Bt(i);return e.type==="component"&&!(t instanceof Jr)&&t&&!(this.isSubWindow===!0&&t instanceof Yr)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:nr(),e.type==="stack"?new Jr(this,e,t):e.type==="row"?new Pn(!1,this,e,t):e.type==="column"?new Pn(!0,this,e,t):new Ua(this,e,t)}createPopout(e,t,r,i){var o=[],s=e instanceof ve,a=this;if(s){var l;o=this.toConfig(e).content,r=nr();for(var d=e.parent,c=e;((m=d)===null||m===void 0?void 0:m.contentItems.length)===1&&!d.isRoot;){var m;c=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var p;i=(p=d)===null||p===void 0?void 0:p.contentItems.indexOf(c)}}else e instanceof Array?o=e:o=[e];if(!t&&s){var f,v,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,C=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+C.left,top:w+C.top,width:(v=e.element.width())!==null&&v!==void 0?v:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!r||i===void 0)){var y=new Aa(o,t,r,i,this);return y.on("initialised",function(){a.emit("windowOpened",y)}),y.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(y),y}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Ra(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Fa(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 s=this._itemAreas[o];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&r>s.surface&&(r=s.surface,i=s)}return i}_$createRootItemAreas(){var e=50,t=Me({},this.root._$getArea()),r=[Me(Me({},t),{},{side:"left",x2:t.x1+e}),Me(Me({},t),{},{side:"right",x1:t.x2-e}),Me(Me({},t),{},{side:"top",y2:t.y1+e}),Me(Me({},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(Wt(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 s=Me(Me({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof ve)return e;if(T.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&&T(window).resize(this._onResize),T(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=Ia("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=qr(e),localStorage.removeItem(r));var i=T.extend(!0,{},Pa,e),o=function(a){for(var l in a){var d=a[l];l!=="props"&&typeof d=="object"&&d!=null?o(d):l==="type"&&d==="react-component"&&(a.type="component",a.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=T('<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=ui((e=this.config.content[0].title)!==null&&e!==void 0?e:""),T("head").append(T("body link, body style, template, .gl_keep")),this.container=T("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?T(this._originalContainer):T("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,T("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 Bt(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Bt(t,e);this.root=new Yr(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,s=this.root.contentItems[0],a=this._findAllStackContainers()[0],l=0;l<o;l++){var d=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(a,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(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=>{Wt(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}Y(mi,"__lm",Xm);const So={"tab-height":"28px","drag-border-width":"5px"},_o=Object.freeze({tabHeight:parseInt(So["tab-height"],10),dragBorderWidth:parseInt(So["drag-border-width"],10)});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 dt(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){Ka(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 Ka(n,e,t){return(e=Jm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jm(n){var e=Qm(n,"string");return typeof e=="symbol"?e:e+""}function Qm(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 Et=A.module("LayoutUtils");function Wa(n){return n.componentName!==void 0}function xt(n){var e=n;return(Wa(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Wn(n){return n.focus!==void 0}function Po(n){return n.type==="stack"}class P{static activateTab(e,t){var r=P.getStackForRoot(e,t,!1);if(!r){Et.error("Could not find stack for config",t);return}var i=P.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=P.getStackForRoot(e,t,!1);if(!r)return Et.error("Could not find stack for config",t),!1;var i=P.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(Ha(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 s=document.activeElement;e.contentItems[0].addChild(i),s&&s.focus!=null&&s.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var a=e.contentItems[e.contentItems.length-1],l=t?a.isRow:a.isColumn;if(!l){var d,c,m=e.layoutManager.createContentItem({type:t?"row":"column",height:(d=a.config)===null||d===void 0?void 0:d.height,width:(c=a.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(a,m),e.contentItems[e.contentItems.length-1].addChild(a),a=e.contentItems[e.contentItems.length-1]}return this.addStack(a,!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=P.getAllStackContainers(e),r=P.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&Wt(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(Wt(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 s=this.getStackById(e.contentItems[o],t,i);if(s)return s}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&&Wt(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&&Ti(o.config,t))return e;var s=this.getStackForConfig(o,t,r);if(s)return s}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,s=this.getStackForConfig(e,t);return!s&&i&&(s=this.getStackForConfig(e,{component:t.component},o)),!s&&r&&(s=this.addStack(e)),s}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,s=0;s<t.length;s+=1){var a=t[s],l=s===t.length-1,d=P.getStackForRoot(e,{component:a},r&&l,i,o);if(d)return d}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&&Ti(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:s}=o;if(xt(o)){var a=t(o.component,o);a!=null?r.push(a):Et.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(s){var l=dt(dt({},o),{},{content:P.dehydrateLayoutConfig(s,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?(Po(r)&&delete r.activeItemIndex,P.dropLayoutMinorChange(i)):xt(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=P.cloneLayout(e),o=P.cloneLayout(t);return r?(P.dropLayoutMinorChange(i),P.dropLayoutMinorChange(o),Rr(i,o)):Rr(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(xt(o)){var s,{component:a,props:l={}}=o;r.push(dt(dt({},o),{},{id:(s=o==null?void 0:o.id)!==null&&s!==void 0?s:ft(),props:t(a,l)}))}else if(o.content!==void 0){var d=P.hydrateLayoutConfig(o.content,t);Po(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(Et.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(dt(dt({},o),{},{content:d}))}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:s=!1,focusElement:a=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=document.activeElement,c=dt({},t);if(c.id==null&&(c.id=ft()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var m=o||{id:c.id,component:c.component};F(e);var p=r??(s?P.addStack(e):P.getStackForRoot(e,m));F(p);var f=P.getContentItemInStack(p,m);if(a!=null){var v=b=>{Et.debug("Component created, focusing element",a),p.off("componentCreated",v);var{element:w}=b.origin;requestAnimationFrame(()=>{P.focusElement(w[0],a)})};p.on("componentCreated",v)}if(i&&f){var g=p.contentItems.indexOf(f);p.addChild(c,g+1),p.removeChild(f),p.setActiveContentItem(p.contentItems[g])}else p.addChild(c);a==null&&d&&Wn(d)&&d.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},s=P.getContentItemInStack(e,o);if(r&&s&&e){var a=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,a+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[a])}else e==null||e.addChild(t);i&&Wn(i)&&i.focus()}static closeComponent(e,t,r){var i=P.getStackForRoot(e,t,!1,!1,!1);if(!i){Et.warn("Cannot find stack for component, ignoring close",t);return}var o=P.getContentItemInStack(i,t),s=document.activeElement;o&&(_e(o)?o.container.close(r):i.removeChild(o)),s&&document.contains(s)&&Wn(s)&&s.focus()}static renameComponent(e,t,r){var i=P.getStackForRoot(e,t,!1);if(!i){Et.error("Could not find stack for config",t);return}var o=P.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=P.getStackForRoot(e,t,!1);if(!r)return Et.error("Could not find stack for config",t),null;var{props:i={}}=t,o=P.getPanelComponentState(t),s={type:"react-component",component:t.component,props:dt(dt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:ft()};return P.openComponentInStack(r,s),s}static getPanelComponentState(e){if(Wa(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(xt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:_o.tabHeight,borderWidth:_o.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=P.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return P.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=P.getComponentConfigFromContainer(t);if(r&&xt(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]:P.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Wn(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)})}}Ka(P,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var ep=O.forwardRef((n,e)=>{var t=P.getComponentNameFromPanel({props:n});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});ep.displayName="PanelPlaceholder";var J=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:$b,emit:tp,useListener:Hb}=lt(J.OPEN),gr=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:np,emit:Ub,useListener:Bb}=lt(gr.CYCLE_TO_NEXT_STACK),{listen:rp,emit:Kb,useListener:Wb}=lt(gr.CYCLE_TO_PREVIOUS_STACK),{listen:ip,emit:zb,useListener:Vb}=lt(gr.CYCLE_TO_NEXT_TAB),{listen:op,emit:Gb,useListener:qb}=lt(gr.CYCLE_TO_PREVIOUS_TAB);function To(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?To(Object(t),!0).forEach(function(r){mt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):To(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mt(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=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)}var Ke=A.module("PanelManager"),$t=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}($t||{});class za{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(a,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(a,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};mt(this,"layout",void 0),mt(this,"hydrateComponent",void 0),mt(this,"dehydrateComponent",void 0),mt(this,"onPanelsUpdated",void 0),mt(this,"closed",void 0),mt(this,"openedMap",void 0),mt(this,"navigationEventListenerRemovers",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=s,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(J.FOCUS,this.handleFocus),e.on(J.MOUNT,this.handleMount),e.on(J.UNMOUNT,this.handleUnmount),e.on(J.REOPEN,this.handleReopen),e.on(J.REOPEN_LAST,this.handleReopenLast),e.on(J.DELETE,this.handleDeleted),e.on(J.CLOSED,this.handleClosed),e.on(J.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(np(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(rp(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(ip(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(op(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(J.FOCUS,this.handleFocus),e.off(J.MOUNT,this.handleMount),e.off(J.UNMOUNT,this.handleUnmount),e.off(J.REOPEN,this.handleReopen),e.off(J.REOPEN_LAST,this.handleReopenLast),e.off(J.DELETE,this.handleDeleted),e.off(J.CLOSED,this.handleClosed),e.off(J.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 P.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&xt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=P.getStackForConfig(this.layout.root,{id:e});return(t=r&&P.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=>tr(r)&&t instanceof r.WrappedComponent||!tr(r)&&t instanceof r))}updatePanel(e){var t=P.getIdFromPanel(e);if(t==null){Ke.error("updatePanel Panel did not have an ID",e);return}Ke.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=P.getIdFromPanel(e);if(t==null){Ke.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){Ke.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){Ke.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}Ke.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){Ke.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){Ke.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){Ke.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=P.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=P.getFocusedStackIndex(t);if(r===-1){var i=t[0],o=i.config.activeItemIndex,s=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(s,!0);return}var a=e===$t.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[a],d=l.config.activeItemIndex,c=d!=null?l.contentItems[d]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack($t.Next)}handleCycleToPreviousStack(){this.cycleStack($t.Previous)}cycleTab(e){var t,r=P.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,s=e===$t.Next?(o+1)%i.length:(o-1+i.length)%i.length,a=i[s];r.setActiveContentItem(a,!0)}}}handleCycleToNextTab(){this.cycleTab($t.Next)}handleCycleToPreviousTab(){this.cycleTab($t.Previous)}handleReopen(e,t){Ke.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=Oo(Oo({},e),{},{props:i}),{root:s}=this.layout,a=e.parentStackId===void 0?void 0:P.getStackById(s,e.parentStackId);P.openComponent({root:s,config:o,replaceConfig:t,stack:a??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=P.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){Ke.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){Ke.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;P.closeComponent(r,t)}addClosedPanel(e){var t=P.getComponentConfigFromContainer(e);if(t&&xt(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)})}}mt(za,"MAX_CLOSED_PANEL_COUNT",100);var lp=A.module("PanelErrorBoundary");class dp extends h.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=P.getIdFromContainer(e);lp.debug("componentWillUnmount",r),t.emit(J.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(On,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function xo(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 ir(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xo(Object(t),!0).forEach(function(r){up(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function up(n,e,t){return(e=cp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cp(n){var e=hp(n,"string");return typeof e=="symbol"?e:e+""}function hp(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 Va(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),ir(ir({},n),{},{componentState:null,props:o,type:"react-component"})}function Ga(n,e){return ir(ir({},n),{},{localDashboardId:e})}const Xb={dehydrate:Va,hydrate:Ga};var qa=O.createContext(void 0);qa.displayName="LayoutManagerContext";var mp=le.shape({on:le.func,off:le.func,isHidden:le.bool,tab:le.shape({header:le.shape({tabs:le.arrayOf(le.shape({contentItem:le.shape({})}))})}),title:le.string,setTitle:le.func,close:le.func}),Xa=le.shape({on:le.func,off:le.func,emit:le.func}),pp=le.shape({registerComponent:le.func,root:le.shape({addChild:le.func}),on:le.func,off:le.func,eventHub:Xa}),Zb=Object.freeze({Container:mp,EventHub:Xa,Layout:pp});function Jt(n,e,t){h.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var Za="SET_DASHBOARD_DATA";const fp=mh(Za,{},!1),vp={dashboardData:fp};var gp=new Map,Ya=Object.freeze({}),bp=Object.freeze([]),Yb=$s,Jb=Hs,Qb=wd,yp=n=>n.dashboardData,Ce=(n,e)=>{var t;return(t=yp(n)[e])!==null&&t!==void 0?t:Ya},ey=(n,e)=>{var t;return(t=Ce(n,e).closed)!==null&&t!==void 0?t:bp},ty=(n,e)=>{var t;return(t=Ce(n,e).openedMap)!==null&&t!==void 0?t:gp},Ja=(n,e)=>{var t;return(t=Ce(n,e).pluginDataMap)!==null&&t!==void 0?t:Ya},ny=(n,e,t)=>Ja(n,e)[t];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 on(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){Cp(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 Cp(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=Sp(n,"string");return typeof e=="symbol"?e:e+""}function Sp(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 Qa=(n,e)=>({type:Za,id:n,payload:e}),_p=(n,e)=>(t,r)=>t(Qa(n,on(on({},Ce(r(),n)),e))),ry=(n,e,t)=>(r,i)=>r(Qa(n,on(on({},Ce(i(),n)),{},{pluginDataMap:on(on({},Ja(i(),n)),{},{[e]:t})})));Object.entries(vp).map(n=>{var[e,t]=n;return gh.register(e,t)});var el=h.createContext(null);el.displayName="PersistentStateContext";function zn(n,e){return"".concat(n,"::").concat(e)}function Ep(n){var{initialState:e,onChange:t,children:r}=n,i=h.useRef(!0);h.useEffect(()=>()=>{i.current=!1},[]);var o=h.useRef(!1),[s]=h.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),a=h.useRef(new Map),l=h.useCallback((v,g,b)=>{var{type:w}=b,C=zn(g,w),y=a.current.get(C);if(y!=null&&y!==v)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));a.current.set(C,v),i.current&&s.get(C)!==b&&(s.set(C,b),t([...s.entries()]))},[i,t,s]),d=h.useRef(e[Symbol.iterator]()),c=h.useCallback((v,g)=>{var b=zn(v,g),w=s.get(b);if(w==null&&o.current){var{value:C}=d.current.next(),y=C;return s.set(b,y),y}return w},[s]),m=h.useCallback((v,g,b)=>{var w=zn(g,b),C=a.current.get(w);C===v&&(s.delete(w),a.current.delete(w),i.current&&t([...s.entries()]))},[i,t,s]),p=h.useCallback((v,g,b)=>{var w=zn(g,b),C=a.current.get(w);C===v&&a.current.delete(w)},[]),f=h.useMemo(()=>({addState:l,removeState:m,deregisterHook:p,getState:c}),[l,c,m,p]);return u.jsx(el.Provider,{value:f,children:r})}var Pp=A.module("DashboardPanelWrapper");function Tp(n){var{glContainer:e,children:t}=n,r=h.useCallback(s=>{e.setPersistedState(s)},[e]),{persistedState:i}=e.getConfig(),[o]=h.useState(()=>i!=null&&!Array.isArray(i)?(Pp.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return u.jsx(Ep,{initialState:o,onChange:r,children:t})}var pi=h.createContext(null);pi.displayName="PanelIdContext";function Op(){return h.useContext(pi)}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 At(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){xp(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 xp(n,e,t){return(e=Ip(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ip(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 Qt=A.module("DashboardLayout"),Mp=Object.freeze({}),jp=[],Mo=()=>{},kp=1e3,jo=n=>n;function iy(n){var e,t,{id:r,children:i,emptyDashboard:o=u.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:s,layoutConfig:a=jp,onLayoutChange:l=Mo,onLayoutInitialized:d=Mo,hydrate:c=Ga,dehydrate:m=Va,panelWrapper:p}=n,f=$s(),v=(e=Hs(x=>Ce(x,r)))!==null&&e!==void 0?e:Mp,[g,b]=h.useState(!1),[w,C]=h.useState(!1),y=h.useRef(),[I]=h.useState((t=v==null?void 0:v.closed)!==null&&t!==void 0?t:[]),[X,Q]=h.useState(s.getReactChildren()),z=h.useMemo(()=>new Map,[]),j=h.useMemo(()=>new Map,[]),N=h.useCallback(function(x,q){var ee,Rn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,vn=arguments.length>3&&arguments[3]!==void 0?arguments[3]:m;Qt.debug2("registerComponent",x,q,Rn,vn);function Ct(E,V){var te=q,ge=p,Ne=oa(te),wt=Ne?u.jsx(te,At(At({},E),{},{ref:V})):u.jsx(te,At({},E)),{glContainer:Xt,glEventHub:Sl}=E,_l=P.getIdFromContainer(Xt);return u.jsx(dp,{glContainer:Xt,glEventHub:Sl,children:u.jsx(pi.Provider,{value:_l,children:u.jsx(Tp,At(At({},E),{},{children:ge==null?wt:u.jsx(ge,At(At({},E),{},{children:wt}))}))})})}Ct.displayName="DashboardWrapper(".concat((ee=q.displayName)!==null&&ee!==void 0?ee:x,")");var _r=s.registerComponent(x,O.forwardRef(Ct));return z.set(x,Rn),j.set(x,vn),_r},[c,m,z,j,s,p]),G=h.useCallback((x,q)=>{var ee;return((ee=z.get(x))!==null&&ee!==void 0?ee:jo)(q,r)},[z,r]),H=h.useCallback((x,q)=>{var ee;return((ee=j.get(x))!==null&&ee!==void 0?ee:jo)(q,r)},[j,r]),M=h.useMemo(()=>new za(s,G,H,new Map,I,x=>{var{closed:q,openedMap:ee}=x;f(_p(r,{closed:q,openedMap:ee}))}),[H,f,G,r,I,s]),K=vu(x=>{var q=y.current,ee=q==null||!P.isEqual(q,x);Qt.debug("handleLayoutStateChanged",ee,x),ee&&(Qt.debug("Layout config has changed","lastConfig",q,"dehydratedLayoutConfig",x),b(s.root.contentItems.length===0),y.current=x,l(x),Q(s.getReactChildren()))},kp,{flushOnUnmount:!0});h.useEffect(()=>()=>K.flush(),[K]);var W=h.useCallback(()=>{if(!w){var x=s.toConfig(),q=x.content,ee=P.dehydrateLayoutConfig(q,H);K(ee)}},[H,w,s,K]),L=h.useCallback(x=>{var q=P.getIdFromContainer(x);s.eventHub.emit(J.DRAGGING,q),C(!0)},[s.eventHub]),$=h.useCallback(x=>{var q=P.getIdFromContainer(x);s.eventHub.emit(J.DROPPED,q),C(!1)},[s.eventHub]),U=h.useCallback(x=>{if(Qt.debug2("handleComponentCreated",x),!(x==null||x.config==null||!xt(x.config)||x.config.component==null||x.element==null)){var q=x.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),ee="".concat(q,"-component");x.element.addClass(ee)}},[]),he=h.useCallback(()=>{Q(s.getReactChildren())},[s]);Jt(s,"stateChanged",W),Jt(s,"itemPickedUp",L),Jt(s,"itemDropped",$),Jt(s,"componentCreated",U),Jt(s.eventHub,J.TITLE_CHANGED,W),Jt(s,"reactChildrenChanged",he);var Ue=fu(a);return h.useEffect(function(){if(Ue!==a&&a!==y.current){Qt.debug("loadNewConfig effect triggered. previousLayoutConfig",Ue,"layoutConfig",a,"lastConfig",y.current),Qt.debug("Setting new layout content...");for(var q=P.hydrateLayoutConfig(a,G);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var ee=0;ee<q.length;ee+=1)s.root.addChild(q[ee]);b(s.root.contentItems.length===0)}},[G,s,a,M,Ue]),h.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,X,O.Children.map(i,x=>x!=null?u.jsx(jc,{fallback:[],children:O.cloneElement(x,{id:r,layout:s,panelManager:M,registerComponent:N})}):null)]})}var tl=h.createContext(null);tl.displayName="DashboardIdContext";function oy(){var n=h.useContext(tl);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function Np(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)}function nl(n,e,t){if(n){if(t(n)===!0)return n;for(var r=n.child;r;){var i=nl(r,e,t);if(i)return i;r=r.sibling}}}function Rp(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var fi=Rp(h.createContext(null));fi.displayName="FiberContext";class sy extends h.Component{constructor(){super(...arguments),Np(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return u.jsx(fi.Provider,{value:this._reactInternals,children:e})}}function Fp(){var n=h.useContext(fi);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=h.useState(()=>ft()),t=h.useMemo(()=>{for(var r of[n,n==null?void 0:n.alternate].filter(o=>o!=null)){var i=nl(r,!1,o=>{for(var s=o.memoizedState;s!=null;){if(s.memoizedState===e)return!0;s=s.next}});if(i)return i}},[n,e]);return t}var ay="default",$p="CREATE_DASHBOARD",Hp="CLOSE_DASHBOARD",{listen:ly,emit:dy,useListener:uy}=lt($p),{listen:cy,emit:Up,useListener:hy}=lt(Hp);function Bp(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=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 rl extends h.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,s,a;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;(s=((a=t[r])===null||a===void 0?void 0:a.contentItem).container)===null||s===void 0||s.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(J.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,s,a;if(((o=t[i].contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id)===((s=e.tab)===null||s===void 0||(s=s.contentItem)===null||s===void 0||(s=s.config)===null||s===void 0?void 0:s.id))break;var l=!!(!((a=t[i])===null||a===void 0||(a=a.contentItem)===null||a===void 0||(a=a.config)===null||a===void 0)&&a.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=P.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(s=>s.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:r}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:oe.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:oe.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:oe.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:oe.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(oe,{actions:i})}}Bp(rl,"defaultProps",{additionalActions:[]});var zp=n=>({workspace:ba(n)}),Vp=In(zp,{setWorkspace:ya})(rl);function il(n,e,t){return(e=Gp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gp(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 ol extends h.PureComponent{constructor(e){super(e),il(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=O.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 u.jsxs("form",{className:R("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:s=>{s.stopPropagation()},onMouseUp:s=>{s.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),u.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}),u.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(ne,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(ne,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(cr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}il(ol,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var Vn=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function ko(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=Zp(n,"string");return typeof e=="symbol"?e:e+""}function Zp(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 Yp=A.module("Panel");class Jp extends h.PureComponent{constructor(e){super(e),ko(this,"ref",void 0),ko(this,"getAdditionalActions",sn((r,i,o)=>{var s=[];return i&&s.push(this.getCloneAction()),o&&s.push(this.getRenameAction()),[...s,...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=O.createRef();var{glContainer:t}=this.props;this.state={title:P.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(Vn.focus,this.handleTabFocus),i.on(Vn.blur,this.handleTabBlur),i.emit(J.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(Vn.focus,this.handleTabFocus),r.off(Vn.blur,this.handleTabBlur),r.emit(J.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:P.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(J.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=P.getRootFromContainer(t),i=P.getComponentConfigFromContainer(t);F(i),P.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=P.getRootFromContainer(e),i=P.getComponentConfigFromContainer(e);if(i==null){Yp.error("Could not get component config from container",e);return}var o=P.cloneComponent(r,i);o!==null&&t.emit(J.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:oe.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:oe.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:s=Dd,errorMessage:a,isLoaded:l=!0,isLoading:d=!1,isClonable:c=!1,isRenamable:m=!1}=this.props,{tab:p}=i,{showRenameDialog:f,title:v,isWithinPanel:g}=this.state;return u.jsxs("div",{className:R("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(On,{"data-testid":"base-panel-loading",errorMessage:a,isLoaded:l,isLoading:d}),!g&&p!=null&&ii.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(Vp,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(s,c,m)}),m&&u.jsx(ol,{isShown:f,value:v,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&u.jsx(ie,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),p.element[0])]})}}var Qp=ha(Jp),ef=A.module("useDhId"),Dr="__dhId";function my(){var n,e,t=(n=(e=Fp())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[Dr],i=Op();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(Dr," to be a string, but got ").concat(typeof r));return r}return i??(ef.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(Dr," prop. Defaulting to null.")),null)}const tf="var(--dh-color-chart-colorway)",nf="var(--dh-color-chart-grid)",rf="var(--dh-color-chart-axis-line)",of="var(--dh-color-chart-axis-line-zero)",No={"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:tf,gridcolor:nf,linecolor:rf,zerolinecolor:of,"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 Lo=A.module("ChartTheme");function sf(){var n,e=js(No);return e.colorway=Hl((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Ul.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Lo.debug2("Chart theme:",No),Lo.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 Ao(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 af(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ao(Object(t),!0).forEach(function(r){lf(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ao(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function lf(n,e,t){return(e=df(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function df(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)}var cf=h.lazy(()=>Sd(()=>import("./Plot-ERtG8jGQ.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function hf(n){return u.jsx(h.Suspense,{fallback:u.jsx(On,{"data-testid":"lazy-plot-loading"}),children:u.jsx(cf,af({},n))})}var vi=h.createContext(null);vi.displayName="ChartThemeContext";function py(n){var{children:e}=n,{activeThemes:t}=Js(),r=h.useMemo(sf,[t]);return u.jsx(vi.Provider,{value:r,children:e})}function mf(){return Mn(vi,"No ChartThemeContext value found.")}function sl(n){var{type:e}=n,t=Wc();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ae,{icon:Kl});case t.VariableType.FIGURE:return u.jsx(ae,{icon:ks});case t.VariableType.PANDAS:return u.jsx(ae,{icon:Bl});default:return u.jsx(ae,{icon:Ms})}}function Ro(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function pf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Ro(o,r,i,s,a,"next",l)}function a(l){Ro(o,r,i,s,a,"throw",l)}s(void 0)})}}function al(n){var{children:e,language:t}=n,[r,i]=h.useState(null),{activeThemes:o}=Js();return h.useEffect(()=>{var s=!1;function a(){return l.apply(this,arguments)}function l(){return l=pf(function*(){if(e!=null&&o!=null){var d=yield Pe.colorize(e.toString(),t,{});s||i(d)}}),l.apply(this,arguments)}return a(),()=>{s=!0}},[o,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class ll{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class or{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:_d.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 or.isTableType(e,t)||or.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function ff(n){var{children:e}=n;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}function Qr(n,e,t){return(e=vf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vf(n){var e=gf(n,"string");return typeof e=="symbol"?e:e+""}function gf(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 dl extends h.Component{constructor(e){super(e),Qr(this,"timer",void 0),Qr(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 u.jsx("div",{className:R("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(Ns,{className:"ml-2"}),"Running... ",xe.formatElapsedTime(r)," ",u.jsx(ne,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Wl,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Qr(dl,"defaultProps",{disabled:!1});function En(n,e,t){return(e=bf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bf(n){var e=yf(n,"string");return typeof e=="symbol"?e:e+""}function yf(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 cn extends h.PureComponent{constructor(e){super(e),En(this,"mouseX",void 0),En(this,"mouseY",void 0),En(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)>=cn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=cn.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;F(r);var i=r.trimEnd(),o=i.indexOf(`
4
- `),s=o>-1,a=i;s&&(a=i.slice(0,o));var l=i.slice(o),d=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:R("error-message",{expanded:e}),children:[s&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:d,tabIndex:-1,children:u.jsx(ae,{icon:e?Lr:zl,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:a}),e?l:""]})]}),!s&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:a})})]},"error")}}En(cn,"defaultProps",{message:""});En(cn,"mouseDragThreshold",5);var ul=h.memo(n=>{var{item:e}=n,{startTime:t,serverStartTime:r,serverEndTime:i}=e,o=h.useMemo(()=>{var c;return(c=e.endTime)!==null&&c!==void 0?c:Date.now()},[e.endTime]),s=xe.formatConvertedDuration(t,o),a=!!s,l=null;r!=null&&i!=null&&(l=xe.formatConvertedDuration(r,i,"ns"));var d=!!l;return u.jsxs(u.Fragment,{children:[u.jsx(Qs,{children:"Execution Info"}),u.jsx(Ed,{children:u.jsxs("div",{className:"console-history-item-contextual-help-content",children:[a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"Elapsed time"}),u.jsx("div",{children:s})]}),d&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"Server query time"}),u.jsx("div",{children:l})]})]})})]})});ul.displayName="ConsoleHistoryItemTooltip";var Cf=n=>{if((n==null?void 0:n.command)==null)return null;var e=n.command?n.command.split(`
5
- `).length:0;return e>2?null:"console-history-actions-".concat(e)},cl=h.memo(n=>{var{item:e,onCommandSubmit:t,handleTooltipVisible:r}=n,i=h.useMemo(()=>Cf(e),[e]);return u.jsxs("div",{className:R("console-history-actions",i),children:[e.command!=null&&u.jsx(sa,{copy:e.command}),u.jsx(ne,{icon:Vl,kind:"inline",onClick:()=>{var o;return t((o=e.command)!==null&&o!==void 0?o:"")},tooltip:"Rerun",children:null}),u.jsx(Pd,{variant:"info",onOpenChange:r,UNSAFE_className:"console-history-item-contextual-help",children:u.jsx(ul,{item:e})})]})});cl.displayName="ConsoleHistoryItemActions";function wf(n,e,t){return(e=Sf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sf(n){var e=_f(n,"string");return typeof e=="symbol"?e:e+""}function _f(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 Fo=A.module("ConsoleHistoryItem");class hl extends h.PureComponent{constructor(e){super(e),this.state={isTooltipVisible:!1},this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Fo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Fo.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{isTooltipVisible:e}=this.state,{disabled:t,item:r,language:i,iconForType:o,onCommandSubmit:s}=this.props,{disabledObjects:a,result:l}=r,d=r.command!=null&&r.command!=="",c=null;d&&(c=u.jsxs("div",{className:R("console-history-item-command",{"console-history-item-command-tooltip-active":e}),children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsxs("div",{className:"console-history-content",children:[u.jsx(al,{language:i,children:r.command}),u.jsx(cl,{item:r,onCommandSubmit:s,handleTooltipVisible:j=>this.setState({isTooltipVisible:j})})]})]}));var m=[],p=!1;if(l){var{error:f,message:v,changes:g}=l;if(g){var{created:b,updated:w}=g;[...b,...w].forEach(j=>{p=!0;var{title:N}=j,G="".concat(N),H=t===void 0||t||(a??[]).indexOf(G)>=0,M=u.jsx(ne,{kind:"primary",onClick:()=>this.handleObjectClick(j),className:"btn-console-object",disabled:H,icon:o(j.type),children:N},G);m.push(M)})}if(f!=null&&!d){var C,y="".concat((C=f.message)!==null&&C!==void 0?C:f);y||(y=f);var I=u.jsx(cn,{message:y},"result-error");m.push(I)}if(v!==void 0&&v!==""){var X=u.jsx("div",{className:"log-message",children:v},"log-message");m.push(X)}}else{p=!0;var Q=u.jsx(dl,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");m.push(Q)}var z=null;return m.length>0&&(z=u.jsx(ff,{children:m})),u.jsxs("div",{className:R("console-command-result",{"console-result-buttons":p}),children:[c,z]})}}wf(hl,"defaultProps",{disabled:!1});function Ef(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var Pf=O.forwardRef(function(e,t){for(var{disabled:r=!1,items:i,language:o,openObject:s,supportsType:a,iconForType:l,onCommandSubmit:d}=e,c=[],m=0;m<i.length;m+=1){var p=i[m],f=u.jsx(hl,{disabled:r,item:p,openObject:s,language:o,supportsType:a,iconForType:l,onCommandSubmit:d},Ef(m,p));c.push(f)}return u.jsx("div",{ref:t,className:"container-fluid console-history",children:c})}),Tf={name:"Console",CLEAR:re.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[_.CTRL,S.L],macShortcut:[_.CTRL,S.C]}),FOCUS_HISTORY:re.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[_.CTRL,S.H],macShortcut:[_.CTRL,_.OPTION,S.H]})},Of={name:"Command History",FOCUS_HISTORY:re.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[_.CTRL,S.H],macShortcut:[_.CTRL,_.OPTION,S.H]}),SEND_TO_CONSOLE:re.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[S.ENTER],macShortcut:[S.ENTER]}),SEND_TO_NOTEBOOK:re.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[_.CTRL,S.ENTER],macShortcut:[_.CMD,S.ENTER]}),RUN:re.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[_.ALT,S.R],macShortcut:[_.OPTION,S.R]})},xf={name:"Notebook",RUN:re.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[_.ALT,S.R],macShortcut:[_.OPTION,S.R]}),RUN_SELECTED:re.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[_.ALT,_.SHIFT,S.R],macShortcut:[_.OPTION,_.SHIFT,S.R]}),FIND:re.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[_.CTRL,S.F],macShortcut:[_.CMD,S.F],isEditable:!1}),MINIMAP:re.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[_.ALT,S.M],macShortcut:[_.OPTION,S.M]}),WORDWRAP:re.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[_.ALT,S.Z],macShortcut:[_.OPTION,S.Z]})},ln={CONSOLE:Tf,COMMAND_HISTORY:Of,NOTEBOOK:xf};const fe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),If="var(--dh-color-editor-bg)",Df="var(--dh-color-editor-fg)",Mf="var(--dh-color-editor-string)",jf="var(--dh-color-editor-delimiter)",kf="var(--dh-color-editor-predefined)",Nf="var(--dh-color-editor-keyword)",Lf="var(--dh-color-editor-storage)",Af="var(--dh-color-editor-number)",Rf="var(--dh-color-editor-operator)",Ff="var(--dh-color-editor-identifier)",$f="var(--dh-color-editor-comment)",ei={"error-foreground":"var(--dh-color-editor-error-fg)",background:If,foreground:Df,"line-height":"19px",string:Mf,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:jf,predefined:kf,keyword:Nf,storage:Lf,number:Af,operator:Rf,identifier:Ff,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:$f,"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 Hf="python",Uf={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/}}},Bf={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"]]}},Kf={id:Hf,conf:Uf,language:Bf},Wf="groovy",zf={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/}}},Vf={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"]]}},Gf={id:Wf,conf:zf,language:Vf},qf="scala",Xf={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>))/}}},Zf={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"]]}},Yf={id:qf,conf:Xf,language:Zf},Jf="deephavenDb",Qf={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/}}},ev={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"]]}},tv={id:Jf,conf:Qf,language:ev},nv="log",rv={},iv={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"}]]}},ov={id:nv,conf:rv,language:iv},sv={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 $o(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function av(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){$o(o,r,i,s,a,"next",l)}function a(l){$o(o,r,i,s,a,"throw",l)}s(void 0)})}}function jt(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=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 We=A.module("MonacoCompletionProvider");class D extends h.PureComponent{static initRuff(){return av(function*(){if(D.isRuffEnabled)return D.initRuffPromise||(D.initRuffPromise=Od({}).then(()=>{We.debug("Initialized Ruff",Oi.version()),D.isRuffInitialized=!0,D.updateRuffWorkspace()})),D.initRuffPromise})()}static updateRuffWorkspace(){if(D.isRuffInitialized){var e=console.log;try{console.log=()=>{},D.ruffWorkspace=new Oi(D.ruffSettings)}finally{console.log=e}D.lintAllPython()}}static setRuffSettings(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D.ruffSettings;if(D.ruffSettings=e,!D.isRuffInitialized){D.initRuff();return}D.updateRuffWorkspace()}static getDiagnostics(e){if(!D.ruffWorkspace)return[];var t=D.ruffWorkspace.check(e.getValue());return ye.isConsoleModel(e)?t.filter(r=>r.code==null):t}static lintAllPython(){if(!D.isRuffEnabled){Pe.removeAllMarkers("ruff");return}Pe.getModels().filter(e=>e.getLanguageId()==="python").forEach(D.lintPython)}static lintPython(e){if(D.isRuffEnabled&&D.ruffWorkspace){var t=D.getDiagnostics(e);We.debug("Linting Python document: ".concat(e.uri.toString()),t),Pe.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?xi.Error:xi.Warning,tags:i?[Td.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=Ge.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(!D.isRuffEnabled||!D.ruffWorkspace)return{actions:[],dispose:()=>{}};var r=D.getDiagnostics(e).filter(d=>{var c=new Us(d.location.row,d.location.column,d.end_location.row,d.end_location.column);return d.code!=null&&c.intersectRanges(t)}),i=r.filter(d=>{var{fix:c}=d;return c!=null}).map(d=>{var c="Fix";return d.fix!=null&&(d.fix.message!=null&&d.fix.message!==""?c="".concat(d.code,": ").concat(d.fix.message):c="Fix ".concat(d.code)),{title:c,id:"fix-".concat(d.code),kind:"quickfix",edit:d.fix?{edits:d.fix.edits.map(m=>{var p;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:m.location.row,startColumn:m.location.column,endLineNumber:m.end_location.row,endColumn:m.end_location.column},text:(p=m.content)!==null&&p!==void 0?p:""}}})}:void 0}}),o=new Set,s=new Set;r.forEach(d=>{d.code!=null&&(o.has(d.code)&&s.add(d.code),o.add(d.code))});var a=r.map(d=>{if(d.code==null)return[];var c=e.getLineContent(d.location.row),m=Pe.tokenize(c,e.getLanguageId())[0].at(-1),p={range:{startLineNumber:d.location.row,startColumn:c.length+1,endLineNumber:d.location.row,endColumn:c.length+1},text:" # noqa: ".concat(d.code)};return m!=null&&m.type.startsWith("comment")&&(p.text="# noqa: ".concat(d.code," "),c.startsWith("# noqa:",m.offset)?(p.range.startColumn=m.offset+1,p.range.endColumn=m.offset+9):(p.range.startColumn=m.offset+1,p.range.endColumn=c.startsWith("# ",m.offset)?m.offset+3:m.offset+2)),[{title:"Disable ".concat(d.code," for ").concat(s.has(d.code)?"line ".concat(d.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:p}]}}]}).flat().filter((d,c,m)=>m.find(p=>p.title===d.title)===d),l=[...o].map(d=>({title:"Disable ".concat(d," 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(d,`
6
- `)}}]}}));return{actions:[...i,...a,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(D.ruffWorkspace)return We.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:D.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),jt(this,"registeredCompletionProvider",void 0),jt(this,"registeredSignatureProvider",void 0),jt(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=Ge.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=Ge.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=Ge.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 s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:D.monacoToLspPosition(t),context:r},a=o.getCompletionItems(s);We.debug("Requested completion items",s);var l=a.then(d=>{We.debug("Completion items received: ",s,d);var c=d.map(m=>{var{label:p,kind:f,detail:v,documentation:g,sortText:b,filterText:w,textEdit:C,insertTextFormat:y}=m;return{label:p,kind:D.lspToMonacoKind(f),detail:v,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:w,insertText:C.text,insertTextRules:y===2?4:y,range:D.lspToMonacoRange(C.range)}});return{incomplete:!0,suggestions:c}}).catch(d=>(We.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:s,session:a}=this.props;if(e!==s||a.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:D.monacoToLspPosition(t),context:i},d=a.getSignatureHelp(l);We.debug("Requested signature help",l);var c=d.then(m=>{We.debug("Signatures received: ",l,d);var p=m.map(v=>{var{label:g,documentation:b,parameters:w}=v;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:w??[]}});if(p.length===0)return o;var f=0;return{value:{signatures:p,activeSignature:f,activeParameter:m[f].activeParameter},dispose:()=>{}}}).catch(m=>(We.error("There was an error retrieving completion items",m),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:D.monacoToLspPosition(t)},s=i.getHover(o);We.debug("Requested hover",o);var a=s.then(l=>{We.debug("Hover received: ",o,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(We.error("There was an error retrieving hover",l),{contents:[]}));return a}render(){return null}}jt(D,"ruffWorkspace",void 0);jt(D,"initRuffPromise",void 0);jt(D,"isRuffInitialized",!1);jt(D,"isRuffEnabled",!0);jt(D,"ruffSettings",sv);function Ho(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function uv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Ho(o,r,i,s,a,"next",l)}function a(l){Ho(o,r,i,s,a,"throw",l)}s(void 0)})}}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 Bo(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){cv(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 cv(n,e,t){return(e=hv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hv(n){var e=mv(n,"string");return typeof e=="symbol"?e:e+""}function mv(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=A.module("MonacoUtils"),Ko="inmemory://dh-console/";class ye{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ut.debug("Initializing Monaco..."),e!==void 0&&ye.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=ye;t(),r([tv,Kf,Gf,ov,Yf]),Ge.onLanguage("python",()=>{Ge.registerCodeActionProvider("python",{provideCodeActions:D.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),Ge.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:D.handlePythonFormatRequest})}),Pe.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){D.ruffWorkspace!=null&&D.lintPython(i);var o=dr(s=>D.lintPython(s),250);i.onDidChangeContent(()=>{o(i)})}}),ye.removeConflictingKeybindings(),ut.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=ye,i=js(ei);ut.debug2("Monaco theme:",ei),ut.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"])}],s={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"]};Pe.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:s});try{Pe.setTheme("dh-dark")}catch(a){ut.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",a),Pe.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Bo(Bo({},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});Ge.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;ut.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{ye.registerLanguage(r)})}static registerLanguage(e){ut.debug2("Registering language: ",e.id),Ge.register(e),Ge.onLanguage(e.id,()=>{Ge.setLanguageConfiguration(e.id,e.conf),Ge.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pe.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();F(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};ut.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(s=>{for(var{changes:a,versionId:l}=s,d=[],c=0;c<a.length;c+=1){var m=a[c],{range:p,rangeLength:f,text:v}=m,g={range:{start:{line:p.startLineNumber-1,character:p.startColumn-1},end:{line:p.endLineNumber-1,character:p.endColumn-1}},rangeLength:f,text:v};d.push(g)}if(d.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:d};ut.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();F(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,s=e.getModel();F(s);var a=s.getValueInRange(t.range);(r.test(a)||i.test(a)||o.test(a))&&s.applyEdits([{range:t.range,text:a.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){Pe.addKeybindingRule({keybinding:Ve.CtrlCmd|Kt.KeyD,command:null}),ye.isMacPlatform()||Pe.addKeybindingRule({keybinding:Ve.CtrlCmd|Kt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(ft()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=ye.isMacPlatform();return i?(t.metaKey?Ve.CtrlCmd:0)|(t.shiftKey?Ve.Shift:0)|(t.altKey?Ve.Alt:0)|(t.ctrlKey?Ve.WinCtrl:0)|Ii.fromString(r):(t.ctrlKey?Ve.CtrlCmd:0)|(t.shiftKey?Ve.Shift:0)|(t.altKey?Ve.Alt:0)|(t.metaKey?Ve.WinCtrl:0)|Ii.fromString(r)}static provideLinks(e){for(var t=[],r=function(s){var a=e.getLineContent(s),l=Id(a),d=l.filter(c=>c.type==="url"?/^https?:\/\//.test(c.value):!0);d.forEach(c=>{t.push({url:c.href,range:new Us(s,c.start+1,s,c.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return xd.parse("".concat(Ko).concat(ft()))}static isConsoleModel(e){return e.uri.toString().startsWith(Ko)}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 uv(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function Wo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.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 s(l){Wo(o,r,i,s,a,"next",l)}function a(l){Wo(o,r,i,s,a,"throw",l)}s(void 0)})}}function Ae(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=vv(n,"string");return typeof e=="symbol"?e:e+""}function vv(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 Mr=A.module("ConsoleInput"),sr=parseInt(ei["line-height"],10),ml=6,pl=6,gv=sr+ml+pl,jr=100;class hn extends h.PureComponent{constructor(e){super(e),Ae(this,"cancelListener",void 0),Ae(this,"resizeObserver",void 0),Ae(this,"commandContainer",void 0),Ae(this,"commandEditor",void 0),Ae(this,"commandHistoryIndex",void 0),Ae(this,"commandSuggestionContainer",void 0),Ae(this,"loadingPromise",void 0),Ae(this,"timestamp",void 0),Ae(this,"bufferIndex",void 0),Ae(this,"history",void 0),Ae(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=O.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:sr,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(Mr.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=Pe.createModel("",e,ye.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:sr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:ml,bottom:pl},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:r},o=this.commandContainer.current;F(o),this.commandEditor=Pe.create(o,i),ye.setEOL(this.commandEditor),ye.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var s,a=(s=this.commandEditor)===null||s===void 0?void 0:s.getValue();this.modifiedCommands.set(this.commandHistoryIndex,a??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(s=>{var{commandEditor:a,commandHistoryIndex:l}=this,d=a==null?void 0:a.getPosition();F(d);var{lineNumber:c}=d;if(!s.altKey&&!s.shiftKey&&!s.metaKey){if(s.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),s.stopPropagation(),s.preventDefault();return}if(s.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===(r==null?void 0:r.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),s.stopPropagation(),s.preventDefault();return}if(s.keyCode===Kt.Enter&&!this.isSuggestionMenuPopulated()){var m;s.stopPropagation(),s.preventDefault();var p=(m=this.commandEditor)===null||m===void 0?void 0:m.getValue().trim();if(p!==void 0){var f;this.processCommand(p),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}}),ye.disableKeyBindings(this.commandEditor,[Ve.CtrlCmd|Kt.KeyF]),ye.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&&(ye.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,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();F(s);var a=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,a);F(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:a}),(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,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();F(s);var a=s.getLineCount(),l=s.getLineLength(a)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(a,l);F(d),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:a,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(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-jr&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return pv(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=He.makeCancelable(t.getTable(r,i??"",e.timestamp),a=>a.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+jr-1}),e.loadingPromise=He.makeCancelable(o.getViewportData(),()=>o.close());var s=yield e.loadingPromise;e.bufferIndex+=jr,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...s.items.filter((a,l,d)=>{var{name:c}=a;return l===0||c!==d[l-1].name}).map(a=>{var{name:l}=a;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(a){if(e.loadingPromise=void 0,He.isCanceled(a)){Mr.debug2("Promise canceled, not loading history");return}Mr.error("Error fetching history",a)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),F(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;F(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),gv),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var s,a;(s=this.commandEditor)===null||s===void 0||s.updateOptions(o),(a=this.commandEditor)===null||a===void 0||a.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:s}=this.state;return u.jsx("div",{className:R("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:R("console-input-inner-wrapper",{focus:o}),children:[u.jsx("div",{className:hn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),s&&u.jsx(D,{model:s,language:t,session:r})]})})}}Ae(hn,"defaultProps",{maxHeight:sr*10,scope:null,disabled:!1});Ae(hn,"INPUT_CLASS_NAME","console-input");function It(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=yv(n,"string");return typeof e=="symbol"?e:e+""}function yv(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 zo="pasted values",Cv=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],kr=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Vo=[".zip"];class Te extends h.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Cv.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return kr.some(r=>e.endsWith(r))||t&&Vo.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===zo?_i:e.endsWith(".csv")?Gl:e.endsWith(".zip")?ql:Xl}constructor(e){super(e),It(this,"fileElem",void 0),It(this,"divElem",void 0),It(this,"getValidExtensions",sn(t=>t?[...kr,...Vo]:[...kr])),It(this,"getAcceptString",sn(t=>this.getValidExtensions(t).join(", "))),It(this,"getFileTypeErrorString",sn(t=>ou.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=O.createRef(),this.divElem=O.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();F(o),Te.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Te.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:zo,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:_i,action:this.handleMenuPaste,shortcut:rn.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,s=t??o,a=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Te.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(oe,{actions:a}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(s===void 0||s==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ae,{icon:Zl})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(ne,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(s===void 0||s==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ae,{icon:Te.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!r&&u.jsx(ne,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Yl,tooltip:"Remove"})]})]})]}),!!s&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ae,{icon:Ls})}),u.jsx("label",{children:s}),s===Te.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}It(Te,"defaultProps",{allowZip:!1,dragError:null});It(Te,"MULTIPLE_FILE_ERROR","Please select only one file");It(Te,"FILE_TYPE_ERROR","Filetype not supported.");function fl(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 Go(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?Go(Object(t),!0).forEach(function(r){Se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Se(n,e,t){return(e=wv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wv(n){var e=Sv(n,"string");return typeof e=="symbol"?e:e+""}function Sv(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 Xo="unknown",_v=2147483647,Ev=-2147483648,Zo=/^[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]+)?$/,Yo=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class be{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case B.STRING:return B.STRING;case B.INTEGER:return be.checkInteger(e);case B.LONG:return be.checkLong(e);case B.DOUBLE:return be.checkDouble(e);case B.BOOLEAN:return be.checkBoolean(e);case B.DATE_TIME:return be.checkDateTime(e);case B.LOCAL_TIME:return be.checkLocalTime(e);default:return be.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return be.isNotParsableNumber(t)?B.STRING:be.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return be.isNotParsableNumber(t)?B.STRING:t.includes(".")?B.DOUBLE:B.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return be.isNotParsableNumber(t)?B.STRING:B.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?B.BOOLEAN:B.STRING}static checkDateTime(e){return Zo.test(e)?B.DATE_TIME:B.STRING}static checkLocalTime(e){return Yo.test(e)?B.LOCAL_TIME:B.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(be.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?B.BOOLEAN:Zo.test(e)&&e.includes(":")?B.DATE_TIME:Yo.test(e)?B.LOCAL_TIME:B.STRING}return be.getNumberType(t)}static getNumberType(e){if(e.includes("."))return B.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return B.LONG;var r=parseInt(e,10);return r>_v||r<Ev?B.LONG:B.INTEGER}constructor(e,t,r,i,o,s,a,l,d,c){Se(this,"onFileCompleted",void 0),Se(this,"file",void 0),Se(this,"readHeaders",void 0),Se(this,"nullString",void 0),Se(this,"onProgress",void 0),Se(this,"onError",void 0),Se(this,"types",void 0),Se(this,"chunks",void 0),Se(this,"totalChunks",void 0),Se(this,"rowCount",void 0),Se(this,"isZip",void 0),Se(this,"shouldTrim",void 0),Se(this,"zipProgress",void 0),Se(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=s,this.onError=a,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,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=qo(qo({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)wn.parse(this.file,this.config);else{var e=fl(this.file,this.handleNodeUpdate);wn.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(Xo),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,F(this.types);var i=[...this.types];r.forEach(a=>{if(a.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=be.determineType(this.shouldTrim?a[l].trim():a[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
7
- Expected length `.concat(i.length," but found ").concat(a.length,`.
8
- Row = `).concat(a))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var s=this.onProgress(o);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;F(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===Xo||i===B.LOCAL_TIME?B.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}var vl;function se(n,e,t){return(e=Pv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pv(n){var e=Tv(n,"string");return typeof e=="symbol"?e:e+""}function Tv(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 Gn=A.module("CsvParser"),Ov=650;class mn{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(mn.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:s=!0,onProgress:a,onError:l,timeZone:d,isZip:c}=e;se(this,"onFileCompleted",void 0),se(this,"session",void 0),se(this,"file",void 0),se(this,"isZip",void 0),se(this,"type",void 0),se(this,"readHeaders",void 0),se(this,"timeZone",void 0),se(this,"onProgress",void 0),se(this,"onError",void 0),se(this,"tables",void 0),se(this,"headers",void 0),se(this,"types",void 0),se(this,"rowCount",void 0),se(this,"rowsProcessed",void 0),se(this,"chunks",void 0),se(this,"totalChunks",void 0),se(this,"isComplete",void 0),se(this,"zipProgress",void 0),se(this,"consolidatedChunks",void 0),se(this,"numConsolidated",void 0),se(this,"isCancelled",void 0),se(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=c,this.type=o,this.readHeaders=s,this.timeZone=d,this.onProgress=a,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=c?0:Math.ceil(i.size/wn.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 s=t[o];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
9
- `).concat(s));for(var a=0;a<e;a+=1){var l=this.type.shouldTrim?t[o][a].trim():t[o][a];i[a][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)wn.parse(this.file,this.config);else{var o=fl(this.file,this.handleNodeUpdate);wn.parse(o,this.config),o.resume()}},t=new be(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:s,tables:a}=this;if(this.isCancelled){Gn.debug2("CSV parser cancelled."),t.abort(),a.forEach(m=>m.close());return}var{data:l}=e;this.headers||(r?(this.headers=at.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=mn.generateHeaders(l[0].length));var d=[];try{if(d=this.transpose(this.headers.length,l),s)this.consolidateChunks(d,t);else{var c=this.chunks;this.chunks+=1,o(c,d,t)}}catch(m){i(m)}}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>=Ov||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,F(o),r(i,o,e)}handleCreateTable(e,t,r){var{session:i,tables:o,onFileCompleted:s,totalChunks:a,types:l,onProgress:d,onError:c}=this;r&&r.pause(),F(this.headers),F(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(m=>{if(this.isCancelled){Gn.debug2("CSV parser cancelled."),r&&r.abort(),o.forEach(f=>f.close());return}r&&r.resume(),o[e]=m;var p=0;a>0?p=Math.round(o.length/a*50)+50:p=Math.round(this.rowsProcessed/this.rowCount*50)+50,Gn.debug2("CSV parser progress ".concat(p)),d(p),this.isComplete&&o.length===this.chunks&&(Gn.debug2("CSV parser complete."),s(o))}).catch(m=>{!this.isComplete&&r&&r.abort(),c(m)})}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}}vl=mn;se(mn,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(vl.generateHeaderRecursive(t));return e});function gi(n,e,t){return(e=xv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xv(n){var e=Iv(n,"string");return typeof e=="symbol"?e:e+""}function Iv(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 Dt{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}gi(Dt,"DEFAULT_TYPE","DEFAULT_CSV");gi(Dt,"AUTO","AUTODETECT");gi(Dt,"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
10
- `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
11
- `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
12
- `,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
13
- `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}}));function gl(n,e,t){return(e=Dv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dv(n){var e=Mv(n,"string");return typeof e=="symbol"?e:e+""}function Mv(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=A.module("CsvInputBar"),jv=Object.entries(Dt.TYPES).map(n=>{var[e,t]=n;return u.jsx("option",{value:e,children:t.name},e)});class bl extends h.Component{constructor(e){super(e),gl(this,"inputRef",void 0),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=O.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Dt.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:r}=this.props,{tableName:i,tableNameSet:o}=this.state;if(!o&&t!=null&&!i){var s,a=t.name.lastIndexOf("."),l=at.makeVariableName(t.name.substring(0,a));this.setState({tableName:l,tableNameSet:!0}),(s=this.inputRef.current)===null||s===void 0||s.focus()}else(t==null&&e.file!=null||r==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});r!=null&&r!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:Dt.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:Dt.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:r}=this.props;Jo.error(e),r(e),t()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){var{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();var{file:t,paste:r}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):r!==void 0&&r!==""&&this.handleFile(new Blob([r],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Jo.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:r,timeZone:i,onInProgress:o}=this.props,{tableName:s,isFirstRowHeaders:a,type:l}=this.state,d=m=>{m.length===1?r.bindTableToVariable(m[0],s).then(()=>this.openTable()).catch(p=>this.handleError(p)):r.mergeTables(m).then(p=>{r.bindTableToVariable(p,s).then(()=>this.openTable()).catch(f=>this.handleError(f)),m.forEach(f=>f.close())}).catch(p=>this.handleError(p))},c=new mn({onFileCompleted:d,session:r,file:e,type:Dt.TYPES[l],readHeaders:a,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});c.parse(),this.setState({showProgress:!0,parser:c}),o(!0)}handleZipFile(e){var{onUpdate:t,unzip:r}=this.props;if(r==null){this.handleError(new Error("No support for zip files available."));return}r(e).then(i=>{for(var o=!1,s=0;s<i.length;s+=1){var a=i[s];if(Te.isValidExtension(a.name)){t("Loading ".concat(a.name," as csv from ").concat(e.name)),o=!0,this.handleFile(a,!0);break}}if(!o)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}handleProgress(e){var{showProgress:t}=this.state;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var{onInProgress:e}=this.props,{parser:t}=this.state;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var{onOpenTable:e,onClose:t}=this.props,{tableName:r}=this.state;e(r),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:r,isFirstRowHeaders:i,showProgress:o,progressValue:s,type:a}=this.state,l=!!t&&!r;return u.jsxs("div",{className:"csv-input-bar",children:[!o&&u.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),u.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:R("form-control",{"is-invalid":l}),value:r,onChange:this.handleTableName})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"formatSelect",children:"File format"}),u.jsx(ca,{id:"formatSelect",className:"custom-select",value:a,onChange:this.handleQueryTypeChange,children:jv})]}),u.jsx(ra,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),u.jsxs("div",{className:"csv-input-buttons form-group",children:[u.jsx(ne,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),u.jsx(ne,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!r,children:"Upload"})]})]}),o&&u.jsxs("div",{className:"csv-progress-container",children:[u.jsx("label",{children:"Uploading Table"}),u.jsx("div",{className:"progress",children:u.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(s,"%")},"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100})}),u.jsxs("label",{children:[s,"%"]}),u.jsx(ne,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}gl(bl,"defaultProps",{file:null,paste:null,unzip:null});function Qo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function kv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Qo(o,r,i,s,a,"next",l)}function a(l){Qo(o,r,i,s,a,"throw",l)}s(void 0)})}}var Nv={placement:"bottom-end"};function Lv(n){var{children:e,dh:t,session:r,overflowActions:i}=n,[o,s]=h.useState(0),a=h.useCallback(function(){var m=kv(function*(p){s(v=>v+1);try{var{result:f}=p.detail;yield f}catch{}s(v=>v-1)});return function(p){return m.apply(this,arguments)}}(),[]);h.useEffect(function(){return r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,a)},[t,a,r]);var l=null,d=null;o>0?(l="console-status-icon-pending",d="Worker is busy"):(l="console-status-icon-idle",d="Worker is idle");var c=i!=null&&(!Array.isArray(i)||i.length>0);return u.jsxs("div",{className:"console-pane-status-bar",children:[u.jsxs("div",{children:[u.jsx("div",{className:R("console-status-icon",l)}),u.jsx(ie,{children:d})]}),e,c&&u.jsx(ne,{kind:"ghost",icon:Jl,tooltip:"More Actions...","aria-label":"More Actions...",onClick:Bs,children:u.jsx(hr,{actions:i,popperOptions:Nv})})]})}var Av=5e3;function Rv(n){var{openObject:e,objects:t}=n,[r,i]=h.useState(""),o=h.useRef(null),s=pu(()=>{i("")},Av),a=h.useCallback(()=>{var c;s.cancel(),(c=o.current)===null||c===void 0||c.select()},[s]),l=h.useCallback(()=>{s()},[s]),d=h.useMemo(()=>{if(t.length===0)return[];var c={menuElement:u.jsx(mr,{value:r,onChange:f=>{i(f.target.value)},className:"console-menu",ref:o})},m=r?t.filter(f=>{var{title:v}=f;return v!=null&&v.toLowerCase().includes(r.toLowerCase())}):t,p=m.map(f=>({title:f.title,action:()=>{e(f)},icon:u.jsx(sl,{type:f.type})}));return[c,...p]},[t,r,e]);return u.jsx(ne,{"aria-label":"Objects",kind:"ghost",disabled:t.length===0,onClick:Bs,tooltip:t.length===0?"No objects available":"Objects",icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ae,{mask:ks,icon:Lr,transform:"right-5 down-5"}),u.jsx(ae,{icon:Lr,transform:"right-8 down-6"})]}),children:u.jsx(hr,{actions:d,onMenuOpened:a,onMenuClosed:l,options:{initialKeyboardIndex:1},popperOptions:{placement:"bottom-end"}})})}function es(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 Ye(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?es(Object(t),!0).forEach(function(r){je(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):es(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function je(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 ze=A.module("Console"),ts={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function Hv(){return!0}function Uv(n){return u.jsx(u.Fragment,{})}class Mt extends h.PureComponent{static isErrorLevel(e){return e===fe.STDERR||e===fe.ERROR||e===fe.FATAL}static isOutputLevel(e){return e===fe.STDOUT||Mt.isErrorLevel(e)}constructor(e){super(e),je(this,"cancelListener",void 0),je(this,"consolePane",void 0),je(this,"consoleInput",void 0),je(this,"consoleHistoryScrollPane",void 0),je(this,"consoleHistoryContent",void 0),je(this,"pending",void 0),je(this,"queuedLogMessages",void 0),je(this,"resizeObserver",void 0),je(this,"processLogMessageQueue",dr(()=>{this.setState(i=>{ze.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=i;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Mt.LOG_THROTTLE)),je(this,"getObjects",sn(i=>Array.from(i.values()))),je(this,"getContextActions",sn(i=>[...i,{action:this.handleClearShortcut,shortcut:ln.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:ln.CONSOLE.FOCUS_HISTORY}])),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleHistoryResize=this.handleHistoryResize.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=O.createRef(),this.consoleInput=O.createRef(),this.consoleHistoryScrollPane=O.createRef(),this.consoleHistoryContent=O.createRef(),this.pending=new ur,this.queuedLogMessages=[],this.resizeObserver=new window.ResizeObserver(this.handleHistoryResize);var{objectMap:t,settings:r}=this.props;this.state=Ye(Ye({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},ts),r)}componentDidMount(){this.initConsoleLogging();var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions(),this.consoleHistoryScrollPane.current&&this.consoleHistoryContent.current&&(this.resizeObserver.observe(this.consoleHistoryScrollPane.current),this.resizeObserver.observe(this.consoleHistoryContent.current))}componentDidUpdate(e,t){var{props:r,state:i}=this;this.sendSettingsChange(t,i),r.objectMap!==e.objectMap&&this.updateObjectMap(),i.isStuckToBottom&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}componentWillUnmount(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging(),this.resizeObserver.disconnect()}initConsoleLogging(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}isAtBottom(){if(this.consoleHistoryScrollPane.current==null)return!1;var{scrollHeight:e,clientHeight:t,scrollTop:r}=this.consoleHistoryScrollPane.current;return Math.abs(e-t-r)<=1}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:r}=e.detail,i=this.pending.add(r),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{r.cancel()},wrappedResult:i},{commandHistoryStorage:s,language:a,scope:l}=this.props,d=s.addItem(a,l,t,{command:t,startTime:new Date().toJSON()});d.catch(c=>{ze.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom()}),i.then(c=>{this.handleCommandResult(c,o,d)}).catch(c=>{this.handleCommandError(c,o,d)})}handleCommandResult(e,t,r){var i,o,s=e==null||(i=e.startTimestamp)===null||i===void 0?void 0:i.asNumber(),a=e==null||(o=e.endTimestamp)===null||o===void 0?void 0:o.asNumber(),l=Ye(Ye({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result,serverStartTime:s,serverEndTime:a});this.setState(d=>{var{consoleHistory:c}=d,m=c.lastIndexOf(t);if(m<0)return ze.error("historyItem not found in consoleHistory"),null;var p=c.concat();return p[m]=l,{consoleHistory:p}}),e&&(this.scrollConsoleHistoryToBottom(),this.updateHistory(e,l),this.updateKnownObjects(l),this.updateWorkspaceHistoryItem({error:e.error,serverStartTime:s,serverEndTime:a},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(He.isCanceled(e)){ze.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),s=o.lastIndexOf(t),a=Ye({},t);return a.wrappedResult=void 0,a.cancelResult=void 0,a.endTime=Date.now(),a.result={error:e},o[s]=a,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&Mt.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};Mt.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){ze.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:r}=this.props;[...e.created,...e.updated].forEach(i=>r(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:r}=e;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.setState(i=>{var o=i.consoleHistory.concat();return{consoleHistory:o}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){ze.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,s,{consoleHistory:a}=r,l=a.lastIndexOf(e);if(l<0)return ze.error("historyItem not found in state.consoleHistory"),null;var d=new Map(r.objectHistoryMap),c=new Map(r.objectMap),m=function(f){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:g}=f;F(g);var b=d.get(g);if(b!=null&&b>=0){var w;a===r.consoleHistory&&(a=a.concat());var C=Ye(Ye({},a[b]),{},{disabledObjects:[...(w=a[b].disabledObjects)!==null&&w!==void 0?w:[],g]});a[b]=C}d.set(g,l),v?c.delete(g):c.set(g,f)};return(i=t)===null||i===void 0||i.updated.forEach(p=>m(p)),(o=t)===null||o===void 0||o.removed.forEach(p=>m(p,!0)),(s=t)===null||s===void 0||s.created.forEach(p=>{var{title:f}=p;F(f),d.set(f,l),c.set(f,p)}),{objectHistoryMap:d,objectMap:c,consoleHistory:a}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(o=>{var s=Ye(Ye({},o),{},{data:Ye(Ye({},o.data),{},{endTime:i,result:e})}),{commandHistoryStorage:a,language:l}=this.props;a.updateItem(l,s).catch(d=>{ze.warn("Error updating command history storage",d)})}).catch(o=>{ze.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=this.consoleHistoryScrollPane.current;e!=null&&window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight,behavior:"instant"})})}handleScrollPaneScroll(e){ze.debug("handleScrollPaneScroll",e);var t=this.consoleHistoryScrollPane.current;F(t),this.setState({isScrollDecorationShown:t.scrollTop>0&&t.scrollHeight>t.clientHeight,isStuckToBottom:this.isAtBottom()})}handleHistoryResize(e){ze.debug("handleHistoryResize",e);var t=e[0];if(t.contentRect.height>0&&t.contentRect.width>0){var{isStuckToBottom:r}=this.state;r&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")){e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});var{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:Te.MULTIPLE_FILE_ERROR});return}var r=t[0];Te.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:Te.FILE_TYPE_ERROR})}}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){var{dh:t,openObject:r,commandHistoryStorage:i,language:o,scope:s}=this.props,{consoleHistory:a,objectMap:l}=this.state,d={name:e,title:e,type:t.VariableType.TABLE},c=l.has(e),m={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[c?"updated":"created"]:[d]}}},p=a.concat(m);this.setState({consoleHistory:p}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(m),r({name:e,type:t.VariableType.TABLE}),i.addItem(o,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:r}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=r.concat(i);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:r}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:oe.groups.high,icon:r?Er:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:oe.groups.high,icon:e?Er:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:oe.groups.high,icon:t?Er:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:oe.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var{session:t}=this.props;t.runCode(e).catch(i=>{ze.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(),this.setState(i=>({consoleHistory:i.consoleHistory.concat(r)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(r=>[r,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,r),t&&this.scrollConsoleHistoryToBottom())}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(ts),o={},s=!1,a=0;a<i.length;a+=1){var l=i[a],{[l]:d}=t,{[l]:c}=e;d!==c&&(s=!0),o[l]=d}if(!(r&&!s)){var{onSettingsChange:m}=this.props;m(o)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var{actions:e,dh:t,historyChildren:r,language:i,statusBarChildren:o,openObject:s,session:a,scope:l,commandHistoryStorage:d,timeZone:c,disabled:m,unzip:p,supportsType:f,iconForType:v,showObjectsMenu:g}=this.props,{consoleHeight:b,consoleHistory:w,isScrollDecorationShown:C,objectMap:y,showCsvOverlay:I,csvFile:X,csvPaste:Q,dragError:z,csvUploadInProgress:j}=this.state,N=this.getObjects(y),G=Math.round(b*.7),H=this.getContextActions(e);return u.jsxs("div",{role:"presentation",className:R("iris-console","h-100","w-100",{disabled:m}),children:[u.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[u.jsxs(Lv,{dh:t,session:a,overflowActions:this.handleOverflowActions,children:[o,g===!0&&u.jsx(Rv,{openObject:s,objects:N})]}),u.jsxs("div",{className:"console-csv-container",onDragOver:Te.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[I&&u.jsx(Te,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:z,onError:this.handleCsvError,uploadInProgress:j,allowZip:p!=null}),u.jsxs("div",{role:"presentation",className:R("scroll-pane no-scroll-x",{"scroll-decoration":C}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[u.jsx(Pf,{items:w,openObject:s,language:i,disabled:m,supportsType:f,iconForType:v,ref:this.consoleHistoryContent,onCommandSubmit:this.handleCommandSubmit}),r]})]}),!I&&u.jsx(hn,{ref:this.consoleInput,session:a,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:G,commandHistoryStorage:d}),I&&u.jsx(bl,{session:a,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:X??void 0,paste:Q??void 0,onInProgress:this.handleCsvInProgress,timeZone:c,unzip:p})]}),u.jsx(oe,{actions:H,ignoreClassNames:[hn.INPUT_CLASS_NAME]})]})}}je(Mt,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:Hv,iconForType:Uv,showObjectsMenu:!0});je(Mt,"LOG_THROTTLE",500);function Cn(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=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)}var Wv=250,zv=2500;class yl extends h.Component{constructor(e){super(e),Cn(this,"timer",void 0),Cn(this,"cleanup",void 0),Cn(this,"loadData",xn(()=>{var{commandHistoryStorage:t,item:r,language:i}=this.props,{id:o}=r;this.cleanup=t.listenItem(i,o,this.handleUpdate,this.handleError)},Wv)),Cn(this,"getPreviewText",en(t=>t.split(`
14
- `,zv).join(`
15
- `),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var r,{data:i}=this.state;this.timer==null&&!(i!=null&&i.result)&&(i!=null&&i.startTime)&&!(i==null||i.endTime===void 0)?this.startTimer():(i!=null&&i.result&&!((r=t.data)!==null&&r!==void 0&&r.result)||i!=null&&i.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=window.setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer!=null&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var{data:t}=e??{};this.setState({data:t});var{onUpdate:r}=this.props;r==null||r(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:r}=this.props,{currentTime:i,data:o,error:s}=this.state,{result:a,startTime:l,endTime:d}=o??{},c=(e=a==null?void 0:a.error)!==null&&e!==void 0?e:s,m=xe.formatConvertedDuration(l,d??i),p=this.getPreviewText(t),f=!!m;return u.jsxs("div",{className:"command-history-item-tooltip",children:[u.jsxs("div",{className:"scroll-container",children:[u.jsx(al,{language:r,children:p}),p.length<t.length&&u.jsx("p",{children:"Preview Truncated..."})]}),u.jsxs("div",{className:"result-info",children:[u.jsxs("div",{className:"d-flex justify-content-between",children:[!!c&&u.jsxs("div",{className:"text-danger mr-1",children:[u.jsx(ae,{icon:Ls})," Executed with errors"]}),u.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",f?u.jsx("span",{className:"time-string",children:m}):u.jsx(Ns,{className:"loading-spinner-vertical-align"})]})]}),!!c&&u.jsx("div",{className:"error-message",children:c})]})]})}}Cn(yl,"defaultProps",{onUpdate:()=>{}});var Vv=512;function Gv(n){var{item:e,language:t,isSelected:r=!1,commandHistoryStorage:i}=n,o=e.name.substring(0,Vv),s=h.useRef(null),a=h.useCallback(()=>{var l;(l=s.current)===null||l===void 0||l.update()},[s]);return u.jsxs("div",{className:R("command-history-item",{selected:r}),children:[o,u.jsx(ie,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:u.jsx(yl,{item:e,language:t,onUpdate:a,commandHistoryStorage:i})})]})}class ar extends h.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ae,{icon:Ql,mask:e.icon,transform:"right-5 down-5 shrink-4"}),u.jsx(ae,{icon:Ds,transform:"shrink-3 right-7 down-6"})]}):u.jsx(ae,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return u.jsx("div",{className:"command-history-actions",children:e.map((r,i)=>u.jsx(ne,{kind:"inline",className:R(r.className),onClick:r.action,tooltip:r.description,disabled:r.selectionRequired!==void 0&&r.selectionRequired&&!t,icon:ar.renderContent(r)},ar.itemKey(i,r)))})}}var qv=150,ns=3,rs=A.module("CommandHistoryViewportUpdater");function Xv(n){var{table:e,columns:t,top:r=0,bottom:i=0,search:o,isReversed:s=!1,onUpdate:a}=n,l=h.useMemo(()=>dr(d=>{var c=d.bottom-d.top,m=Math.max(0,d.top-c*ns),p=d.bottom+c*ns;e.setViewport({top:m,bottom:p,columns:d.columns})},qv),[e]);return h.useEffect(function(){var c=e.onUpdate(m=>{var p,f;a({items:(p=m.items)!==null&&p!==void 0?p:[],offset:(f=m.offset)!==null&&f!==void 0?f:0})});return()=>{rs.debug("onUpdate cleanup"),c()}},[e,a]),h.useEffect(function(){e.setSearch(o??"")},[e,o]),h.useEffect(function(){l({top:r,bottom:i,columns:t})},[l,r,i,t,o,s]),h.useEffect(()=>()=>{rs.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function is(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function os(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){is(o,r,i,s,a,"next",l)}function a(l){is(o,r,i,s,a,"throw",l)}s(void 0)})}}function it(n,e,t){return(e=Zv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zv(n){var e=Yv(n,"string");return typeof e=="symbol"?e:e+""}function Yv(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 Pt=A.module("CommandHistory");class Ee extends h.Component{static getCommandsFromViewport(e,t,r){for(var i=[],o=0;o<r.length;o+=1)for(var s=r[o],a=s[0];a<=s[1];a+=1)if(a>=t&&a<t+e.length){var{name:l}=e[a-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return os(function*(){var r=yield e.getSnapshot(t);return[...r.values()].map(i=>i.name)})()}constructor(e){super(e),it(this,"itemActions",void 0),it(this,"historyActions",void 0),it(this,"pending",void 0),it(this,"searchInputRef",void 0),it(this,"itemListRef",void 0),it(this,"debouncedSearchChange",xn(()=>{this.setState(r=>{var{searchText:i}=r;return{debouncedSearchText:i,selectedRanges:[]}})},Ee.SET_SEARCH_DEBOUNCE_MS)),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:ed,shortcut:rn.COPY,action:this.copySelectedCommands,group:oe.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Ei,shortcut:ln.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Ee.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:td,shortcut:ln.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Ee.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Pi,shortcut:ln.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Ee.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:As,action:this.createNotebook,group:Ee.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Ei,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Pi,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new ur,this.searchInputRef=O.createRef(),this.itemListRef=O.createRef();var{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:"",debouncedSearchText:""}}componentWillUnmount(){this.debouncedSearchChange.cancel(),this.pending.cancel()}getSelectedCommands(){var e=this;return os(function*(){var{items:t,offset:r,selectedRanges:i}=e.state,o=i.slice().sort((a,l)=>a[0]-l[0]);if(o.length===0)return[];if(o[0][0]>=r&&o[o.length-1][1]<r+t.length)return Ee.getCommandsFromViewport(t,r,o);var{table:s}=e.props;return e.pending.add(Ee.getCommandsFromSnapshot(s,o))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
16
- `))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<Ee.MAX_SELECTION_COUNT?(Pt.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Pt.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(zs).catch(Pt.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t},!0)}).catch(Pt.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t})}).catch(Pt.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(Pt.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(Pt.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:r,offset:i}=this.state;if(e<i||e>=i+r.length){Pt.error("Invalid index!",e);return}var{name:o}=r[e-i];t(o)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value}),this.debouncedSearchChange()}handleViewportUpdate(e){var{items:t,offset:r}=e,{table:i}=this.props,o=i.size;this.setState({items:t,itemCount:o,offset:r})}renderItem(e){var{item:t,itemIndex:r,isSelected:i}=e,{language:o,commandHistoryStorage:s}=this.props;return u.jsx(Gv,{isSelected:i,item:t,language:o,commandHistoryStorage:s})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:r}=this.props,{actions:i,historyActions:o,searchText:s,debouncedSearchText:a,top:l,bottom:d,items:c,itemCount:m,offset:p,selectedRanges:f}=this.state,v=(e=ll.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return u.jsxs("div",{className:"command-history",children:[u.jsxs("div",{className:"command-history-search-bar",children:[u.jsx(mr,{ref:this.searchInputRef,value:s,placeholder:"".concat(v," Command History"),onChange:this.handleSearchChange}),u.jsx(ar,{actions:o,hasSelection:f.length>0})]}),u.jsxs("div",{className:"command-history-list",children:[u.jsx(tt,{ref:this.itemListRef,itemCount:m,items:c,offset:p,selectedRanges:f,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Ee.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),u.jsx(Xv,{table:r,top:l,bottom:d,search:a,onUpdate:this.handleViewportUpdate}),u.jsx(oe,{actions:i})]})]})}}it(Ee,"ITEM_HEIGHT",29);it(Ee,"MAX_SELECTION_COUNT",1e4);it(Ee,"SET_SEARCH_DEBOUNCE_MS",150);it(Ee,"menuGroups",{send:oe.groups.medium+100});class Jv extends h.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){var{logLevel:e,onClick:t}=this.props;t(e)}render(){var{logLevel:e,on:t}=this.props;return u.jsxs("div",{className:R("log-level-menu-item",e),children:[u.jsx(kc,{on:t,onClick:this.handleSwitchClick}),e]})}}function ss(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 as(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ss(Object(t),!0).forEach(function(r){Re(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ss(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Re(n,e,t){return(e=Qv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qv(n){var e=eg(n,"string");return typeof e=="symbol"?e:e+""}function eg(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 ue extends h.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),r=or.formatTimestamp(t);return"".concat(r," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),Re(this,"cancelListener",void 0),Re(this,"editor",void 0),Re(this,"editorContainer",void 0),Re(this,"logLevelMenuItems",void 0),Re(this,"flushTimer",void 0),Re(this,"bufferedMessages",void 0),Re(this,"messages",void 0),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();var{shownLogLevels:r}=this.state;t.shownLogLevels!==r&&this.refreshLogText();var{session:i}=this.props;e.session!==i&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){var t=this,r=[];r.push({menuElement:u.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var a=ue.AllLogLevels[o],l=e[a]!=null?e[a]:!1;r.push({title:a,group:1,order:o+100,menuElement:u.jsx(Jv,{logLevel:a,on:l,onClick:t.handleMenuItemClick,ref:d=>{d!=null&&(t.logLevelMenuItems[a]=d)}})})},o=0;o<ue.AllLogLevels.length;o+=1)i();return r.push({group:1,order:1e3,menuElement:u.jsxs("div",{className:"log-level-menu-controls",children:[u.jsx(ne,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),u.jsx(ne,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),r}resetLogLevels(){for(var e={},t=function(){var o=ue.AllLogLevels[r],s=ue.DefaultLogLevels.some(a=>a===o);e[o]=s},r=0;r<ue.AllLogLevels.length;r+=1)t();this.setState({shownLogLevels:e})}startListening(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){F(this.editorContainer),this.editor=Pe.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),[[Kt.Escape],[Ve.Shift|Kt.Escape]].forEach(e=>{F(this.editor),ye.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[Kt.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,r,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();F(i),(r=this.editor)===null||r===void 0||r.setPosition(i)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,r=0;r<ue.AllLogLevels.length;r+=1){var i=ue.AllLogLevels[r];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var o={},s=0;s<ue.AllLogLevels.length;s+=1){var a=ue.AllLogLevels[s];o[a]=!0}this.setState({shownLogLevels:o})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,r=t[e],i={};i[e]=!r,this.updateLogLevels(i)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=as(as({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),r=t==null?void 0:t.getLineCount();F(r);var i=t==null?void 0:t.getLineLength(r);F(i);var o=this.isBottomVisible(),s=[];if(i>0&&(s.push({range:{startLineNumber:r,startColumn:i+1,endLineNumber:r,endColumn:i+1},text:`
17
- `,forceMoveMarkers:!0}),r+=1,i=0),s.push({range:{startLineNumber:r,startColumn:i,endLineNumber:r,endColumn:i},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(s),o){var a=t==null?void 0:t.getLineCount();F(a),this.editor.revealLine(a,1)}}}refreshLogText(){if(this.editor){this.truncateLogIfNecessary();for(var{shownLogLevels:e}=this.state,t=this.isBottomVisible(),r="",i=0;i<this.messages.length;i+=1){var o=this.messages[i];if(e[o.logLevel]){var s=ue.getLogText(o);s.length>0&&(r+=s,s.charAt(s.length-1)!==`
18
- `&&(r+=`
19
- `))}}if(r=r.trimRight(),this.editor.setValue(r),t){var a,l=(a=this.editor.getModel())===null||a===void 0?void 0:a.getLineCount();F(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>ue.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-ue.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();F(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 F(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=ue.getLogText(r);e+=i,i.charAt(i.length-1)!==`
20
- `&&(e+=`
21
- `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ue.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 u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(ne,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:nd,tooltip:"Clear log"}),u.jsx(ne,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:rd,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(hr,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}Re(ue,"DefaultLogLevels",[fe.STDOUT,fe.ERROR,fe.FATAL,fe.STDERR,fe.WARN]);Re(ue,"AllLogLevels",[fe.INFO,fe.STDOUT,fe.ERROR,fe.FATAL,fe.STDERR,fe.WARN,fe.DEBUG,fe.TRACE]);Re(ue,"bufferTimeout",16);Re(ue,"maxLogSize",131072);Re(ue,"truncateSize",65536);function ls(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function tg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){ls(o,r,i,s,a,"next",l)}function a(l){ls(o,r,i,s,a,"throw",l)}s(void 0)})}}var ng=A.module("HeapUsage");function rg(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:s}=n,a=mf(),[l,d]=h.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,m]=h.useState(!1),p=h.useRef({timestamps:[],usages:[]}),f=qs(),v=h.useCallback(tg(function*(){try{var L=yield t.getWorkerHeapInfo();if(!f.current)return;if(d(L),o||c){for(var $=(L.totalHeapSize-L.freeMemory)/L.maximumHeapSize,U=Date.now(),{timestamps:he,usages:Ue}=p.current;he.length!==0&&U-he[0]>s*1.5;)he.shift(),Ue.shift();he.push(U),Ue.push($)}else p.current={timestamps:[],usages:[]}}catch(x){ng.warn("Unable to get heap usage",x)}}),[t,f,o,c,s]);mu(v,c?i:r);var g=(L,$)=>Math.round(L*10**$)/10**$,b=2,w=1024**3,{freeMemory:C,totalHeapSize:y,maximumHeapSize:I}=l,X=g(C/w,b),Q=g(y/w,b),z=g(I/w,b),j=Q-X,N=function($,U){var he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:R("heap-usage-info-row",{"heading-bottom-border":he}),children:[u.jsx("div",{className:"font-weight-bold",children:$}),u.jsx("div",{children:U})]})},{timestamps:G,usages:H}=p.current,M=(e=G[G.length-1])!==null&&e!==void 0?e:0,K=y/I,W=(y-C)/I;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(K*100,"% - ").concat(K*2,"px")}}),u.jsx("div",{className:R("used-memory",{"heap-overflow":(y-C)/I>.95}),style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[z.toFixed(1)," GB"]}),u.jsx(ie,{onEntered:()=>m(!0),onExited:()=>m(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[N("In use:","".concat(j.toFixed(b)," of ").concat(z.toFixed(b)," GB"),!0),N("Free:","".concat(X.toFixed(b)," GB")),N("Total:","".concat(Q.toFixed(b)," GB")),N("Max:","".concat(z.toFixed(b)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(hf,{data:[{x:[...G],y:[...H],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(s/6),gridcolor:a.linecolor,range:[M-s,M],linecolor:a.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:a.linecolor,range:[0,1],linecolor:a.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}function Ln(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 Xe{}Ln(Xe,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Ln(Xe,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Ln(Xe,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Ln(Xe,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Ln(Xe,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function Lt(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=ag(n,"string");return typeof e=="symbol"?e:e+""}function ag(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 st{}Lt(st,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Lt(st,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Lt(st,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Lt(st,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Lt(st,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Lt(st,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Lt(st,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Lt(st,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");function yt(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=dg(n,"string");return typeof e=="symbol"?e:e+""}function dg(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 Oe{}yt(Oe,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");yt(Oe,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");yt(Oe,"CLOSE_FILE","NotebookEvent.closeFile");yt(Oe,"RENAME","NotebookEvent.rename");yt(Oe,"RENAME_FILE","NotebookEvent.renameFile");yt(Oe,"REGISTER_FILE","NotebookEvent.registerFile");yt(Oe,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");yt(Oe,"UNREGISTER_FILE","NotebookEvent.unregisterFile");yt(Oe,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var bi=lt(Xe.SESSION_OPENED),ug=bi.listen,fy=bi.emit,vy=bi.useListener,yi=lt(Xe.SESSION_CLOSED),cg=yi.listen,gy=yi.emit,by=yi.useListener,hg=["children"];function ds(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 us(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ds(Object(t),!0).forEach(function(r){ti(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ds(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mg(n,e){if(n==null)return{};var t,r,i=pg(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 pg(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 ti(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=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 gg extends h.PureComponent{constructor(e){super(e),ti(this,"stopListenForSessionClosed",void 0),ti(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=cg(e,this.handleSessionClosed),this.stopListenForSessionOpened=ug(e,this.handleSessionOpened),e.on(st.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(st.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=mg(e,hg);return u.jsx(Qp,us(us({},r),{},{children:t}))}}var br=ha(gg),bg=Object.freeze({}),yg=new Map,yr=Object.freeze([]),yy=(n,e)=>{var t;return(t=Ce(n,e).columns)!==null&&t!==void 0?t:yr},Cy=(n,e)=>{var t;return(t=Ce(n,e).filterSets)!==null&&t!==void 0?t:yr},wy=(n,e)=>{var t;return(t=Ce(n,e).filters)!==null&&t!==void 0?t:yr},Sy=(n,e)=>{var t;return(t=Ce(n,e).tableMap)!==null&&t!==void 0?t:yg},_y=(n,e)=>Ce(n,e).isolatedLinkerPanelId,Ey=(n,e)=>{var t;return(t=Ce(n,e).links)!==null&&t!==void 0?t:yr},Py=(n,e)=>Ce(n,e).columnSelectionValidator,Ty=(n,e)=>{var t;return(t=Ce(n,e).consoleSettings)!==null&&t!==void 0?t:bg},Oy=(n,e)=>Ce(n,e).connection,Cr=(n,e)=>Ce(n,e).sessionWrapper;function lr(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=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 qn=A.module("CommandHistoryPanel");class An extends h.Component{static handleError(e){qn.error(e)}constructor(e){super(e),lr(this,"container",void 0),lr(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=O.createRef(),this.pending=new ur;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:ln.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Xe.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Xe.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(qn.debug("handleSendToNotebook",r,e),!r){qn.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?Oe.CREATE_NOTEBOOK:Oe.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;qn.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Xe.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;F(t),F(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(An.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:s}=this.state;return u.jsxs(br,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!s&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),s&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(Ee,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:r}),u.jsx(oe,{actions:o})]})]})}}lr(An,"COMPONENT","CommandHistoryPanel");lr(An,"TITLE","Command History");var Sg=(n,e)=>{var t=ga(n),r=Cr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:s,id:a}=o??{};return{commandHistoryStorage:t,language:s,session:i,sessionId:a}},xy=In(Sg,null,null,{forwardRef:!0})(An);function cs(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 Xn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cs(Object(t),!0).forEach(function(r){zt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):cs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zt(n,e,t){return(e=_g(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _g(n){var e=Eg(n,"string");return typeof e=="symbol"?e:e+""}function Eg(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 Zn=A.module("ConsolePanel"),Pg=500,Tg=Object.freeze({consoleSettings:{},itemIds:[]});class wr extends h.PureComponent{constructor(e){super(e),zt(this,"consoleRef",void 0),zt(this,"objectSubscriptionCleanup",void 0),zt(this,"savePanelState",xn(()=>{var{consoleSettings:s,itemIds:a}=this.state,l={consoleSettings:s,itemIds:[...a]};Zn.debug("Saving panel state",l),this.setState({panelState:l})},Pg)),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=O.createRef();var{panelState:t}=e,r=Xn(Xn({},Tg),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(J.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(J.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=>{Zn.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:s,created:a,removed:l}=r,d=[...s,...l],c=new Map(o);d.forEach(p=>{var{title:f}=p;f!==void 0&&c.delete(f)});var m=[...s,...a];return m.forEach(p=>{p.title!==void 0&&c.set(p.title,p)}),{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=ft(),this.setItemId(e,i)),i}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,s=e==null||(r=e.props)===null||r===void 0||(r=r.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&s){var a=new Set(i.values());a.has(s)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Xe.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;F(this.context);var{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&P.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;i.emit(J.CLOSE,r),Up(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Zn.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Xe.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;F(r);var{config:i,session:o}=r,{title:s=e.name}=e;F(s);var a=this.getItemId(s),l={fetch:()=>o.getObject(e),panelId:a,widget:Xn(Xn({},zc(e)),{},{sessionId:i.id})};Zn.debug("openWidget",l),tp(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:s}=this.props;o.forEach(a=>{s.emit(J.CLOSE,a)}),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=>po(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>po(i,e));return r!=null?Kh(r):u.jsx(sl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:s}=this.props;if(i==null)return u.jsx(On,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:a,error:l,objectMap:d}=this.state,{config:c,session:m,connection:p,details:f={},dh:v}=i,{workerName:g,processInfoId:b}=f,{id:w,type:C}=c;return u.jsx(br,{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:m!=null&&u.jsx(Mt,{dh:v,ref:this.consoleRef,settings:a,session:m,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:C,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:ll.LANGUAGE_MAP.get(C)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),b!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),b,u.jsx("div",{children:"•"})]}),u.jsx(rg,{connection:p,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:w,timeZone:o,objectMap:d,unzip:s,supportsType:this.supportsType,iconForType:this.iconForType})})}}zt(wr,"COMPONENT","ConsolePanel");zt(wr,"TITLE","Console");zt(wr,"contextType",qa);var Og=(n,e)=>({commandHistoryStorage:ga(n),sessionWrapper:Cr(n,e.localDashboardId),timeZone:Zc(n),plugins:Yc(n)}),Iy=In(Og,null,null,{forwardRef:!0})(wr);function Dy(n){return n==="file"||n==="directory"}function et(n){return n.type==="directory"}function xg(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=Dg(n,"string");return typeof e=="symbol"?e:e+""}function Dg(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 Ci extends Error{constructor(){super("No file exists at the path specified"),xg(this,"isFileNotFound",!0)}}function hs(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function ms(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){hs(o,r,i,s,a,"next",l)}function a(l){hs(o,r,i,s,a,"throw",l)}s(void 0)})}}var Ht=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 k{static fileExists(e,t){return ms(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Ci))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(!k.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 ms(function*(){for(var r=k.getCopyFileName(t);yield k.fileExists(e,r);)r=k.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return Ht.GROOVY;case"py":return Ht.PYTHON;case"pyc":return Ht.PYTHON_COMPILED;case"scala":return Ht.SCALA;case"txt":return Ht.PLAIN_TEXT;default:return Ht.UNKNOWN}}static getParent(e){if(!k.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!k.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=k.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Sn("Name cannot be empty");if(t.includes(e))throw new Sn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,s;throw new Sn('Invalid characters in name: "'.concat((o=(s=e.match(r))===null||s===void 0?void 0:s.reduce((a,l)=>a.includes(l)?a:[...a,l],[]).map(a=>i.has(a)?i.get(a):a).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>k.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 wi=26;function ni(n){return et(n)?k.makePath(n.filename):k.getPath(n.filename)}function ps(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=ni(e);if(n.some(r=>{var{filename:i}=r;return k.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>et(r)&&t.startsWith(k.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Mg(n){if(et(n))return n.isExpanded?id:od;var e=k.getMimeType(n.basename);switch(e){case Ht.PYTHON:return ad;default:return sd}}function ri(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:s,item:a,itemIndex:l,dropTargetItem:d,onDragStart:c,onDragOver:m,onDragEnd:p,onDragExit:f,onDrop:v}=n,g=(e=r==null?void 0:r.some(j=>j.id===a.id))!==null&&e!==void 0?e:!1,b=ni(a),w=i&&d?ni(d):null,C=i&&o&&et(a)&&w===b,y=i&&o&&w===b,I=i&&!o&&w===b,X=Mg(a),Q=k.getDepth(a.filename),z=Array(Q).fill(null).map((j,N)=>u.jsx("span",{className:"file-list-depth-line"},N));return u.jsxs("div",{className:R("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":C,"is-in-drop-target":y,"is-invalid-drop-target":I,"is-selected":s}),onDragStart:j=>c(l,j),onDragOver:j=>m(l,j),onDragEnd:j=>p(l,j),onDragExit:f,onDrop:j=>v(l,j),draggable:!0,role:"presentation","aria-label":a.basename,children:[z," ",u.jsx(ae,{icon:X,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[a.basename,u.jsx(ie,{children:a.basename})]})})]})}function fs(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 Yn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fs(Object(t),!0).forEach(function(r){jg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jg(n,e,t){return(e=kg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kg(n){var e=Ng(n,"string");return typeof e=="symbol"?e:e+""}function Ng(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=A.module("FileList"),Lg=500,vs="item-list-scroll-pane";function Ag(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:s=()=>{},renderItem:a=ri,rowHeight:l=wi,overscanCount:d=tt.DEFAULT_OVERSCAN}=n,[c,m]=h.useState(()=>({items:[],offset:0,itemCount:0})),[p,f]=h.useState({top:0,bottom:0}),[v,g]=h.useState(),[b,w]=h.useState(),[C,y]=h.useState(),[I,X]=h.useState([]),Q=h.useRef(),z=h.useRef(null),j=h.useRef(null),N=h.useCallback(E=>{if(E.length===0||c==null)return[];for(var V=[],te=0;te<E.length;te+=1)for(var ge=E[te],Ne=ge[0];Ne<=ge[1];Ne+=1)Ne>=c.offset&&Ne<c.offset+c.items.length&&V.push(c.items[Ne-c.offset]);return V},[c]),G=h.useCallback(E=>{var V=N([[E,E]]);if(V.length>0)return V[0]},[N]),H=h.useCallback(()=>{var E=Je.count(I);if(E===0)return null;if(E===1){var V=I[0][0],te=G(V);if(te!=null)return te.filename}return"".concat(E," items")},[G,I]),M=h.useCallback(E=>{if(!(!b||!v)){we.debug("dropItems",b,"to",E);try{var{files:V,targetPath:te}=ps(b,v);if(i==null||i(V,te),E!=null){var ge;X([[E,E]]),(ge=z.current)===null||ge===void 0||ge.focusItem(E)}}catch(Ne){we.error("Unable to complete move",Ne)}}},[b,v,i]),K=h.useCallback((E,V)=>{var te=c.items[E-c.offset];te!==void 0&&(we.debug("handleItemClick",te),o(te,V),et(te)&&(t==null||t.setExpanded(te.filename,!te.isExpanded)))},[c,o,t]),W=h.useCallback((E,V)=>{var te,ge;we.debug2("handleItemDragStart",E,I);var Ne=I;Je.isSelected(I,E)||(Ne=[[E,E]],X(Ne)),w(N(Ne)),(te=z.current)===null||te===void 0||te.resetMouseState();var wt=document.createElement("div"),Xt=document.createElement("div");Xt.className="dnd-placeholder-content",Xt.innerText=(ge=H())!==null&&ge!==void 0?ge:"",wt.appendChild(Xt),wt.className="file-list-dnd-placeholder",document.body.appendChild(wt),V.dataTransfer.setDragImage(wt,0,0),V.dataTransfer.effectAllowed="move",y(wt)},[H,N,I]),L=h.useCallback((E,V)=>{V.preventDefault(),we.debug2("handleItemDragOver",V),g(G(E))},[G]),$=h.useCallback((E,V)=>{we.debug("handleItemDragEnd",E),C==null||C.remove(),w(void 0),g(void 0),y(void 0)},[C]),U=h.useCallback((E,V)=>{M(E)},[M]),he=h.useCallback(()=>{we.debug2("handleItemDragExit"),g(void 0)},[]),Ue=h.useCallback(E=>{E.target instanceof Element&&E.target.classList.contains(vs)&&(E.preventDefault(),we.debug2("handleListDragOver",E),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),x=h.useCallback(E=>{E.target instanceof Element&&E.target.classList.contains(vs)&&(we.debug("handleListDrop"),M())},[M]),q=h.useCallback(function(E){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(we.debug2("handleSelectionChange",E),V===!0||E!==I){X(E);var te=N(E);s(te)}},[N,s,I]),ee=h.useCallback(E=>{if(we.debug2("handleFocusChange",E),E!=null){var[V]=N([[E,E]]);r(V)}else r();Q.current=E},[N,r]),Rn=h.useCallback((E,V)=>{we.debug("handleViewportChange",E,V),(E!==p.top||V!==p.bottom)&&f({top:E,bottom:V})},[p]),vn=h.useMemo(()=>{if(!b||!v)return!1;try{return ps(b,v),we.debug("handleValidateDropTarget true"),!0}catch{return we.debug("handleValidateDropTarget false"),!1}},[b,v]),{focusedPath:Ct}=n;h.useEffect(()=>{Ct!==void 0&&(Ct==="/"?t.collapseAll():(t.setExpanded(Ct,!1),t.setExpanded(Ct,!0)))},[t,Ct]),h.useEffect(function(){we.debug("updating table viewport",p),t==null||t.setViewport({top:Math.max(0,p.top-d),bottom:p.bottom+d})},[d,t,p]),h.useEffect(function(){var V=t.onUpdate(te=>{m({items:te.items.map(ge=>Yn(Yn({},ge),{},{itemName:ge.basename})),offset:te.offset,itemCount:t.size})});return()=>{V()}},[t]),h.useEffect(function(){Q.current!=null&&ee(Q.current),I.length>0&&q(I,!0)},[c,ee,q,I]),h.useEffect(function(){if(v!=null&&et(v)&&v.filename!=="/"){var V=setTimeout(()=>{v.isExpanded||t==null||t.setExpanded(v.filename,!0)},Lg);return()=>clearTimeout(V)}},[v,t]);var _r=h.useCallback(E=>a(Yn(Yn({},E),{},{isDragInProgress:b!=null,dropTargetItem:v,draggedItems:b,isDropTargetValid:vn,onDragStart:W,onDragEnd:$,onDragOver:L,onDragExit:he,onDrop:U})),[$,he,L,W,U,b,v,vn,a]);return u.jsx("div",{ref:j,className:R("file-list",{"is-dragging":b!=null}),onDragOver:Ue,onDrop:x,children:u.jsx(tt,{ref:z,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:ee,onSelect:K,onSelectionChange:q,onViewportChange:Rn,selectedRanges:I,renderItem:_r,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Rg={DELETE:re.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[S.DELETE],macShortcut:[_.CMD,S.BACKSPACE]}),RENAME:re.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[S.ENTER],macShortcut:[S.ENTER]})};const gs={FILE_EXPLORER:Rg};var bs=A.module("FileListItemEditor"),Fg=()=>Promise.resolve();function $g(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Fg}=n,o=h.useRef(null),[s,a]=h.useState(e.basename),[l,d]=h.useState(),[c,m]=h.useState(Promise.resolve()),p=h.useCallback(()=>{var C;(C=o.current)===null||C===void 0||C.focus()},[o]),f=h.useCallback(C=>C.stopPropagation(),[]),v=h.useCallback(()=>{c.then(()=>{r(s)}).catch(C=>bs.info("Unable to validate name",C))},[r,s,c]);h.useEffect(function(){var y=He.makeCancelable(i(s));return y.then(()=>d(void 0)).catch(I=>{He.isCanceled(I)||d(I)}),m(y),()=>y.cancel()},[i,s]),h.useEffect(function(){p()},[p]);var g=h.useCallback(()=>{bs.debug2("handleBlur"),v()},[v]),b=h.useCallback(C=>{var{value:y}=C.target;a(y)},[]),w=h.useCallback(C=>{C.stopPropagation();var{key:y}=C;switch(y){case"Enter":{v();break}case"Escape":{t();break}}},[t,v]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:R("form-control file-list-item-editor-input",{"is-invalid":l}),value:s,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function ys(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 Nr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ys(Object(t),!0).forEach(function(r){Hg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ys(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Hg(n,e,t){return(e=Ug(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ug(n){var e=Bg(n,"string");return typeof e=="symbol"?e:e+""}function Bg(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 Cl(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:s,onDelete:a,onMove:l,onRename:d,onSelect:c,onSelectionChange:m,table:p,rowHeight:f=wi,validateRename:v=()=>Promise.resolve()}=n,[g,b]=h.useState(),[w,C]=h.useState([]),[y,I]=h.useState(),X=h.useCallback(U=>{C(U),m==null||m(U)},[m]),Q=h.useCallback(U=>{I(U)},[]),z=h.useCallback(()=>{y&&(s==null||s(y))},[y,s]),j=h.useCallback(()=>{w.length>0&&(a==null||a(w))},[a,w]),N=h.useCallback(()=>{i==null||i()},[i]),G=h.useCallback(()=>{y&&(o==null||o(k.getPath(y.filename)))},[y,o]),H=h.useCallback(()=>{y&&b(y)},[y]),M=h.useCallback(()=>{b(void 0)},[]),K=h.useCallback(U=>{g&&(d==null||d(g,U),b(void 0))},[d,g]),W=h.useMemo(()=>{if(g)return[];var U=[];return i&&U.push({title:"New File",description:"Create new file",action:N,group:oe.groups.medium}),o&&U.push({title:"New Folder",description:"Create new folder",action:G,group:oe.groups.medium}),s&&U.push({title:"Copy File",description:"Copy the selected file",action:z,group:oe.groups.low,disabled:y==null||et(y)}),a&&w.length>0&&U.push({title:"Delete",description:"Delete",shortcut:gs.FILE_EXPLORER.DELETE,action:j,group:oe.groups.low}),d&&U.push({title:"Rename",description:"Rename",shortcut:gs.FILE_EXPLORER.RENAME,action:H,group:oe.groups.low,disabled:y==null}),U},[z,j,N,G,H,y,s,i,o,a,d,w,g]),L=h.useCallback(U=>(F(g),v(g,U)),[g,v]),$=h.useCallback(U=>{var{item:he}=U;return g&&g.filename===he.filename?u.jsx(ri,Nr(Nr({},U),{},{children:u.jsx($g,{item:he,validate:L,onSubmit:K,onCancel:M})})):u.jsx(ri,Nr({},U))},[M,K,g,L]);return u.jsxs("div",{className:"file-list-container",children:[p!=null&&u.jsx(Ag,{onMove:l,onSelect:c,onSelectionChange:X,onFocusChange:Q,renderItem:$,rowHeight:f,table:p,isMultiSelect:e,focusedPath:t}),r&&u.jsx(oe,{actions:W})]})}Cl.displayName="FileListContainer";function Cs(n,e,t){return(e=Kg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kg(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)}class er extends Sn{constructor(e){super("Name already exists"),Cs(this,"isExistingFile",!0),Cs(this,"info",void 0),this.info=e}}function ws(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function Ss(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){ws(o,r,i,s,a,"next",l)}function a(l){ws(o,r,i,s,a,"throw",l)}s(void 0)})}}var rt=A.module("FileExplorer");function Si(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:s=()=>{},onCreateFile:a=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:c,rowHeight:m=wi}=n,[p,f]=h.useState([]),[v,g]=h.useState();h.useEffect(function(){var K;function W(){return L.apply(this,arguments)}function L(){return L=Ss(function*(){rt.debug("initTable"),K=He.makeCancelable(e.getTable(),$=>$.close());try{g(yield K)}catch($){He.isCanceled($)||rt.error("Unable to initialize table",$)}}),L.apply(this,arguments)}return W(),()=>{K.cancel()}},[e]);var b=h.useCallback(M=>{He.isCanceled(M)||rt.error(M)},[]),w=h.useCallback(()=>{rt.debug("handleCreateFile"),a()},[a]),C=h.useCallback(()=>{rt.debug("handleCreateFolder"),l()},[l]),y=h.useCallback(M=>{rt.debug("handleCopyFile",M.filename),i(M)},[i]),I=h.useCallback(M=>{rt.debug("handleDelete, pending confirmation",M),f(M)},[]),X=h.useCallback(()=>{rt.debug("handleDeleteConfirm",p),p.forEach(M=>e.deleteFile(et(M)?k.makePath(M.filename):M.filename)),o(p),f([])},[p,o,e]),Q=h.useCallback(()=>{rt.debug("handleDeleteCancel"),f([])},[]),z=h.useCallback((M,K)=>{var W=k.reducePaths(M.map(L=>et(L)?k.makePath(L.filename):L.filename));W.forEach(L=>{var $=k.isPath(L)?"".concat(K).concat(k.getBaseName(L.substring(0,L.length-1)),"/"):"".concat(K).concat(k.getBaseName(L));e.moveFile(L,$).then(()=>{s(L,$)}).catch(b)})},[b,s,e]),j=h.useCallback((M,K)=>{var W=M.filename,L=et(M);L&&!W.endsWith("/")&&(W="".concat(W,"/"));var $="".concat(k.getParent(W)).concat(K);L&&!$.endsWith("/")&&($="".concat($,"/")),rt.debug2("handleRename",W,$),e.moveFile(W,$).catch(b),s(W,$)},[b,s,e]),N=h.useCallback(function(){var M=Ss(function*(K,W){if(W!==K.basename){k.validateName(W);var L="".concat(k.getPath(K.filename)).concat(W);try{var $=yield e.info(L);throw new er($)}catch(U){if(!(U instanceof Ci))throw U}}});return function(K,W){return M.apply(this,arguments)}}(),[e]),G=p.length>0,H=h.useMemo(()=>p.length===1?'Are you sure you want to delete "'.concat(p[0].filename,'"?'):"Are you sure you want to delete the selected files?",[p]);return u.jsxs("div",{className:"file-explorer",children:[v&&u.jsx(Cl,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:y,onCreateFolder:C,onCreateFile:w,onMove:z,onDelete:I,onRename:j,onSelect:d,onSelectionChange:c,rowHeight:m,table:v,validateRename:N}),u.jsx(Br,{isOpen:G,headerText:H,bodyText:"You cannot undo this action.",onCancel:Q,onConfirm:X,confirmButtonText:"Delete"})]})}Si.displayName="FileExplorer";function _s(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function zg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){_s(o,r,i,s,a,"next",l)}function a(l){_s(o,r,i,s,a,"throw",l)}s(void 0)})}}function Ut(n,e,t){return(e=Vg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vg(n){var e=Gg(n,"string");return typeof e=="symbol"?e:e+""}function Gg(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 Rt=A.module("NewItemModal");class dn extends h.PureComponent{static getValidationMessage(e){return e instanceof er&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){He.isCanceled(e)||Rt.error(e)}constructor(e){super(e),Ut(this,"inputRef",O.createRef()),Ut(this,"cancelableValidatePromise",void 0),Ut(this,"cancelableExistingItemPromise",void 0),Ut(this,"pending",new ur),Ut(this,"pathMap",new Map),Ut(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=k.hasPath(t)?k.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:k.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:k.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:s}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(s!==t.path||o!==t.value)&&this.updateValidationStatus(s,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=k.hasPath(e)?k.getPath(e):"/";this.setState({path:t,value:k.getBaseName(e),validationError:void 0,prevExtension:k.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=He.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return zg(function*(){k.validateName(t);var{defaultValue:o,storage:s}=i.props;if(r){var a="".concat(e).concat(t);if(a!==o)try{var l=yield s.info(a);throw new er(l)}catch(d){if(!(d instanceof Ci))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(dn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(Rt.debug("handleSelect",e),e.type==="directory")this.setState({path:k.makePath(e.filename)});else{var t=e.basename,r=k.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 Sn))throw e;Rt.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;Rt.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){Rt.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=k.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Rt.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:s,type:a}=this.props;Rt.debug("submitModal",r,i);var l=k.getExtension(i);return s&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(d=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(d=>{if(d instanceof er&&a!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw He.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(dn.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="",s=0;s<i;s+=1)o+="".concat(t[s],"/");return o+="".concat(r,"/"),u.jsxs(O.Fragment,{children:[u.jsx(ne,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ae,{icon:ld,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:s}=this.props,{isSubmitting:a,path:l,showExtensionChangeModal:d,showOverwriteModal:c,validationError:m,value:p,prevExtension:f,newExtension:v}=this.state,g=s==="directory",b=k.fileExtensionToString(f),w=k.fileExtensionToString(v),C=g?"Create":"Save",y=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Os,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(xs,{toggle:r,children:o}),u.jsx(Is,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:y}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:R("form-control",{"is-invalid":m}),value:p,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),m&&u.jsx("div",{className:"invalid-feedback",children:dn.getValidationMessage(m)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(Si,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(ea,{children:[u.jsx(ne,{kind:"secondary",onClick:r,children:"Cancel"}),u.jsx(ne,{kind:"primary",disabled:a,onClick:this.handleModalSubmit,children:C})]})]}),u.jsx(Br,{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"}),u.jsx(Br,{isOpen:d,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,'"')})]})}}Ut(dn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function qg(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(ne,{kind:"ghost",icon:As,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(ne,{kind:"ghost",icon:dd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(da,{value:i,onChange:r,placeholder:"Search by name"})})]})}function Es(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(d){return void t(d)}a.done?e(l):Promise.resolve(l).then(r,i)}function Xg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Es(o,r,i,s,a,"next",l)}function a(l){Es(o,r,i,s,a,"throw",l)}s(void 0)})}}function wl(n,e,t){return(e=Zg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zg(n){var e=Yg(n,"string");return typeof e=="symbol"?e:e+""}function Yg(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 Ft=A.module("FileExplorerPanel"),Jg=(n,e)=>{var t=qc(n),r=Cr(n,e.localDashboardId),{session:i,config:o}=r??{},s=o==null?void 0:o.type;return{fileStorage:t,language:s,session:i}},Qg=In(Jg,null,null,{forwardRef:!0});function eb(n){var e=n;return e!=null&&typeof e.button=="number"}class pn extends O.Component{static handleError(e){Ft.error(e)}static isFocusEvent(e){return eb(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:""};Ft.debug("handleCreateFile",t,r,i),e.emit(Oe.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Ft.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){Ft.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(pn.handleError)}handleCopyFile(e){var t=this;return Xg(function*(){var{fileStorage:r}=t.props;if(et(e)){Ft.error("Invalid item in handleCopyItem",e);return}var i=yield k.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(Oe.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=k.makePath(e[0].filename):t=k.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(Ft.debug("fileSelect",e),e.type!=="directory"){var r=pn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:s,language:a}=this.state,l={value:null,language:a};o.emit(Oe.SELECT_NOTEBOOK,s,a,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;Ft.debug("handleRename",e,t),r.emit(Oe.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:s}=this.state;return u.jsxs(br,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(qg,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Si,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(dn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}wl(pn,"COMPONENT","FileExplorerPanel");wl(pn,"TITLE","File Explorer");var My=Qg(pn);function Tn(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 Ps=A.module("LogPanel");class Sr extends h.PureComponent{constructor(e){super(e),Tn(this,"isBottomVisible",void 0),Tn(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;Ps.debug("Session opened",[t]),this.setState({session:t})}handleSessionClosed(e){Ps.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return u.jsxs(br,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&u.jsx(ue,{session:r,ref:i=>{this.logView=i}})]})}}Tn(Sr,"defaultProps",{session:null});Tn(Sr,"COMPONENT","LogPanel");Tn(Sr,"TITLE","Log");var rb=(n,e)=>{var t;return{session:(t=Cr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},jy=In(rb,null,null,{forwardRef:!0})(Sr);export{Bu as $,ie as A,He as B,ce as C,na as D,Dd as E,xe as F,hr as G,Qs as H,tt as I,ne as J,S as K,sa as L,_ as M,ra as N,oe as O,cr as P,mr as Q,Je as R,de as S,Ys as T,rn as U,Br as V,Cu as W,da as X,pr as Y,ea as Z,ca as _,uy as a,$b as a$,oi as a0,mb as a1,kc as a2,si as a3,pb as a4,oa as a5,ha as a6,ia as a7,wu as a8,ic as a9,qa as aA,dp as aB,J as aC,pi as aD,za as aE,el as aF,Ep as aG,Za as aH,Vn as aI,Va as aJ,Up as aK,dy as aL,Ub as aM,zb as aN,Kb as aO,Gb as aP,ey as aQ,Ce as aR,ty as aS,Ja as aT,Ga as aU,cy as aV,ly as aW,np as aX,ip as aY,rp as aZ,op as a_,tr as aa,Hc as ab,fa as ac,pa as ad,ma as ae,fb as af,vb as ag,gb as ah,pt as ai,ke as aj,vt as ak,B as al,$e as am,jb as an,P as ao,Hb as ap,ny as aq,Qp as ar,Hp as as,$p as at,ay as au,Dr as av,tl as aw,iy as ax,Xb as ay,Zb as az,yp as b,hn as b$,vp as b0,Qa as b1,_p as b2,Yb as b3,Jb as b4,Qb as b5,hy as b6,Bb as b7,Vb as b8,Wb as b9,vr as bA,po as bB,Lb as bC,fo as bD,Ab as bE,ub as bF,Di as bG,sf as bH,vi as bI,py as bJ,hf as bK,mf as bL,ye as bM,sv as bN,D as bO,Mt as bP,al as bQ,Ee as bR,ar as bS,Gv as bT,yl as bU,ll as bV,Pf as bW,hl as bX,ff as bY,cn as bZ,dl as b_,qb as ba,oy as bb,my as bc,Jt as bd,Op as be,Gh as bf,kb as bg,Nt as bh,Ca as bi,Rb as bj,Wh as bk,Nb as bl,Kh as bm,Vh as bn,Ah as bo,Nh as bp,Sa as bq,Mh as br,Dh as bs,kh as bt,jh as bu,_a as bv,Vr as bw,Lh as bx,wa as by,zr as bz,jc as c,Ty as c$,Lv as c0,or as c1,rg as c2,ue as c3,ei as c4,sl as c5,ln as c6,ai as c7,k as c8,Ci as c9,Ey as cA,lt as cB,st as cC,Db as cD,Sy as cE,wb as cF,_y as cG,wy as cH,Py as cI,ur as cJ,bb as cK,yy as cL,yb as cM,Cy as cN,Ib as cO,qc as cP,Cb as cQ,Cr as cR,Oe as cS,Xe as cT,dn as cU,et as cV,Zc as cW,_e as cX,gy as cY,fy as cZ,Oy as c_,Dy as ca,ep as cb,mi as cc,sy as cd,lh as ce,Iy as cf,jy as cg,xy as ch,My as ci,Qc as cj,Jc as ck,Eb as cl,Sb as cm,_b as cn,Pb as co,eh as cp,th as cq,nh as cr,rh as cs,gh as ct,ou as cu,lb as cv,sb as cw,Gs as cx,zs as cy,br as cz,Ob as d,cg as d0,ug as d1,by as d2,vy as d3,hb as d4,at as d5,db as d6,Pr as d7,Rd as d8,Sn as d9,tp as e,Mb as f,zc as g,Tb as h,ya as i,xb as j,cb as k,mu as l,Mn as m,yu as n,pu as o,Xs as p,qs as q,re as r,ry as s,fu as t,Wc as u,vu as v,Js as w,Bs as x,Zs as y,ab as z};
22
- //# sourceMappingURL=LogPanel-BmImrjX0.js.map