@deephaven/code-studio 1.19.0 → 1.19.1-console-types-fixes.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{AppRoot-NMo-Zlso.js → AppRoot-CNtsSRk_.js} +4 -4
- package/build/assets/{AppRoot-NMo-Zlso.js.map → AppRoot-CNtsSRk_.js.map} +1 -1
- package/build/assets/{Chart-DTLrmMQR.js → Chart-BP_eYjx7.js} +2 -2
- package/build/assets/{Chart-DTLrmMQR.js.map → Chart-BP_eYjx7.js.map} +1 -1
- package/build/assets/{ControlType-aAfFvujo.js → ControlType-qh7zzRDd.js} +16 -16
- package/build/assets/ControlType-qh7zzRDd.js.map +1 -0
- package/build/assets/{FormatterUtils-Bx4F0J3C.js → FormatterUtils-CVuXIeT9.js} +2 -2
- package/build/assets/{FormatterUtils-Bx4F0J3C.js.map → FormatterUtils-CVuXIeT9.js.map} +1 -1
- package/build/assets/{Grid-DMho49wj.js → Grid-DhZMKn96.js} +2 -2
- package/build/assets/{Grid-DMho49wj.js.map → Grid-DhZMKn96.js.map} +1 -1
- package/build/assets/{GridTokenMouseHandler-_sMp-3oP.js → GridTokenMouseHandler-BCNMiceB.js} +2 -2
- package/build/assets/{GridTokenMouseHandler-_sMp-3oP.js.map → GridTokenMouseHandler-BCNMiceB.js.map} +1 -1
- package/build/assets/{IrisGrid-BIN4MxWT.js → IrisGrid-BrtadI-X.js} +2 -2
- package/build/assets/{IrisGrid-BIN4MxWT.js.map → IrisGrid-BrtadI-X.js.map} +1 -1
- package/build/assets/{IrisGridModel-D5t8PwBh.js → IrisGridModel-DhjQE7o_.js} +3 -3
- package/build/assets/{IrisGridModel-D5t8PwBh.js.map → IrisGridModel-DhjQE7o_.js.map} +1 -1
- package/build/assets/{IrisGridShortcuts-CUFIxudN.js → IrisGridShortcuts-CH_2O4Ka.js} +2 -2
- package/build/assets/{IrisGridShortcuts-CUFIxudN.js.map → IrisGridShortcuts-CH_2O4Ka.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-CkWwnuUb.js → IrisGridThemeProvider-vIgaLOvQ.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-CkWwnuUb.js.map → IrisGridThemeProvider-vIgaLOvQ.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-DXCun5wd.js → LocalWorkspaceStorage-HmiVZU8V.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-DXCun5wd.js.map → LocalWorkspaceStorage-HmiVZU8V.js.map} +1 -1
- package/build/assets/{MarkdownEditor-C98uFJ1t.js → MarkdownEditor-BPeAvulp.js} +2 -2
- package/build/assets/{MarkdownEditor-C98uFJ1t.js.map → MarkdownEditor-BPeAvulp.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-Dri21Gmn.js → MarkdownNotebook-D-Qhu6GW.js} +2 -2
- package/build/assets/{MarkdownNotebook-Dri21Gmn.js.map → MarkdownNotebook-D-Qhu6GW.js.map} +1 -1
- package/build/assets/{MissingPartitionError-DClkHVxz.js → MissingPartitionError-tXrHwtWs.js} +2 -2
- package/build/assets/{MissingPartitionError-DClkHVxz.js.map → MissingPartitionError-tXrHwtWs.js.map} +1 -1
- package/build/assets/{MockChartModel-eKFrNG3K.js → MockChartModel-HJ0R37fP.js} +2 -2
- package/build/assets/{MockChartModel-eKFrNG3K.js.map → MockChartModel-HJ0R37fP.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-xed9z_XO.js → StyleGuideRoot-d1QdiBfa.js} +2 -2
- package/build/assets/{StyleGuideRoot-xed9z_XO.js.map → StyleGuideRoot-d1QdiBfa.js.map} +1 -1
- package/build/assets/{index-CIue_U7Z.js → index-B8a4Z0Mt.js} +2 -2
- package/build/assets/{index-CIue_U7Z.js.map → index-B8a4Z0Mt.js.map} +1 -1
- package/build/assets/{index-B5GSM_Gf.js → index-BTFzKv94.js} +6 -6
- package/build/assets/{index-B5GSM_Gf.js.map → index-BTFzKv94.js.map} +1 -1
- package/build/assets/{index-C3GY9AgD.js → index-CBmjXWjj.js} +3 -3
- package/build/assets/{index-C3GY9AgD.js.map → index-CBmjXWjj.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +31 -31
- package/build/assets/ControlType-aAfFvujo.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-B8AgOqqz.js","./Plotly-vX2C_V02.js","./plotly-x103-xtU.js","./helpers-BosuxZz1.js","./vendor-V8Io1aAM.js","./vendor-CxhKlw2o.css","./MarkdownNotebook-
|
|
2
|
-
import{r as m,a0 as gn,bA as Hr,I as d,bF as Ou,U as $,bG as vs,ac as mi,L as fs,K as q,R as Br,bH as xu,bI as Iu,M as ve,H as _t,bJ as Du,a8 as Mu,a9 as Nu,G as ps,a1 as On,bK as ku,bL as ju,bM as Lu,bN as Au,bD as Yn,bO as Ru,a6 as Fu,a5 as $u,bz as Ji,bP as Hu,bQ as Bu,ad as Yt,av as eo,bR as Gn,bS as D,bT as to,bE as ye,a3 as ji,af as gs,bU as Uu,_ as Fn}from"./vendor-V8Io1aAM.js";import{aC as bs,L as U,aZ as ys,W as Cs,$ as Wu,ai as Vu,aj as Ku,ah as zu,ar as Gu,ad as qu,aw as Xu,M as Ss,b as ws,c as Es,aK as Zu,a_ as Yu,a$ as Ps,b0 as Ts,b1 as Qu,b2 as Ju,N as bn,aA as ed,b3 as td,b4 as nd,b5 as rd,b6 as id,b7 as od,b8 as ad,b9 as sd,ba as ld,bb as ud,bc as dd,E as _s,aY as cd,aV as Os,aW as hd,a3 as xs,k as md,e as A,d as vi,bd as vd,be as fd,au as Is,bf as no,bg as pd,bh as gd,bi as bd,bj as yd,f as Ds,aO as Ms,bk as Cd,bl as Ns,bm as Mn,aU as Sd,bn as wd,H as ro,bo as ks,q as io,bp as js,bq as Ed,K as Pd,ak as Td,br as _d,C as Od,al as xd,bs as Id,bt as Dd,bu as Md,bv as Nd,bw as kd,bx as jd,by as Ld,aQ as Ad,bz as Rd,bA as Fd}from"./index-C3GY9AgD.js";import{e as De,M as $d,b as oo,l as it,R as Ls,K as rt,c as Qt,d as ao,U as Hd,_ as As}from"./monaco-DaE0jI-i.js";var Rs=Object.freeze([]),nC=new Map,Fs=()=>{};function rC(n){return Array.isArray(n)?n:[n]}function ti(){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 Bd(n,e,t){return(e=Ud(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ud(n){var e=Wd(n,"string");return typeof e=="symbol"?e:e+""}function Wd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 so extends Error{constructor(){super(...arguments),Bd(this,"isCanceled",!0)}}function Vd(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=Kd(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function Kd(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function zd(n,e,t){return(e=Gd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gd(n){var e=qd(n,"string");return typeof e=="symbol"?e:e+""}function qd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xd extends Error{constructor(){super(...arguments),zd(this,"isClipboardPermissionsDeniedError",!0)}}function Zd(n,e,t){return(e=Yd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yd(n){var e=Qd(n,"string");return typeof e=="symbol"?e:e+""}function Qd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ni extends Error{constructor(){super(...arguments),Zd(this,"isClipboardUnavailableError",!0)}}function Jd(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=tc(n,"string");return typeof e=="symbol"?e:e+""}function tc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 $s extends Error{constructor(){super(...arguments),Jd(this,"isPermissionUnsupported",!0)}}function lo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function nc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){lo(o,r,i,a,s,"next",l)}function s(l){lo(o,r,i,a,s,"throw",l)}a(void 0)})}}function uo(n){return fi.apply(this,arguments)}function fi(){return fi=nc(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new $s:t}}),fi.apply(this,arguments)}function co(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Hs(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){co(o,r,i,a,s,"next",l)}function s(l){co(o,r,i,a,s,"throw",l)}a(void 0)})}}function Bs(n){return pi.apply(this,arguments)}function pi(){return pi=Hs(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}rc(n)}),pi.apply(this,arguments)}function rc(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 iC(){return gi.apply(this,arguments)}function gi(){return gi=Hs(function*(){try{var{clipboard:n}=navigator;if(n===void 0)throw new ni;var e=yield uo("clipboard-read");if(e==="granted"){var t=yield n.readText();return t}if(e==="prompt"){try{yield n.readText()}catch{}if(e=yield uo("clipboard-read"),e==="granted"){var r=yield n.readText();return r}}if(e==="prompt"||e==="denied")throw new Xd}catch(i){throw i instanceof $s?new ni:i}throw new ni}),gi.apply(this,arguments)}var $n;function yn(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=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 ac="table_",Us="column_",sc=new Set(["in","not","i","ii","k"]),lc=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"]),uc=/[^a-zA-Z0-9_$\-+@]/g,dc=/[^A-Za-z0-9_$]/g,cc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,hc=/[^a-zA-Z0-9_]/g;function mc(n){return n.replace(/[ -]/g,"_")}function vc(n){return n.replace(/\s/g,"_")}class It{}$n=It;yn(It,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(sc.has(a)||lc.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});yn(It,"legalizeTableName",n=>$n.legalize(n,vc,ac,uc,!1,0));yn(It,"makeVariableName",n=>$n.legalizeTableName(n).replace(hc,"_"));yn(It,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=$n.legalizeColumnName(t,r);e.includes(i)&&(i=Us+r),e.push(i)}),e});yn(It,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return $n.legalize(n,mc,Us,dc,!0,e)});yn(It,"isValidTableName",n=>cc.test(n));yn(It,"isValidColumnName",n=>$n.legalizeColumnName(n)===n);class Ws extends CustomEvent{constructor(e,t){super(e,t)}}class _e{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{r=!0,o(new so),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof so}static isTimedOut(e){return e instanceof bs}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function ho(n,e,t){return(e=fc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fc(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 nr{constructor(){ho(this,"pending",[]),ho(this,"resolved",[])}add(e,t){var r=_e.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function oC(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 ft{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(!ft.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(l<=r&&i<=u)return o;r<=u&&l<=i&&(r=Math.min(r,l),i=Math.max(i,u),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(!(i<l||u<r))if(l<r&&i<u){o[a]=[l,r-1],o.splice(a+1,0,[i+1,u]);break}else r<=l&&u<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,u]}return o}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*aC(n,e){for(var t=n;t<=e;++t)yield t}var sC=" ";class Vs{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 rr;function en(n,e,t){return(e=gc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gc(n){var e=bc(n,"string");return typeof e=="symbol"?e:e+""}function bc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qe{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(qe.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}static formatDuration(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(r,"m ").concat(i,"s"):r>0?"".concat(r,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"ms";if(e==null||t===""||t===0||t==null)return null;var i=1,o=null,a=null;if(r==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(r==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}rr=qe;en(qe,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");en(qe,"MILLIS_PER_SECOND",1e3);en(qe,"NANOS_PER_SECOND",1e9);en(qe,"NANOS_PER_MIN",60*rr.NANOS_PER_SECOND);en(qe,"NANOS_PER_HOUR",60*rr.NANOS_PER_MIN);en(qe,"MILLIS_PER_MIN",60*rr.MILLIS_PER_SECOND);en(qe,"MILLIS_PER_HOUR",60*rr.MILLIS_PER_MIN);en(qe,"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 yc(n,e,t){return(e=Cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:e+""}function Sc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qn extends Error{constructor(){super(...arguments),yc(this,"isInvalid",!0)}}function Ks(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function mo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function wc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){mo(o,r,i,a,s,"next",l)}function s(l){mo(o,r,i,a,s,"throw",l)}a(void 0)})}}var Ec=U.module("useAsyncInterval");function Pc(n,e){var t=Ks(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(wc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(h){Ec.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),c=Math.max(0,e-u);r.current=window.setTimeout(a,c)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function ir(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(n);if(t==null)throw new Error(e);return t}function Tc(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:r=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>gn(n,e,o!=null?{leading:r,trailing:i,maxWait:o}:{leading:r,trailing:i}),[n,e,r,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function _c(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Oc(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Hr(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function zs(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var xc=3500,Ic=U.module("useCopyToClipboard");function Dc(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{Bs(i).then(()=>{e(!0)}).catch(o=>Ic.error("Unable to copy ".concat(i),`
|
|
3
|
-
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},xc)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var Mc=["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 Nc(n){return typeof n=="string"&&Mc.includes(n)}function Gs(n){return n!=null&&Nc(n)?"var(--dh-color-".concat(n,")"):n}var kc=["color","UNSAFE_style"];function vo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vo(Object(t),!0).forEach(function(r){jc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jc(n,e,t){return(e=Lc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lc(n){var e=Ac(n,"string");return typeof e=="symbol"?e:e+""}function Ac(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rc(n,e){if(n==null)return{};var t,r,i=Fc(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 Fc(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=m.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=Rc(n,kc),o=m.useMemo(()=>mr(mr({},r),{},{color:Gs(t)}),[t,r]);return d.jsx(Ou,mr(mr({},i),{},{ref:e,UNSAFE_style:o}))});qs.displayName="Text";function fo(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 $t(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fo(Object(t),!0).forEach(function(r){xn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xn(n,e,t){return(e=$c(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $c(n){var e=Hc(n,"string");return typeof e=="symbol"?e:e+""}function Hc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 po="popper",Bc={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(n,e)=>{var t,r,i=(t=vs.Defaults.modifiers)===null||t===void 0||(t=t.preventOverflow)===null||t===void 0||(r=t.fn)===null||r===void 0?void 0:r.call(t,n,e);return i==null?n:(i.styles.maxHeight="".concat(document.documentElement.clientHeight-n.offsets.popper.top-2*e.padding,"px"),i??n)}},flip:{enabled:!1}}};class Ur extends m.Component{constructor(e){super(e),xn(this,"element",void 0),xn(this,"container",void 0),xn(this,"nodeRef",$.createRef()),xn(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=$.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:a,keepInParent:s}=this.props,l=s?Bc:{placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},u=$t($t($t({},l),a),{},{modifiers:$t($t($t({},l.modifiers),a.modifiers),{},{preventOverflow:$t($t({},(e=l.modifiers)===null||e===void 0?void 0:e.preventOverflow),(t=a.modifiers)===null||t===void 0?void 0:t.preventOverflow)})});document.body.appendChild(this.element);var c=this.getVisibleElement(this.container.current);c==null&&(c=this.container.current);var h=new vs(o||c,this.element,u);h.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(i){var v=this.element.querySelector(".".concat(po));v instanceof HTMLElement&&!v.contains(document.activeElement)&&v.focus()}}),mi.flushSync(()=>{this.setState({popper:h})})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),mi.flushSync(()=>{this.setState({show:!0})})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){var{closeOnBlur:t,onBlur:r}=this.props;e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||(r==null||r(e),t&&this.hide()))}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return d.jsx(ys,{isPortal:!0,children:d.jsx(fs,{in:a,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,nodeRef:this.nodeRef,children:d.jsx("div",{ref:this.nodeRef,onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:q(po,{interactive:i},e),onBlur:this.handleBlur,tabIndex:o?-1:void 0,role:"presentation",children:d.jsxs("div",{className:"popper-content",children:[t,d.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return d.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Br.createPortal(this.renderContent(),this.element)})}}xn(Ur,"defaultProps",{options:{},className:"",timeout:Cs.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,referenceObject:null,"data-testid":void 0});var bi;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 Uc(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){gt(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 gt(n,e,t){return(e=Wc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wc(n){var e=Vc(n,"string");return typeof e=="symbol"?e:e+""}function Vc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Kc=U.module("Tooltip");class he extends m.Component{static handleHidden(){he.shownTooltipCount-=1,he.shownTooltipCount===0&&(he.lastHiddenTime=Date.now())}static handleShown(){he.shownTooltipCount+=1}constructor(e){super(e),gt(this,"container",void 0),gt(this,"popper",void 0),gt(this,"parent",void 0),gt(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=$.createRef(),this.popper=$.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?he.handleShown():he.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&he.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Kc.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(he.shownTooltipCount>0||Date.now()-he.lastHiddenTime<he.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),mi.flushSync(()=>{this.setState({isShown:!0})});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Uc({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Ur,{className:q(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:r,children:d.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}bi=he;gt(he,"defaultTimeout",500);gt(he,"defaultReshowTimeout",100);gt(he,"triggerReshowThreshold",300);gt(he,"shownTooltipCount",0);gt(he,"lastHiddenTime",Date.now());gt(he,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:bi.defaultReshowTimeout,timeout:bi.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var zc=U.module("ThemeProvider"),Li=m.createContext(null);Li.displayName="ThemeContext";function lC(n){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:r=Wu,children:i}=n,o=m.useMemo(()=>Vu(),[]),[a,s]=m.useState(null),[l,u]=m.useState(Ku),c=m.useMemo(()=>e==null?null:zu(l,{base:o,custom:e??[]}),[o,l,e]),h=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(c==null||e==null)){Gu(r);var f=qu(r);zc.debug2("updateThemePreloadData:",{active:c.map(p=>p.themeKey),custom:e.map(p=>p.themeKey),preloadStyleContent:f,selectedThemeKey:l}),Xu({themeKey:l,preloadStyleContent:f})}},[c,l,e,r]),m.useEffect(()=>{s({activeThemes:c,selectedThemeKey:l,themes:h,setSelectedThemeKey:u})},[c,l,h]),t&&c==null?null:d.jsxs(d.Fragment,{children:[c==null?null:d.jsx(d.Fragment,{children:c.map(v=>d.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:d.jsx(Li.Provider,{value:a,children:d.jsx(ys,{children:i})})]})}function Xs(){return ir(Li,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var Gc=["color","UNSAFE_style"];function bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function vr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bo(Object(t),!0).forEach(function(r){qc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function qc(n,e,t){return(e=Xc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xc(n){var e=Zc(n,"string");return typeof e=="symbol"?e:e+""}function Zc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Yc(n,e){if(n==null)return{};var t,r,i=Qc(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 Qc(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 Zs=m.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=Yc(n,Gc),o=m.useMemo(()=>vr(vr({},r),{},{color:Gs(t)}),[t,r]);return d.jsx(xu,vr(vr({},i),{},{ref:e,UNSAFE_style:o}))});Zs.displayName="Heading";function Jc(n){var{children:e,className:t,style:r,"data-testid":i}=n;return d.jsx("div",{className:q("btn-group",t),style:r,role:"group","data-testid":i,children:e})}var eh=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];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 Co(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){th(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 th(n,e,t){return(e=nh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nh(n){var e=rh(n,"string");return typeof e=="symbol"?e:e+""}function rh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ih(n,e){if(n==null)return{};var t,r,i=oh(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function oh(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function ah(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 q("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function sh(n){switch(n){case"group-end":return q("pl-2","pr-3")}}var se=$.forwardRef((n,e)=>{var{kind:t,variant:r,type:i="button",tooltip:o,icon:a,disabled:s=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:h,onMouseUp:v,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,className:b,style:w,children:E,tabIndex:P,"data-testid":R,"aria-label":Z}=n,re=ih(n,eh),{UNSAFE_className:Y}=Iu({},"button"),k;r&&(k=sh(r));var B;a&&(B=$.isValidElement(a)?a:d.jsx(ve,{icon:a}));var Q=B!=null&&E==null,G=ah(t,Q),L;o!==void 0&&(L=typeof o=="string"?d.jsx(he,{children:o}):o);var W=Z;Z===void 0&&Q&&o!=null&&typeof o=="string"&&(W=o);var X=d.jsxs("button",Co(Co({"data-testid":R,ref:e,type:i,className:q("btn",G,k,{active:l},b,Y),onClick:u,onContextMenu:c,onMouseUp:v,onMouseDown:h,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,style:w,disabled:s,tabIndex:P,"aria-label":W},re),{},{children:[a&&B,E,o!=null&&!s&&L]}));return s&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[X,L]}):X});se.displayName="Button";function Ys(n){var{className:e,children:t,"data-testid":r}=n;return d.jsx("div",{className:q("modal-footer",e),"data-testid":r,children:t})}function Qn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:c="Discard",isConfirmDanger:h=!1,children:v,"data-testid":f}=n,p=m.useRef(null),g=m.useRef(null),b=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),w=m.useCallback(()=>{var P;(P=p.current)===null||P===void 0||P.focus()},[]),E="";return e&&(E=typeof r=="function"?r():r),d.jsxs(Ss,{isOpen:e,onOpened:w,children:[d.jsx(ws,{closeButton:!1,children:t}),d.jsx(Es,{children:E}),d.jsxs(Ys,{children:[s&&d.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[d.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),d.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&d.jsx(se,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:c}),i&&d.jsx(se,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),d.jsxs(Jc,{children:[d.jsx(se,{kind:h?"danger":"primary",onClick:b,ref:p,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:u}),v]})]})]})}function lh(n,e,t){return(e=uh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uh(n){var e=dh(n,"string");return typeof e=="symbol"?e:e+""}function dh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ri(n){return n.then!==void 0}class Pe{static disableAllActions(){Pe.actionsDisabled=!0}static enableAllActions(){Pe.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,a;return((o=e.order)!==null&&o!==void 0?o:0)>((a=t.order)!==null&&a!==void 0?a:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(Pe.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Pe.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Pe.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var a=i[o],s=void 0;typeof a=="function"?s=a():s=a,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var a=(i+t*o+r.length)%r.length,s=r[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}lh(Pe,"actionsDisabled",!1);var So=U.module("GlobalContextAction");class ch extends m.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:r}=this.props;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),So.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Pe.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;So.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class hh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){var s=d.jsx(ch,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));r.push(s)}}return r}}function Qs(n,e,t){return(e=mh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mh(n){var e=vh(n,"string");return typeof e=="symbol"?e:e+""}function vh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var fr=U.module("ContextActions");class ne extends m.Component{static triggerMenu(e,t,r,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:r,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),Qs(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=$.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=>!ri(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!ri(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:r}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0){for(var r=e.target,i=function(){var{classList:u}=r,c=t.find(h=>u.contains(h));if(c!==void 0)return fr.debug2('Contextmenu event ignored based on the target className "'.concat(c,'"')),{v:void 0};r=r.parentElement},o;r!=null;)if(o=i(),o)return o.v}if(Pe.isContextActionEvent(e)||(e.contextActions=[]),!!Pe.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>ri(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}fr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,r=0;r<t.length;r+=1){var i=t[r];if(!Pe.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;fr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),fr.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return d.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:d.jsx(hh,{actions:t})})}}Qs(ne,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var Js=$.forwardRef((n,e)=>{var t,r,{closeMenu:i,children:o,menuItem:a,onMenuItemClick:s,onMenuItemMouseMove:l,onMenuItemContextMenu:u,isKeyboardSelected:c=!1,isMouseSelected:h=!1,"data-testid":v}=n,f=m.useCallback(G=>{s(a,G)},[a,s]),p=m.useCallback(G=>{l(a,G)},[a,l]),g=m.useCallback(G=>{u(a,G)},[a,u]);function b(G,L,W){if(typeof G.type=="string")return G;var X={menuItem:a,closeMenu:i,isKeyboardSelected:c,isMouseSelected:h,iconElement:L,displayShortcut:W,"data-testid":v};return $.cloneElement(G,{forwardedProps:X})}var w=(t=a.shortcutText)!==null&&t!==void 0?t:(r=a.shortcut)===null||r===void 0?void 0:r.getDisplayText(),E=null;if(a.icon){var P=a.icon;if($.isValidElement(P))E=P;else{var R;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(R={color:a.iconColor}),E=d.jsx(ve,{icon:P,style:R})}}var Z=null,re=!!o;a.actions&&(Z=d.jsx(ve,{icon:Zu}));var Y=null;if(a.menuElement)Y=d.jsx("div",{className:"custom-menu-item",onMouseMove:p,children:b(a.menuElement,E,w)});else{var k,B=a.disabled,Q=a.iconOutline;Y=d.jsx("button",{type:"button",className:q("btn-context-menu",{disabled:B},{active:(re||h)&&(B===void 0||!B)},{"keyboard-active":c&&(B===void 0||!B)}),onClick:f,onMouseMove:p,onContextMenu:g,title:(k=a.description)!==null&&k!==void 0?k:"",children:d.jsxs("div",{className:"btn-context-menu-wrapper",children:[d.jsx("span",{className:q("icon",{outline:Q}),children:E}),d.jsx("span",{className:"title",children:a.title}),w!==void 0&&d.jsx("span",{className:"shortcut",children:w}),Z&&d.jsx("span",{className:q("submenu-indicator",{disabled:B}),children:Z})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,Y]})});Js.displayName="ContextMenuItem";var el=$.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o=!1,inputClassName:a,isInvalid:s=!1,labelClassName:l,name:u,onChange:c,"data-testid":h}=n,[v]=m.useState(_t()),f=zs(e);m.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var p=m.useCallback(g=>{f.current&&(f.current.indeterminate=t===null),c&&c(g)},[f,t,c]);return d.jsxs("div",{className:q("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:q("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:u,onChange:p,"data-testid":h}),d.jsx("label",{className:q("custom-control-label",l),htmlFor:v,children:r})]})});el.displayName="Checkbox";function Mr(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function tl(n){return Mr(n)&&tl(n.WrappedComponent)?!0:n.prototype!=null&&n.prototype.isReactComponent!=null}function fh(n){return!Mr(n)&&"$$typeof"in n&&n.$$typeof===Du.ForwardRef}function nl(n){return tl(n)||fh(n)}var ph=["copy","tooltip","children"];function wo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Eo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(r){gh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gh(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)}function Ch(n,e){if(n==null)return{};var t,r,i=Sh(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 Sh(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 Po="Copy";function rl(n){var{copy:e,tooltip:t=Po,children:r}=n,i=Ch(n,ph),[o,a]=Dc(),s=o?"Copied":t;return d.jsxs(Mu,Eo(Eo({},i),{},{"aria-label":s,onPress:()=>{a(typeof e=="function"?e():e)},children:[d.jsx(Nu,{UNSAFE_className:r==null?"action-button-icon-with-tooltip":void 0,children:d.jsx(ve,{icon:o?Yu:Ps})}),r!=null&&d.jsx(qs,{children:r}),(r==null||s!==Po)&&d.jsx(he,{children:s})]}))}rl.displayName="CopyButton";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 wh(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){Xn(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 Xn(n,e,t){return(e=Eh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Eh(n){var e=Ph(n,"string");return typeof e=="symbol"?e:e+""}function Ph(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class il extends m.PureComponent{constructor(e){var t;super(e),Xn(this,"container",void 0),Xn(this,"oldFocus",void 0),Xn(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=$.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:r}=e,i=(t=r.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Pe.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:Pe.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=Pe.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Pe.getNextMenuItem(i??0,1,t)),r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(d.jsx("hr",{},"".concat(a,".separator")));var l=d.jsx(Js,{isKeyboardSelected:r===a,isMouseSelected:o===a,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(l)}var{menuStyle:u}=this.props;return d.jsx("div",{className:"context-menu-container",style:wh({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Xn(il,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function _o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_o(Object(t),!0).forEach(function(r){In(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_o(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function In(n,e,t){return(e=Th(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Th(n){var e=_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)}class or extends m.PureComponent{constructor(e){super(e),In(this,"container",void 0),In(this,"parent",void 0),In(this,"popper",void 0),In(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=$.createRef(),this.parent=null,this.popper=$.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=Oo({placement:"bottom"},s),a=Oo({separateKeyboardMouse:!0},a),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Ur,{ref:this.popper,options:s,className:q("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(il,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}In(or,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Vt(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=xh(n,"string");return typeof e=="symbol"?e:e+""}function xh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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=U.module("Shortcut"),I=function(n){return n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n}({}),_=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}({}),Ih=new Set([_.ENTER,_.DELETE,_.F1,_.F2,_.F3,_.F4,_.F5,_.F6,_.F7,_.F8,_.F9,_.F10,_.F11,_.F12]);class Se extends ps{static isAllowedKey(e){return Object.values(_).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!Se.isMacPlatform&&e.metaKey||!Se.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Ih.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case I.CTRL:t.ctrlKey=!0;break;case I.ALT:case I.OPTION:t.altKey=!0;break;case I.CMD:t.metaKey=!0;break;case I.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:r}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!Se.isAllowedKey(t)&&Se.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===_.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 _.ENTER:t+="⏎";break;case _.ESCAPE:t+="⎋";break;case _.BACKSPACE:t+="⌫";break;case _.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":Se.isMacPlatform?Se.getMacDisplayText(e):Se.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),Vt(this,"id",void 0),Vt(this,"name",void 0),Vt(this,"tooltip",void 0),Vt(this,"isEditable",void 0),Vt(this,"defaultKeyState",void 0),Vt(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=Se.isMacPlatform,u=l?i:r;this.defaultKeyState=Se.createKeyState(u),this.keyState=this.defaultKeyState}getDisplayText(){return Se.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Se.isValidKeyState(e)?(xo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Ws("onUpdate",{detail:this}))):xo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Se.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Se.NULL_KEY_STATE)}isNull(){return Se.doKeyStatesMatch(this.keyState,Se.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Se.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Se.getKeyStateFromEvent(e))}}Vt(Se,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Vt(Se,"isMacPlatform",Pe.isMacPlatform());function Io(n,e,t){return(e=Dh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dh(n){var e=Mh(n,"string");return typeof e=="symbol"?e:e+""}function Mh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Do=U.module("ShortcutRegistry");class Nh extends ps{constructor(){super(...arguments),Io(this,"shortcutMap",new Map),Io(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new Se(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return Do.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;Do.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new Ws("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var ce=Object.freeze(new Nh),qt={COPY:ce.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[I.CTRL,_.C],macShortcut:[I.CMD,_.C],isEditable:!1}),PASTE:ce.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[I.CTRL,_.V],macShortcut:[I.CMD,_.V],isEditable:!1}),SAVE:ce.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[I.CTRL,_.S],macShortcut:[I.CMD,_.S],isEditable:!1}),SELECT_ALL:ce.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[I.CTRL,_.A],macShortcut:[I.CMD,_.A],isEditable:!1}),REOPEN_CLOSED_PANEL:ce.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[I.ALT,I.SHIFT,_.T],macShortcut:[I.OPTION,I.SHIFT,_.T],isEditable:!0}),LINKER:ce.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[I.CTRL,_.L],macShortcut:[I.CMD,_.L]}),LINKER_CLOSE:ce.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[_.ESCAPE],macShortcut:[_.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:ce.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[I.CTRL,I.ALT,_.I],macShortcut:[I.CMD,I.SHIFT,_.I],isEditable:!0}),EXPORT_LOGS:ce.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[I.CTRL,I.ALT,I.SHIFT,_.L],macShortcut:[I.CMD,I.OPTION,I.SHIFT,_.L],isEditable:!0}),OPEN_DASHBOARD_LIST:ce.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[I.CTRL,I.SHIFT,_.D],macShortcut:[I.CMD,I.SHIFT,_.D],isEditable:!0}),NEXT:ce.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[_.ENTER],macShortcut:[_.ENTER],isEditable:!1}),PREVIOUS:ce.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[I.SHIFT,_.ENTER],macShortcut:[I.SHIFT,_.ENTER],isEditable:!1}),UNDO:ce.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[I.CTRL,_.Z],macShortcut:[I.CMD,_.Z],isEditable:!1}),REDO:ce.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[I.CTRL,I.SHIFT,_.Z],macShortcut:[I.CMD,I.SHIFT,_.Z],isEditable:!1})};function yi(n,e,t){return(e=kh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kh(n){var e=jh(n,"string");return typeof e=="symbol"?e:e+""}function jh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wr extends m.PureComponent{constructor(e){super(e),yi(this,"inputField",void 0),yi(this,"searchChangeSelection",void 0),this.inputField=$.createRef(),this.searchChangeSelection=$.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var{value:e,placeholder:t,endPlaceholder:r,onBlur:i,onChange:o,className:a,disabled:s,matchCount:l,id:u,onKeyDown:c,"data-testid":h,cursor:v}=this.props,f,p=[{action:()=>v==null?void 0:v.next("forward"),shortcut:qt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:qt.PREVIOUS}];return v&&l>1?f=d.jsxs(d.Fragment,{children:[d.jsx(se,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:Ts,tooltip:"Previous match (".concat(qt.PREVIOUS.getDisplayText(),")")}),d.jsxs("span",{className:"search-change-text",children:[v.index!==void 0&&"".concat(v.index+1," of "),l]}),d.jsx(se,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("forward")},icon:Qu,tooltip:"Next match (".concat(qt.NEXT.getDisplayText(),")")})]}):f=l>0&&d.jsx("span",{className:"search-match",children:l}),d.jsxs("div",{className:q("search-group",a),children:[d.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:c,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:u,"data-testid":h}),l!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),d.jsx(ne,{actions:p})]}):d.jsxs("span",{className:"search-end-content",children:[(r??"")!==""&&e===""&&d.jsx("span",{className:"search-end-placeholder",children:r}),d.jsx(ve,{icon:Ju})]})]})}}yi(Wr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function ol(n,e,t){return(e=Lh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lh(n){var e=Ah(n,"string");return typeof e=="symbol"?e:e+""}function Ah(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class al extends m.PureComponent{constructor(e){super(e),ol(this,"searchInput",void 0),this.searchInput=$.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=gn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":o}=this.props,{value:a}=this.state;return d.jsx(Wr,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}ol(al,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function sl(n,e,t){return(e=Rh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rh(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)}var $h=U.module("ItemListItem");class Vr extends m.Component{static handleKeyDown(){return $h.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),sl(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=$.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":a}=this.props;return d.jsx("div",{className:q("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:Vr.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:o})}}sl(Vr,"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 xr;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 No(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){ct(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 ct(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=Bh(n,"string");return typeof e=="symbol"?e:e+""}function Bh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ko=U.module("ItemList"),jo=5;class yt extends m.PureComponent{static renderItem(e){var t,r,{item:i}=e;return d.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),ct(this,"list",void 0),ct(this,"listContainer",void 0),ct(this,"getItemSelected",On((i,o)=>ft.isSelected(o,i),{max:yt.CACHE_SIZE})),ct(this,"getCachedItem",On((i,o,a,s,l,u,c,h)=>{var v=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:c});return d.jsx(Vr,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:c,children:v},o)},{max:yt.CACHE_SIZE})),ct(this,"getOuterElement",On(i=>{var o=$.forwardRef((a,s)=>d.jsx("div",No({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),ct(this,"getInnerElement",On(()=>{var i=$.forwardRef((o,a)=>d.jsx("div",No({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),ct(this,"getItemData",On((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=$.createRef(),this.listContainer=$.createRef();var{isStickyBottom:t,selectedRanges:r}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:r,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:u}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==u)this.setSelectedRanges(r);else if(u!==t.selectedRanges){var{onSelectionChange:c}=this.props;c(u)}if(o!==t.focusIndex){var{onFocusChange:h}=this.props;h(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:r}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:r}=this.state,i=ft.isSelected(r,e),o=i||Pe.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:ft.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){ko.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){ko.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:u}=this.state;if(!(a==null||o)){var c=Math.abs(t.clientX-(l??0)),h=Math.abs(t.clientY-(u??0));c>jo&&h>jo&&this.setState({isDragging:!0}),(r||a===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,s)&&!Pe.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Pe.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:a,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!s){var l=t.shiftKey,u=Pe.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,r),!i&&!l&&!u&&o(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:r,onSelect:i}=this.props,{focusIndex:o}=this.state,a=o;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&i(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=r-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,r-1):a=0;else return;if(o!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else if(this.deselectAll(),a!==null)this.selectItem(a);else{var u;(u=this.listContainer.current)===null||u===void 0||u.focus()}this.scrollIntoView(a)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:a}=this.state;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){ft.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:ft.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){ft.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:ft.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);r(o,a)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:u}=this.state;if(t<o||t>=o+i.length)return null;var c=i[t-o];return this.getCachedItem(t,t,c,t===l&&!s,this.getItemSelected(t,u),a,r,s)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return d.jsx(ku,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:c,height:h}=u;return d.jsx(ju,{className:"item-list-scroll-pane",height:h,width:c,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":a,children:this.renderInnerElement})}})}}xr=yt;ct(yt,"CACHE_SIZE",1e3);ct(yt,"DEFAULT_ROW_HEIGHT",20);ct(yt,"DEFAULT_OVERSCAN",10);ct(yt,"defaultProps",{offset:0,items:[],rowHeight:xr.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:xr.DEFAULT_OVERSCAN,renderItem:xr.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var Uh=U.module("ErrorBoundary");class Wh extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;Uh.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??d.jsx("div",{className:t,children:d.jsx(bn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function Vh(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=n;return d.jsx("button",{type:"button",className:q("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:d.jsx("div",{className:"handle"})})}var Kh=["classNames","timeout","children","onEnter"];function Lo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ao(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lo(Object(t),!0).forEach(function(r){zh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Lo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zh(n,e,t){return(e=Gh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gh(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)}function Xh(n,e){if(n==null)return{};var t,r,i=Zh(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 Zh(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 Yh={display:"contents"};function uC(n){var{classNames:e,timeout:t=Cs.transitionMs,children:r,onEnter:i}=n,o=Xh(n,Kh),a=m.useRef(null),s=m.useCallback(u=>{var c=a.current;c&&(i==null||i(c,u))},[i]),l=m.useCallback(u=>{a.current=u==null?void 0:u.firstElementChild},[]);return d.jsx(fs,Ao(Ao({nodeRef:a,timeout:t,classNames:q("fade",e),onEnter:s},o),{},{children:d.jsx("div",{ref:l,style:Yh,children:r})}))}var Qh=["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 Fo(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){Jh(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 Jh(n,e,t){return(e=em(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function em(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)}function nm(n,e){if(n==null)return{};var t,r,i=rm(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 rm(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 ll=$.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":a}=n,s=nm(n,Qh),l=zs(e),u=m.useCallback(c=>{o(c.target.value)},[o]);return d.jsx("select",Fo(Fo({ref:l,className:q("custom-select",r,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});ll.displayName="Select";var Ai=$.createContext(new Map);Ai.displayName="XComponentMapContext";var dC=Ai.Provider;function im(n){var e,t=m.useContext(Ai);return(e=t.get(n))!==null&&e!==void 0?e:n.Original}function $o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ii(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$o(Object(t),!0).forEach(function(r){om(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$o(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function om(n,e,t){return(e=am(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function am(n){var e=sm(n,"string");return typeof e=="symbol"?e:e+""}function sm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ul(n){var e,t;function r(i,o){var a=im(t);return nl(n)?d.jsx(a,ii(ii({},i),{},{ref:o})):d.jsx(a,ii({},i))}return r.displayName="XComponent(".concat((e=n.displayName)!==null&&e!==void 0?e:n.name,")"),t=m.forwardRef(r),t.Original=n,t.isXComponent=!0,t}function lm(){return ir(ed,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function dl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function cl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function cC(n){return dl(n)||cl(n)}var hl=m.createContext(null);hl.displayName="ObjectFetcherContext";function hC(n){if(cl(n))return{id:n.id,type:n.type};if(dl(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function um(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 mC(){return ir(hl,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var Ri=Object.freeze({}),dm=new Map,vC=n=>n.api,fC=n=>n.user,ml=n=>n.storage,vl=n=>ml(n).commandHistoryStorage,fl=n=>ml(n).fileStorage,cm=n=>n.defaultWorkspaceSettings,pl=n=>{var{workspace:e}=n;return e},$e=Lu(n=>{var e,t,r=(e=(t=pl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=cm(n),o=Au({},i,r,(a,s)=>{if(Array.isArray(a)&&Array.isArray(s))return s});return o}),pC=n=>n.defaultWorkspaceSettings,gC=n=>$e(n).defaultDateTimeFormat,bC=n=>{var e;return(e=$e(n).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Ri},yC=n=>{var e;return(e=$e(n).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Ri},CC=n=>{var e;return(e=$e(n).formatter)!==null&&e!==void 0?e:[]},hm=n=>$e(n).timeZone,SC=n=>$e(n).showTimeZone,wC=n=>$e(n).showTSeparator,EC=n=>$e(n).truncateNumbersWithPound,PC=n=>$e(n).showEmptyStrings,TC=n=>$e(n).showNullStrings,_C=n=>$e(n).showExtraGroupColumn,OC=n=>$e(n).shortcutOverrides,xC=n=>$e(n).webgl,IC=n=>$e(n).webglEditable,gl=n=>{var e;return(e=$e(n).notebookSettings)!==null&&e!==void 0?e:Ri},DC=n=>n.activeTool,mm=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:dm};function Ho(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 jt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ho(Object(t),!0).forEach(function(r){vm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ho(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vm(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=pm(n,"string");return typeof e=="symbol"?e:e+""}function pm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 MC=n=>({type:sd,payload:n}),NC=n=>({type:rd,payload:n}),bl=n=>({type:ud,payload:n}),kC=n=>({type:dd,payload:n}),jC=n=>({type:ld,payload:n}),LC=n=>({type:od,payload:n}),AC=n=>({type:ad,payload:n}),gm=n=>(e,t)=>{e(bl(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i==null?void 0:i.save(n)},bm=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=jt(jt({},r),{},{data:jt(jt(jt({},i),n),{},{settings:jt(jt({},i==null?void 0:i.settings),n.settings)})});return e(gm(o))},ym=n=>(e,t)=>{var{notebookSettings:r}=$e(t()),i=jt(jt({},r),n);return e(Cm({notebookSettings:i}))},Cm=n=>e=>e(bm({settings:n})),RC=n=>({type:td,payload:n}),FC=n=>({type:nd,payload:n}),$C=n=>({type:id,payload:n});function Bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Uo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bo(Object(t),!0).forEach(function(r){Sm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Sm(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=Em(n,"string");return typeof e=="symbol"?e:e+""}function Em(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Pm(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i==null?void 0:i.type){case n:{var{id:o,payload:a}=i;return t&&Yn({payload:a},{payload:r[o]})?r:Uo(Uo({},r),{},{[o]:a})}default:return r}}}function yl(n){var{type:e}=n,t=lm();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return d.jsx(ve,{icon:hd});case t.VariableType.FIGURE:return d.jsx(ve,{icon:Os});case t.VariableType.PANDAS:return d.jsx(ve,{icon:cd});default:return d.jsx(ve,{icon:_s})}}function Wo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Tm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Wo(o,r,i,a,s,"next",l)}function s(l){Wo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Cl(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=Xs();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=Tm(function*(){if(e!=null&&o!=null){var u=yield De.colorize(e.toString(),t,{});a||i(u)}}),l.apply(this,arguments)}return s(),()=>{a=!0}},[o,e,t]),d.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class Sl{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Nr{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)?[]:Ru.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 Nr.isTableType(e,t)||Nr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function _m(n){var{children:e}=n;return d.jsxs("div",{className:"console-history-item-result",children:[d.jsx("div",{className:"console-history-gutter",children:"-"}),d.jsx("div",{className:"console-history-content",children:e})]})}function Ci(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=xm(n,"string");return typeof e=="symbol"?e:e+""}function xm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 wl extends m.Component{constructor(e){super(e),Ci(this,"timer",void 0),Ci(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=window.setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer!=null&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:r}=this.state;return d.jsx("div",{className:q("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(xs,{className:"ml-2"}),"Running... ",qe.formatElapsedTime(r)," ",d.jsx(se,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:md,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Ci(wl,"defaultProps",{disabled:!1});function Zn(n,e,t){return(e=Im(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Im(n){var e=Dm(n,"string");return typeof e=="symbol"?e:e+""}function Dm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 extends m.PureComponent{constructor(e){super(e),Zn(this,"mouseX",void 0),Zn(this,"mouseY",void 0),Zn(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=kn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=kn.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;A(r);var i=r.trimEnd(),o=i.indexOf(`
|
|
4
|
-
`),a=o>-1,s=i;a&&(s=i.slice(0,o));var l=i.slice(o),u=t?"error-btn-link error-btn-link--active":"error-btn-link";return d.jsxs("div",{className:q("error-message",{expanded:e}),children:[a&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"error-gutter",children:d.jsx("button",{type:"button",onClick:this.handleToggleError,className:u,tabIndex:-1,children:d.jsx(ve,{icon:e?vi:
|
|
5
|
-
`).length:0;return e>2?null:"console-history-actions-".concat(e)},Pl=m.memo(n=>{var{item:e,onCommandSubmit:t,handleTooltipVisible:r}=n,i=m.useMemo(()=>Mm(e),[e]);return d.jsxs("div",{className:q("console-history-actions",i),children:[e.command!=null&&d.jsx(rl,{copy:e.command}),d.jsx(se,{icon:fd,kind:"inline",onClick:()=>{var o;return t((o=e.command)!==null&&o!==void 0?o:"")},tooltip:"Rerun",children:null}),d.jsx($u,{variant:"info",onOpenChange:r,UNSAFE_className:"console-history-item-contextual-help",children:d.jsx(El,{item:e})})]})});Pl.displayName="ConsoleHistoryItemActions";function Nm(n,e,t){return(e=km(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function km(n){var e=jm(n,"string");return typeof e=="symbol"?e:e+""}function jm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vo=U.module("ConsoleHistoryItem");class Tl extends m.PureComponent{constructor(e){super(e),this.state={isTooltipVisible:!1},this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Vo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Vo.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{isTooltipVisible:e}=this.state,{disabled:t,item:r,language:i,iconForType:o,onCommandSubmit:a}=this.props,{disabledObjects:s,result:l}=r,u=r.command!=null&&r.command!=="",c=null;u&&(c=d.jsxs("div",{className:q("console-history-item-command",{"console-history-item-command-tooltip-active":e}),children:[d.jsx("div",{className:"console-history-gutter",children:">"}),d.jsxs("div",{className:"console-history-content",children:[d.jsx(Cl,{language:i,children:r.command}),d.jsx(Pl,{item:r,onCommandSubmit:a,handleTooltipVisible:k=>this.setState({isTooltipVisible:k})})]})]}));var h=[],v=!1;if(l){var{error:f,message:p,changes:g}=l;if(g){var{created:b,updated:w}=g;[...b,...w].forEach(k=>{v=!0;var{title:B}=k,Q="".concat(B),G=t===void 0||t||(s??[]).indexOf(Q)>=0,L=d.jsx(se,{kind:"primary",onClick:()=>this.handleObjectClick(k),className:"btn-console-object",disabled:G,icon:o(k.type),children:B},Q);h.push(L)})}if(f!=null&&!u){var E,P="".concat((E=f.message)!==null&&E!==void 0?E:f);P||(P=f);var R=d.jsx(kn,{message:P},"result-error");h.push(R)}if(p!==void 0&&p!==""){var Z=d.jsx("div",{className:"log-message",children:p},"log-message");h.push(Z)}}else{v=!0;var re=d.jsx(wl,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");h.push(re)}var Y=null;return h.length>0&&(Y=d.jsx(_m,{children:h})),d.jsxs("div",{className:q("console-command-result",{"console-result-buttons":v}),children:[c,Y]})}}Nm(Tl,"defaultProps",{disabled:!1});function Lm(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var Am=$.forwardRef(function(e,t){for(var{disabled:r=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l,onCommandSubmit:u}=e,c=[],h=0;h<i.length;h+=1){var v=i[h],f=d.jsx(Tl,{disabled:r,item:v,openObject:a,language:o,supportsType:s,iconForType:l,onCommandSubmit:u},Lm(h,v));c.push(f)}return d.jsx("div",{ref:t,className:"container-fluid console-history",children:c})}),Rm={name:"Console",CLEAR:ce.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[I.CTRL,_.L],macShortcut:[I.CTRL,_.C]}),FOCUS_HISTORY:ce.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[I.CTRL,_.H],macShortcut:[I.CTRL,I.OPTION,_.H]})},Fm={name:"Command History",FOCUS_HISTORY:ce.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[I.CTRL,_.H],macShortcut:[I.CTRL,I.OPTION,_.H]}),SEND_TO_CONSOLE:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[_.ENTER],macShortcut:[_.ENTER]}),SEND_TO_NOTEBOOK:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[I.CTRL,_.ENTER],macShortcut:[I.CMD,_.ENTER]}),RUN:ce.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[I.ALT,_.R],macShortcut:[I.OPTION,_.R]})},$m={name:"Notebook",RUN:ce.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[I.ALT,_.R],macShortcut:[I.OPTION,_.R]}),RUN_SELECTED:ce.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[I.ALT,I.SHIFT,_.R],macShortcut:[I.OPTION,I.SHIFT,_.R]}),FIND:ce.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[I.CTRL,_.F],macShortcut:[I.CMD,_.F],isEditable:!1}),MINIMAP:ce.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[I.ALT,_.M],macShortcut:[I.OPTION,_.M]}),WORDWRAP:ce.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[I.ALT,_.Z],macShortcut:[I.OPTION,_.Z]})},Ke={CONSOLE:Rm,COMMAND_HISTORY:Fm,NOTEBOOK:$m};const Ie=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Hm="var(--dh-color-editor-bg)",Bm="var(--dh-color-editor-fg)",Um="var(--dh-color-editor-string)",Wm="var(--dh-color-editor-delimiter)",Vm="var(--dh-color-editor-predefined)",Km="var(--dh-color-editor-keyword)",zm="var(--dh-color-editor-storage)",Gm="var(--dh-color-editor-number)",qm="var(--dh-color-editor-operator)",Xm="var(--dh-color-editor-identifier)",Zm="var(--dh-color-editor-comment)",Si={"error-foreground":"var(--dh-color-editor-error-fg)",background:Hm,foreground:Bm,"line-height":"19px",string:Um,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:Wm,predefined:Vm,keyword:Km,storage:zm,number:Gm,operator:qm,identifier:Xm,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Zm,"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 Ym="python",Qm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Jm={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"]]}},ev={id:Ym,conf:Qm,language:Jm},tv="groovy",nv={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},rv={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"]]}},iv={id:tv,conf:nv,language:rv},ov="scala",av={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>))/}}},sv={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"]]}},lv={id:ov,conf:av,language:sv},uv="deephavenDb",dv={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/}}},cv={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"]]}},hv={id:uv,conf:dv,language:cv},mv="log",vv={},fv={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"}]]}},pv={id:mv,conf:vv,language:fv},gv={preview:!0,"target-version":"py38","line-length":88,"indent-width":4,format:{"indent-style":"space","quote-style":"double"},lint:{"flake8-implicit-str-concat":{"allow-multiline":!1},ignore:["ISC003"],select:["F","E1","E9","E711","W291","W293","W605","B","A","COM818","ISC","PLE","RUF001","RUF021","RUF027","PLR1704","LOG","ASYNC","RET501","RET502","RET503","PLC2401","PLC2403","NPY","PERF","C4"]}};function Ko(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function bv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ko(o,r,i,a,s,"next",l)}function s(l){Ko(o,r,i,a,s,"throw",l)}a(void 0)})}}function Jt(n,e,t){return(e=yv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yv(n){var e=Cv(n,"string");return typeof e=="symbol"?e:e+""}function Cv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 st=U.module("MonacoCompletionProvider");class H extends m.PureComponent{static initRuff(){return bv(function*(){if(H.isRuffEnabled)return H.initRuffPromise||(H.initRuffPromise=Hu({}).then(()=>{st.debug("Initialized Ruff",Ji.version()),H.isRuffInitialized=!0,H.updateRuffWorkspace()})),H.initRuffPromise})()}static updateRuffWorkspace(){if(H.isRuffInitialized){var e=console.log;try{console.log=()=>{},H.ruffWorkspace=new Ji(H.ruffSettings)}finally{console.log=e}H.lintAllPython()}}static setRuffSettings(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:H.ruffSettings;if(H.ruffSettings=e,!H.isRuffInitialized){H.initRuff();return}H.updateRuffWorkspace()}static getDiagnostics(e){if(!H.ruffWorkspace)return[];var t=H.ruffWorkspace.check(e.getValue());return me.isConsoleModel(e)?t.filter(r=>r.code==null):t}static lintAllPython(){if(!H.isRuffEnabled){De.removeAllMarkers("ruff");return}De.getModels().filter(e=>e.getLanguageId()==="python").forEach(H.lintPython)}static lintPython(e){if(H.isRuffEnabled&&H.ruffWorkspace){var t=H.getDiagnostics(e);st.debug("Linting Python document: ".concat(e.uri.toString()),t),De.setModelMarkers(e,"ruff",t.map(r=>{var i=r.code==="F401"||r.code==="F841",o=r.code==null;return{startLineNumber:r.location.row,startColumn:r.location.column,endLineNumber:r.end_location.row,endColumn:r.end_location.column,message:o?r.message:"".concat(r.code,": ").concat(r.message),severity:o?oo.Error:oo.Warning,tags:i?[$d.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=it.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}static handlePythonCodeActionRequest(e,t){if(!H.isRuffEnabled||!H.ruffWorkspace)return{actions:[],dispose:()=>{}};var r=H.getDiagnostics(e).filter(u=>{var c=new Ls(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&c.intersectRanges(t)}),i=r.filter(u=>{var{fix:c}=u;return c!=null}).map(u=>{var c="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?c="".concat(u.code,": ").concat(u.fix.message):c="Fix ".concat(u.code)),{title:c,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(h=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:h.location.row,startColumn:h.location.column,endLineNumber:h.end_location.row,endColumn:h.end_location.column},text:(v=h.content)!==null&&v!==void 0?v:""}}})}:void 0}}),o=new Set,a=new Set;r.forEach(u=>{u.code!=null&&(o.has(u.code)&&a.add(u.code),o.add(u.code))});var s=r.map(u=>{if(u.code==null)return[];var c=e.getLineContent(u.location.row),h=De.tokenize(c,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:u.location.row,startColumn:c.length+1,endLineNumber:u.location.row,endColumn:c.length+1},text:" # noqa: ".concat(u.code)};return h!=null&&h.type.startsWith("comment")&&(v.text="# noqa: ".concat(u.code," "),c.startsWith("# noqa:",h.offset)?(v.range.startColumn=h.offset+1,v.range.endColumn=h.offset+9):(v.range.startColumn=h.offset+1,v.range.endColumn=c.startsWith("# ",h.offset)?h.offset+3:h.offset+2)),[{title:"Disable ".concat(u.code," for ").concat(a.has(u.code)?"line ".concat(u.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:v}]}}]}).flat().filter((u,c,h)=>h.find(v=>v.title===u.title)===u),l=[...o].map(u=>({title:"Disable ".concat(u," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(u,`
|
|
6
|
-
`)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(H.ruffWorkspace)return st.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:H.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=it.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=it.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=it.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);st.debug("Requested completion items",a);var l=s.then(u=>{st.debug("Completion items received: ",a,u);var c=u.map(h=>{var{label:v,kind:f,detail:p,documentation:g,sortText:b,filterText:w,textEdit:E,insertTextFormat:P}=h;return{label:v,kind:H.lspToMonacoKind(f),detail:p,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:w,insertText:E.text,insertTextRules:P===2?4:P,range:H.lspToMonacoRange(E.range)}});return{incomplete:!0,suggestions:c}}).catch(u=>(st.error("There was an error retrieving completion items",u),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:i},u=s.getSignatureHelp(l);st.debug("Requested signature help",l);var c=u.then(h=>{st.debug("Signatures received: ",l,u);var v=h.map(p=>{var{label:g,documentation:b,parameters:w}=p;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:w??[]}});if(v.length===0)return o;var f=0;return{value:{signatures:v,activeSignature:f,activeParameter:h[f].activeParameter},dispose:()=>{}}}).catch(h=>(st.error("There was an error retrieving completion items",h),o));return c}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t)},a=i.getHover(o);st.debug("Requested hover",o);var s=a.then(l=>{st.debug("Hover received: ",o,l);var{contents:u}=l;return{contents:u!=null?[u]:[]}}).catch(l=>(st.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}Jt(H,"ruffWorkspace",void 0);Jt(H,"initRuffPromise",void 0);Jt(H,"isRuffInitialized",!1);Jt(H,"isRuffEnabled",!0);Jt(H,"ruffSettings",gv);function zo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Sv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){zo(o,r,i,a,s,"next",l)}function s(l){zo(o,r,i,a,s,"throw",l)}a(void 0)})}}function 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){wv(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 wv(n,e,t){return(e=Ev(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ev(n){var e=Pv(n,"string");return typeof e=="symbol"?e:e+""}function Pv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Dt=U.module("MonacoUtils"),Xo="inmemory://dh-console/";class me{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dt.debug("Initializing Monaco..."),e!==void 0&&me.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=me;t(),r([hv,ev,iv,pv,lv]),it.onLanguage("python",()=>{it.registerCodeActionProvider("python",{provideCodeActions:H.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),it.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:H.handlePythonFormatRequest})}),De.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){H.ruffWorkspace!=null&&H.lintPython(i);var o=Hr(a=>H.lintPython(a),250);i.onDidChangeContent(()=>{o(i)})}}),me.removeConflictingKeybindings(),Dt.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=me,i=Is(Si);Dt.debug2("Monaco theme:",Si),Dt.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"],"diffEditor.insertedTextBackground":i["diff-editor-inserted-text-background"],"diffEditor.removedTextBackground":i["diff-editor-removed-text-background"],"diffEditor.insertedLineBackground":i["diff-editor-inserted-line-background"],"diffEditor.removedLineBackground":i["diff-editor-removed-line-background"]};De.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{De.setTheme("dh-dark")}catch(s){Dt.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),De.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=qo(qo({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var{id:i}=r;return i});it.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Dt.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{me.registerLanguage(r)})}static registerLanguage(e){Dt.debug2("Registering language: ",e.id),it.register(e),it.onLanguage(e.id,()=>{it.setLanguageConfiguration(e.id,e.conf),it.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();A(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Dt.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,u=[],c=0;c<s.length;c+=1){var h=s[c],{range:v,rangeLength:f,text:p}=h,g={range:{start:{line:v.startLineNumber-1,character:v.startColumn-1},end:{line:v.endLineNumber-1,character:v.endColumn-1}},rangeLength:f,text:p};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};Dt.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();A(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();A(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){De.addKeybindingRule({keybinding:rt.CtrlCmd|Qt.KeyD,command:null}),me.isMacPlatform()||De.addKeybindingRule({keybinding:rt.CtrlCmd|Qt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(_t()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=me.isMacPlatform();return i?(t.metaKey?rt.CtrlCmd:0)|(t.shiftKey?rt.Shift:0)|(t.altKey?rt.Alt:0)|(t.ctrlKey?rt.WinCtrl:0)|ao.fromString(r):(t.ctrlKey?rt.CtrlCmd:0)|(t.shiftKey?rt.Shift:0)|(t.altKey?rt.Alt:0)|(t.metaKey?rt.WinCtrl:0)|ao.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=Bu(s),u=l.filter(c=>c.type==="url"?/^https?:\/\//.test(c.value):!0);u.forEach(c=>{t.push({url:c.href,range:new Ls(a,c.start+1,a,c.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return Hd.parse("".concat(Xo).concat(_t()))}static isConsoleModel(e){return e.uri.toString().startsWith(Xo)}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 Sv(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function Zo(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 Tv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zo(Object(t),!0).forEach(function(r){kr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function kr(n,e,t){return(e=_v(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _v(n){var e=Ov(n,"string");return typeof e=="symbol"?e:e+""}function Ov(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 _l extends m.Component{constructor(e){super(e),kr(this,"container",void 0),kr(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();A(t),De.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=Tv({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),A(this.container),this.editor=De.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[rt.CtrlCmd|Qt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),it.registerLinkProvider("plaintext",{provideLinks:me.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;A(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return d.jsx("div",{className:q("editor-container",e),ref:t=>{this.container=t}})}}kr(_l,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});function Yo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function xv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Yo(o,r,i,a,s,"next",l)}function s(l){Yo(o,r,i,a,s,"throw",l)}a(void 0)})}}function nt(n,e,t){return(e=Iv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iv(n){var e=Dv(n,"string");return typeof e=="symbol"?e:e+""}function Dv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var oi=U.module("ConsoleInput"),jr=parseInt(Si["line-height"],10),Ol=6,xl=6,Mv=jr+Ol+xl,ai=100;class jn extends m.PureComponent{constructor(e){super(e),nt(this,"cancelListener",void 0),nt(this,"resizeObserver",void 0),nt(this,"commandContainer",void 0),nt(this,"commandEditor",void 0),nt(this,"commandHistoryIndex",void 0),nt(this,"commandSuggestionContainer",void 0),nt(this,"loadingPromise",void 0),nt(this,"timestamp",void 0),nt(this,"bufferIndex",void 0),nt(this,"history",void 0),nt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=$.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:jr,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(oi.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r=De.createModel("",e,me.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:jr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ol,bottom:xl},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:r},o=this.commandContainer.current;A(o),this.commandEditor=De.create(o,i),me.setEOL(this.commandEditor),me.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:l}=this,u=s==null?void 0:s.getPosition();A(u);var{lineNumber:c}=u;if(!a.altKey&&!a.shiftKey&&!a.metaKey){if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===(r==null?void 0:r.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(a.keyCode===Qt.Enter&&!this.isSuggestionMenuPopulated()){var h;a.stopPropagation(),a.preventDefault();var v=(h=this.commandEditor)===null||h===void 0?void 0:h.getValue().trim();if(v!==void 0){var f;this.processCommand(v),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}}),me.disableKeyBindings(this.commandEditor,[rt.CtrlCmd|Qt.KeyF]),me.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(o),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(me.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();A(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);A(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();A(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);A(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(r??i),e!==null&&e>this.history.length-ai&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return xv(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=_e.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+ai-1}),e.loadingPromise=_e.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=ai,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,u)=>{var{name:c}=s;return l===0||c!==u[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,_e.isCanceled(s)){oi.debug2("Promise canceled, not loading history");return}oi.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),A(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;A(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),Mv),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return d.jsx("div",{className:q("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:q("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:jn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&d.jsx(H,{model:a,language:t,session:r})]})})}}nt(jn,"defaultProps",{maxHeight:jr*10,scope:null,disabled:!1});nt(jn,"INPUT_CLASS_NAME","console-input");function zt(n,e,t){return(e=Nv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nv(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 Qo="pasted values",jv=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],si=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Jo=[".zip"];class ze extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!jv.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return si.some(r=>e.endsWith(r))||t&&Jo.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Qo?no:e.endsWith(".csv")?pd:e.endsWith(".zip")?gd:bd}constructor(e){super(e),zt(this,"fileElem",void 0),zt(this,"divElem",void 0),zt(this,"getValidExtensions",Yt(t=>t?[...si,...Jo]:[...si])),zt(this,"getAcceptString",Yt(t=>this.getValidExtensions(t).join(", "))),zt(this,"getFileTypeErrorString",Yt(t=>Vs.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=$.createRef(),this.divElem=$.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();A(o),ze.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:ze.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Qo,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:no,action:this.handleMenuPaste,shortcut:qt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:ze.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(ne,{actions:s}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:yd})}),d.jsx("label",{children:"Drop file (or paste values) here to import"}),d.jsx("div",{className:"message-small",children:d.jsx("label",{children:"or"})}),d.jsx(se,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(ve,{icon:ze.getIcon(i)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[i,!r&&d.jsx(se,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Ds,tooltip:"Remove"})]})]})]}),!!a&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:Ms})}),d.jsx("label",{children:a}),a===ze.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}zt(ze,"defaultProps",{allowZip:!1,dragError:null});zt(ze,"MULTIPLE_FILE_ERROR","Please select only one file");zt(ze,"FILE_TYPE_ERROR","Filetype not supported.");function Fi(n,e,t){return(e=Lv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lv(n){var e=Av(n,"string");return typeof e=="symbol"?e:e+""}function Av(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ne{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""}}Fi(Ne,"TYPE_GLOBAL","type-global");Fi(Ne,"TYPE_CONTEXT_PRESET","type-context-preset");Fi(Ne,"TYPE_CONTEXT_CUSTOM","type-context-custom");class Rv extends Ne{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Fv extends Ne{format(e){return String.fromCharCode(e)}}function Kt(n,e,t){return(e=$v(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $v(n){var e=Hv(n,"string");return typeof e=="symbol"?e:e+""}function Hv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ea=U.module("DateTimeColumnFormatter");class pt extends Ne{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]:Ne.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(),Kt(this,"dh",void 0),Kt(this,"dhTimeZone",void 0),Kt(this,"defaultDateTimeFormatString",void 0),Kt(this,"showTimeZone",void 0),Kt(this,"showTSeparator",void 0),Kt(this,"formatStringMap",void 0);var a=t||pt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{ea.error("Unsupported time zone id",a),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{ea.error("Invalid format arguments")}return""}}Kt(pt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Kt(pt,"DEFAULT_TIME_ZONE_ID","America/New_York");var Rt;function Ct(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=Uv(n,"string");return typeof e=="symbol"?e:e+""}function Uv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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=U.module("DecimalColumnFormatter");class Ge extends Ne{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]:Ne.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ge.makeFormat(e,t,Ne.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ge.makeFormat("Custom Format",e,Ne.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ge.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ct(this,"defaultFormatString",void 0),Ct(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{Wv.error("Invalid format arguments")}return""}}Rt=Ge;Ct(Ge,"DEFAULT_FORMAT_STRING","###,##0.0000");Ct(Ge,"FORMAT_PERCENT",Rt.makePresetFormat("Percent","##0.00%"));Ct(Ge,"FORMAT_BASIS_POINTS",Rt.makePresetFormat("Basis Points","###,##0 bp",1e4));Ct(Ge,"FORMAT_THOUSANDS",Rt.makePresetFormat("Thousands","##0.000 k",.001));Ct(Ge,"FORMAT_MILLIONS",Rt.makePresetFormat("Millions","###,##0.000 mm",1e-6));Ct(Ge,"FORMAT_SCIENTIFIC_NOTATION",Rt.makePresetFormat("Scientific Notation","0.0000E0"));Ct(Ge,"FORMAT_ROUND",Rt.makePresetFormat("Round","###,##0"));Ct(Ge,"FORMAT_ROUND_TWO_DECIMALS",Rt.makePresetFormat("0.00","###,##0.00"));Ct(Ge,"FORMAT_ROUND_FOUR_DECIMALS",Rt.makePresetFormat("0.0000","###,##0.0000"));class Vv extends Ne{format(e){return"".concat(e)}}var Kr;function Ln(n,e,t){return(e=Kv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kv(n){var e=zv(n,"string");return typeof e=="symbol"?e:e+""}function zv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Gv=U.module("IntegerColumnFormatter");class Ot extends Ne{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]:Ne.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 Ot.makeFormat(e,t,Ne.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 Ot.makeFormat("Custom Format",e,Ne.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=Ot.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ln(this,"dh",void 0),Ln(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{Gv.error("Invalid format arguments")}return""}}Kr=Ot;Ln(Ot,"DEFAULT_FORMAT_STRING","###,##0");Ln(Ot,"FORMAT_THOUSANDS",Kr.makePresetFormat("Thousands","##0.000 k",.001));Ln(Ot,"FORMAT_MILLIONS",Kr.makePresetFormat("Millions","###,##0.000 mm",1e-6));Ln(Ot,"FORMAT_SCIENTIFIC_NOTATION",Kr.makePresetFormat("Scientific Notation","0.0000E0"));class qv extends Ne{format(e){return e}}function ta(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 na(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ta(Object(t),!0).forEach(function(r){$i(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $i(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=Zv(n,"string");return typeof e=="symbol"?e:e+""}function Zv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Yv=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class Ee{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),h="".concat(i+1).padStart(2,"0"),v="".concat(o).padStart(2,"0"),f="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),b="".concat(u).padStart(9,"0"),w="".concat(c,"-").concat(h,"-").concat(v," ").concat(f,":").concat(p,":").concat(g,".").concat(b);return e.i18n.DateTimeFormat.parse(Ee.FULL_DATE_FORMAT,w,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:u,seconds:c,nanos:h}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;h=Ee.getNextNanos(t.nanos),h>999999999&&(c+=1,h=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var v=new Date(o,a,s,l,u,c);return Ee.makeDateWrapper(e,i,v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),h)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<Ee.months.length;i+=1)if(Ee.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,h=i!=null?parseInt(i,10):0,v=o!=null?parseInt(o,10):0,f=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(h)||Number.isNaN(v)||Number.isNaN(f)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:h,minutes:v,seconds:f,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=Yv.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,u,,c,h]=r;if(!t&&h!=null&&h.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(h));var v={year:i,month:o,date:a,hours:s,minutes:l,seconds:u,nanos:c};return t?na(na({},v),{},{overflow:h}):v}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=Ee.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=Ee.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),h=Ee.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),v=Ee.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[h,v]}if(i==="now"){var f=new Date(Date.now()),p=e.DateWrapper.ofJsDate(f);return[p,null]}var g=Ee.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var b=Ee.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(b==null)throw new Error("Unable to extract date values from ".concat(g));var w=Ee.makeDateWrapper(e,r,b.year,b.month,b.date,b.hours,b.minutes,b.seconds,b.nanos),E=Ee.getNextDate(e,g,b,r);return[w,E]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=Ee.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}$i(Ee,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");$i(Ee,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function HC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function BC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=Il(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function Il(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function Qv(n,e,t,r){return Il(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function UC(n,e,t,r,i){return function(a){var s=a==null?void 0:a.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function WC(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function VC(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Hi(n,e,t){return(e=Jv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jv(n){var e=ef(n,"string");return typeof e=="symbol"?e:e+""}function ef(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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{}Hi(Jn,"not","not");Hi(Jn,"and","and");Hi(Jn,"or","or");function KC(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function Ce(n,e,t){return(e=tf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tf(n){var e=nf(n,"string");return typeof e=="symbol"?e:e+""}function nf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class T{}Ce(T,"eq","eq");Ce(T,"eqIgnoreCase","eqIgnoreCase");Ce(T,"notEq","notEq");Ce(T,"notEqIgnoreCase","notEqIgnoreCase");Ce(T,"greaterThan","greaterThan");Ce(T,"greaterThanOrEqualTo","greaterThanOrEqualTo");Ce(T,"lessThan","lessThan");Ce(T,"lessThanOrEqualTo","lessThanOrEqualTo");Ce(T,"in","in");Ce(T,"inIgnoreCase","inIgnoreCase");Ce(T,"notIn","notIn");Ce(T,"notInIgnoreCase","notInIgnoreCase");Ce(T,"isTrue","isTrue");Ce(T,"isFalse","isFalse");Ce(T,"isNull","isNull");Ce(T,"invoke","invoke");Ce(T,"contains","contains");Ce(T,"notContains","notContains");Ce(T,"containsIgnoreCase","containsIgnoreCase");Ce(T,"startsWith","startsWith");Ce(T,"endsWith","endsWith");Ce(T,"containsAny","containsAny");var rf="DH_ITEM_KEY",ra=U.module("ViewportDataUtils");function Dl(n){return"".concat(rf,"_").concat(n)}function zC(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;ra.debug("table updated",i.detail);var l=new Map;s.forEach((u,c)=>{var h=e(u,o),v=Dl(a+c);l.set(v,{key:v,item:h})}),ra.debug("update keys",l),t(l)}}function GC(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*qC(n,e){for(var t=n;t<=e;++t)yield{key:Dl(t)}}function of(n){return n==null||af(n)?0:n.size}function af(n){return n!=null&&typeof n=="object"&&"isClosed"in n&&typeof n.isClosed=="boolean"?n.isClosed:!1}function XC(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=eo(n-t,o,a),l=eo(i+t,o,a);return[s,l]}var wi;function ia(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Wt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ia(o,r,i,a,s,"next",l)}function s(l){ia(o,r,i,a,s,"throw",l)}a(void 0)})}}function Cn(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=lf(n,"string");return typeof e=="symbol"?e:e+""}function lf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mt=U.module("TableUtils");function ZC(n){return n===y.sortDirection.ascending||n===y.sortDirection.descending||n===y.sortDirection.reverse||n===y.sortDirection.none}class y{static copyTableAndApplyFilters(e){var t=arguments;return Wt(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(ti(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=y.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return y.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:y.isCharType(e)||y.isNumberType(e)||y.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:y.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,r){var i=e[r];if(i==null)return null;var o=y.getSortForColumn(t,i.name);return o===null?this.makeColumnSort(e,r,y.sortDirection.ascending,!1):o.direction===y.sortDirection.ascending?this.makeColumnSort(e,r,y.sortDirection.descending,!1):null}static makeColumnSort(e,t,r,i){var o=e[t];return o==null||r===y.sortDirection.none?null:{column:{name:o.name,type:o.type},isAbs:i,direction:r}}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t[r]==null)return[];var o=y.getNextSort(t,e,r);return y.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=y.makeColumnSort(t,r,i,o);return y.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=y.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==y.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case y.dataType.BOOLEAN:return y.dataType.BOOLEAN;case"char":case"java.lang.Character":case y.dataType.CHAR:return y.dataType.CHAR;case"java.lang.String":case y.dataType.STRING:return y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case y.dataType.DATETIME:return y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case y.dataType.DECIMAL:return y.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case y.dataType.INT:return y.dataType.INT;default:return y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return y.isIntegerType(e)||y.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return y.getNormalizedType(e)===y.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return _e.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return y.makeCancelableEventPromise(e,t,{timeout:r,matcher:i??void 0})}static makeCancelableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{timeout:i=0,matcher:o}=r,a,s,l=!0,u=new Promise((c,h)=>{s=setTimeout(()=>{a(),l=!1,h(new bs('Event "'.concat(t,'" timed out.')))},i),a=e.addEventListener(t,v=>{if(o!=null&&!o(v)){Mt.debug2("Event triggered, but matcher returned false.");return}Mt.debug2("Event triggered, resolving."),a(),clearTimeout(s),l=!1,c(v)})});return u.cancel=()=>{if(l){Mt.debug2("Pending promise cleanup."),a(),clearTimeout(s),l=!1;return}Mt.debug2("Ignoring non-pending promise cancel.")},u}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=y.removeCommas(t);if(y.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return Vs.sort(o,a,t)})}constructor(e){Cn(this,"dh",void 0),this.dh=e,Vd(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return Wt(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(a=yield e.copy(),yield a.applyFilter(ti(...l.map(f=>f(a)))));var c=a.findColumn(t),h=yield a.selectDistinct([c]);a!==e&&a.close();var v=h.findColumn(t).sort()[r]();return o.applySort(h,[v])})()}doesColumnValueExist(e,t,r,i){var o=this;return Wt(function*(){if(e==null)return null;var a=Qv(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,ti(a(s)));var l=of(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=y.getNormalizedType(e);switch(t){case y.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case y.dataType.CHAR:case y.dataType.STRING:return this.dh.ValueType.STRING;case y.dataType.DATETIME:return this.dh.ValueType.DATETIME;case y.dataType.DECIMAL:case y.dataType.INT:return y.isBigDecimalType(e)||y.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),u=null,c=0;c<l.length;c+=1){var h=l[c].trim();if(h.length>0){var v=this.makeQuickFilterFromComponent(e,h,r);if(v)u?u=u.and(v):u=v;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&u?o=o.or(u):o=u}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return y.isNumberType(i)?this.makeQuickNumberFilter(e,t):y.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&y.isDateType(i)?this.makeQuickDateFilter(e,t,r):y.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,u=null,c=null,h=null,v=null;if(s!==null&&s.length>3&&([,l,u,c,h,v]=s),v!=null&&v.trim().length>0)return null;if(l==null&&(l="="),h!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(h=h.trim().toLowerCase(),h){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(c==null)return null;if(c=y.removeCommas(c),y.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(f){return Mt.warn("Unable to create long filter",f),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return o=e.filter(),y.makeRangeFilterWithOperation(o,l,c)}static escapeQuickTextFilter(e){if(e==null)return null;var t=/^(!~|!=|~|=|!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null?"\\".concat(o).concat(a??""):a!=null&&r.test(a.toLowerCase())||a!=null&&a.startsWith("*")?"\\".concat(a):a!=null&&a.endsWith("*")&&!a.endsWith("\\*")?(a=a.substring(0,a.length-1),"".concat(a,"\\*")):"".concat(o??"").concat(a??"")}static unescapeQuickTextFilter(e){var t=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null&&(o=o.replace("\\","")),a!=null&&r.test(a.toLowerCase())&&(a=a.replace("\\","")),o==null&&a!=null&&a.startsWith("\\*")&&(a=a.substring(1)),o==null&&a!=null&&a.endsWith("\\*")?(a=a.substring(0,a.length-2),"".concat(a,"*")):"".concat(o??"").concat(a??"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,h=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(h="*",l=l.substring(0,l.length-1)),l=y.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):h==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):h==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),u=e.filter();try{var c=y.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var u=T.eq;switch(s){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=Ee.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,u=s!=null?o.FilterValue.ofNumber(s):null,c=e.filter();if(l==null)return r===T.notEq?c.isNull().not():c.isNull();switch(r){case T.eq:{if(u!=null){var h=c.greaterThanOrEqualTo(l),v=c.lessThan(u);return h.and(v)}return c.eq(l)}case T.lessThan:return c.lessThan(l);case T.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case T.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case T.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case T.notEq:{if(u!=null){var f=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return f.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,u=null;if(a!==null&&a.length>3&&([,s,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var c=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var h=r.FilterValue.ofString(y.isRangeOperation(s)?y.quoteValue(l):l);return y.makeRangeFilterWithOperation(c,s,h)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:h,value:v}=c;if(h!=null&&h.length>0&&v!=null&&v.length>0)try{var f=this.makeAdvancedValueFilter(e,h,v,r);if(f!=null){if(u===0)l=f;else if(l!==null&&u-1<o.length){var p=o[u-1];if(p===Jn.and)l=l.and(f);else if(p===Jn.or)l=l.or(f);else{Mt.error("Unexpected filter operator",p,f),l=null;break}}}else Mt.debug2("Empty filter ignored for",h,v)}catch(b){Mt.error("Unable to create filter",b),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(y.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(y.isNumberType(e.type)||y.isCharType(e.type))return this.makeQuickFilter(e,"".concat(y.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case T.eq:return s.eq(a);case T.eqIgnoreCase:return s.eqIgnoreCase(a);case T.notEq:return s.notEq(a);case T.notEqIgnoreCase:return s.notEqIgnoreCase(a);case T.greaterThan:return s.greaterThan(a);case T.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case T.lessThan:return s.lessThan(a);case T.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case T.isTrue:return s.isTrue();case T.isFalse:return s.isFalse();case T.isNull:return s.isNull();case T.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case T.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case T.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case T.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return A(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,Ee.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return A(a),a}return y.isBigDecimalType(e.type)||y.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return Wt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return Wt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return Wt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return Wt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;y.isTextType(e.type)?r=t.FilterValue.ofString("a"):y.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):y.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=y.getBaseType(e);return y.isTextType(i)?r.FilterValue.ofString(t):y.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(y.removeCommas(t))):r.FilterValue.ofNumber(y.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return y.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):y.isTextType(e)?r.FilterValue.ofString(t):y.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(y.isTextType(e))return t;if(y.isLongType(e))return i.LongWrapper.ofString(y.removeCommas(t));if(y.isBooleanType(e))return y.makeBooleanValue(t,!0);if(y.isDateType(e)){var[o]=Ee.parseDateRange(i,t,r);return o}return y.isNumberType(e)?y.makeNumberValue(t):(Mt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:y.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):y.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}wi=y;Cn(y,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});Cn(y,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});Cn(y,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);Cn(y,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));Cn(y,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);Cn(y,"executeAndWaitForEvent",function(){var n=Wt(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:wi.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=wi.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function En(n,e,t){return(e=uf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uf(n){var e=df(n,"string");return typeof e=="symbol"?e:e+""}function df(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Ml{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=y.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o==null||o.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rs,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;En(this,"defaultColumnFormatter",void 0),En(this,"typeFormatterMap",void 0),En(this,"columnFormatMap",void 0),En(this,"truncateNumbersWithPound",void 0),En(this,"showEmptyStrings",void 0),En(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Vv,this.typeFormatterMap=new Map([[y.dataType.BOOLEAN,new Rv],[y.dataType.CHAR,new Fv],[y.dataType.DATETIME,new pt(e,r)],[y.dataType.DECIMAL,new Ge(e,i)],[y.dataType.INT,new Ot(e,o)],[y.dataType.STRING,new qv]]),this.columnFormatMap=Ml.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=y.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=y.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(y.dataType.DATETIME);return Cd(e,pt),e.dhTimeZone.id}}function Sn(n,e,t){return(e=cf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cf(n){var e=hf(n,"string");return typeof e=="symbol"?e:e+""}function hf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ee{}Sn(ee,"INTEGER","int");Sn(ee,"LONG","long");Sn(ee,"DOUBLE","double");Sn(ee,"BOOLEAN","bool");Sn(ee,"STRING","string");Sn(ee,"DATE_TIME","datetime");Sn(ee,"LOCAL_TIME","localtime");function Nl(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 oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(r){We(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function We(n,e,t){return(e=mf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mf(n){var e=vf(n,"string");return typeof e=="symbol"?e:e+""}function vf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var sa="unknown",ff=2147483647,pf=-2147483648,la=/^[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]+)?$/,ua=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Le{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case ee.STRING:return ee.STRING;case ee.INTEGER:return Le.checkInteger(e);case ee.LONG:return Le.checkLong(e);case ee.DOUBLE:return Le.checkDouble(e);case ee.BOOLEAN:return Le.checkBoolean(e);case ee.DATE_TIME:return Le.checkDateTime(e);case ee.LOCAL_TIME:return Le.checkLocalTime(e);default:return Le.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Le.isNotParsableNumber(t)?ee.STRING:Le.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Le.isNotParsableNumber(t)?ee.STRING:t.includes(".")?ee.DOUBLE:ee.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Le.isNotParsableNumber(t)?ee.STRING:ee.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ee.BOOLEAN:ee.STRING}static checkDateTime(e){return la.test(e)?ee.DATE_TIME:ee.STRING}static checkLocalTime(e){return ua.test(e)?ee.LOCAL_TIME:ee.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Le.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?ee.BOOLEAN:la.test(e)&&e.includes(":")?ee.DATE_TIME:ua.test(e)?ee.LOCAL_TIME:ee.STRING}return Le.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ee.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ee.LONG;var r=parseInt(e,10);return r>ff||r<pf?ee.LONG:ee.INTEGER}constructor(e,t,r,i,o,a,s,l,u,c){We(this,"onFileCompleted",void 0),We(this,"file",void 0),We(this,"readHeaders",void 0),We(this,"nullString",void 0),We(this,"onProgress",void 0),We(this,"onError",void 0),We(this,"types",void 0),We(this,"chunks",void 0),We(this,"totalChunks",void 0),We(this,"rowCount",void 0),We(this,"isZip",void 0),We(this,"shouldTrim",void 0),We(this,"zipProgress",void 0),We(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=c,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=aa(aa({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Gn.parse(this.file,this.config);else{var e=Nl(this.file,this.handleNodeUpdate);Gn.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(sa),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,A(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=Le.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-B8AgOqqz.js","./Plotly-vX2C_V02.js","./plotly-x103-xtU.js","./helpers-BosuxZz1.js","./vendor-V8Io1aAM.js","./vendor-CxhKlw2o.css","./MarkdownNotebook-D-Qhu6GW.js","./index-CBmjXWjj.js","./monaco-DaE0jI-i.js","./monaco-CgHo24-M.css","./index-CwMW8ik0.css","./mathjax-DBtzGpr4.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as m,a0 as gn,bA as Hr,I as d,bF as Du,U as $,bG as gs,ac as mi,L as bs,K as q,R as Br,bH as Mu,bI as Nu,M as ve,H as _t,bJ as ku,a8 as ju,a9 as Lu,G as ys,a1 as On,bK as Au,bL as Ru,bM as Fu,bN as $u,bD as Yn,bO as Hu,a6 as Bu,a5 as Uu,bz as no,bP as Wu,bQ as Vu,ad as Qt,av as ro,bR as Gn,bS as D,bT as io,bE as ye,a3 as Li,af as Cs,bU as Ku,_ as Fn}from"./vendor-V8Io1aAM.js";import{aC as Ss,L as U,aZ as ws,W as Es,$ as zu,ai as Gu,aj as qu,ah as Xu,ar as Zu,ad as Yu,aw as Qu,M as Ps,b as Ts,c as _s,aK as Ju,a_ as ed,a$ as Os,b0 as xs,b1 as td,b2 as nd,N as bn,aA as rd,b3 as id,b4 as od,b5 as ad,b6 as sd,b7 as ld,b8 as ud,b9 as dd,ba as cd,bb as hd,bc as md,E as Is,aY as vd,aV as Ds,aW as fd,a3 as Ms,k as pd,e as A,d as vi,bd as gd,be as bd,au as Ns,bf as oo,bg as yd,bh as Cd,bi as Sd,bj as wd,f as ks,aO as js,bk as Ed,bl as Ls,bm as Mn,aU as Pd,bn as Td,H as ao,bo as As,q as so,bp as Rs,bq as _d,K as Od,ak as xd,br as Id,C as Dd,al as Md,bs as Nd,bt as kd,bu as jd,bv as Ld,bw as Ad,bx as Rd,by as Fd,aQ as $d,bz as Hd,bA as Bd}from"./index-CBmjXWjj.js";import{e as De,M as Ud,b as lo,l as it,R as Fs,K as rt,c as Jt,d as uo,U as Wd,_ as $s}from"./monaco-DaE0jI-i.js";var Hs=Object.freeze([]),aC=new Map,Bs=()=>{};function sC(n){return Array.isArray(n)?n:[n]}function ti(){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 Vd(n,e,t){return(e=Kd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kd(n){var e=zd(n,"string");return typeof e=="symbol"?e:e+""}function zd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 co extends Error{constructor(){super(...arguments),Vd(this,"isCanceled",!0)}}function Gd(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=qd(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function qd(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Xd(n,e,t){return(e=Zd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zd(n){var e=Yd(n,"string");return typeof e=="symbol"?e:e+""}function Yd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Qd extends Error{constructor(){super(...arguments),Xd(this,"isClipboardPermissionsDeniedError",!0)}}function Jd(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=tc(n,"string");return typeof e=="symbol"?e:e+""}function tc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ni extends Error{constructor(){super(...arguments),Jd(this,"isClipboardUnavailableError",!0)}}function nc(n,e,t){return(e=rc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rc(n){var e=ic(n,"string");return typeof e=="symbol"?e:e+""}function ic(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Us extends Error{constructor(){super(...arguments),nc(this,"isPermissionUnsupported",!0)}}function ho(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function oc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ho(o,r,i,a,s,"next",l)}function s(l){ho(o,r,i,a,s,"throw",l)}a(void 0)})}}function mo(n){return fi.apply(this,arguments)}function fi(){return fi=oc(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Us:t}}),fi.apply(this,arguments)}function vo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ws(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){vo(o,r,i,a,s,"next",l)}function s(l){vo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Vs(n){return pi.apply(this,arguments)}function pi(){return pi=Ws(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}ac(n)}),pi.apply(this,arguments)}function ac(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 lC(){return gi.apply(this,arguments)}function gi(){return gi=Ws(function*(){try{var{clipboard:n}=navigator;if(n===void 0)throw new ni;var e=yield mo("clipboard-read");if(e==="granted"){var t=yield n.readText();return t}if(e==="prompt"){try{yield n.readText()}catch{}if(e=yield mo("clipboard-read"),e==="granted"){var r=yield n.readText();return r}}if(e==="prompt"||e==="denied")throw new Qd}catch(i){throw i instanceof Us?new ni:i}throw new ni}),gi.apply(this,arguments)}var $n;function yn(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=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)}var uc="table_",Ks="column_",dc=new Set(["in","not","i","ii","k"]),cc=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"]),hc=/[^a-zA-Z0-9_$\-+@]/g,mc=/[^A-Za-z0-9_$]/g,vc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,fc=/[^a-zA-Z0-9_]/g;function pc(n){return n.replace(/[ -]/g,"_")}function gc(n){return n.replace(/\s/g,"_")}class It{}$n=It;yn(It,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(dc.has(a)||cc.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});yn(It,"legalizeTableName",n=>$n.legalize(n,gc,uc,hc,!1,0));yn(It,"makeVariableName",n=>$n.legalizeTableName(n).replace(fc,"_"));yn(It,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=$n.legalizeColumnName(t,r);e.includes(i)&&(i=Ks+r),e.push(i)}),e});yn(It,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return $n.legalize(n,pc,Ks,mc,!0,e)});yn(It,"isValidTableName",n=>vc.test(n));yn(It,"isValidColumnName",n=>$n.legalizeColumnName(n)===n);class zs extends CustomEvent{constructor(e,t){super(e,t)}}class _e{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{r=!0,o(new co),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof co}static isTimedOut(e){return e instanceof Ss}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function fo(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=yc(n,"string");return typeof e=="symbol"?e:e+""}function yc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nr{constructor(){fo(this,"pending",[]),fo(this,"resolved",[])}add(e,t){var r=_e.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function uC(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 ft{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(!ft.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(l<=r&&i<=u)return o;r<=u&&l<=i&&(r=Math.min(r,l),i=Math.max(i,u),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],u=s[1];if(!(i<l||u<r))if(l<r&&i<u){o[a]=[l,r-1],o.splice(a+1,0,[i+1,u]);break}else r<=l&&u<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,u]}return o}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*dC(n,e){for(var t=n;t<=e;++t)yield t}var cC=" ";class Gs{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 rr;function tn(n,e,t){return(e=Cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:e+""}function Sc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class qe{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(qe.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}static formatDuration(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(r,"m ").concat(i,"s"):r>0?"".concat(r,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"ms";if(e==null||t===""||t===0||t==null)return null;var i=1,o=null,a=null;if(r==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(r==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}rr=qe;tn(qe,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");tn(qe,"MILLIS_PER_SECOND",1e3);tn(qe,"NANOS_PER_SECOND",1e9);tn(qe,"NANOS_PER_MIN",60*rr.NANOS_PER_SECOND);tn(qe,"NANOS_PER_HOUR",60*rr.NANOS_PER_MIN);tn(qe,"MILLIS_PER_MIN",60*rr.MILLIS_PER_SECOND);tn(qe,"MILLIS_PER_HOUR",60*rr.MILLIS_PER_MIN);tn(qe,"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 wc(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 qn extends Error{constructor(){super(...arguments),wc(this,"isInvalid",!0)}}function qs(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function po(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Tc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){po(o,r,i,a,s,"next",l)}function s(l){po(o,r,i,a,s,"throw",l)}a(void 0)})}}var _c=U.module("useAsyncInterval");function Oc(n,e){var t=qs(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Tc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(h){_c.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),c=Math.max(0,e-u);r.current=window.setTimeout(a,c)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function ir(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(n);if(t==null)throw new Error(e);return t}function xc(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:r=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>gn(n,e,o!=null?{leading:r,trailing:i,maxWait:o}:{leading:r,trailing:i}),[n,e,r,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function Ic(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Dc(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Hr(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Xs(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var Mc=3500,Nc=U.module("useCopyToClipboard");function kc(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{Vs(i).then(()=>{e(!0)}).catch(o=>Nc.error("Unable to copy ".concat(i),`
|
|
3
|
+
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},Mc)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}var jc=["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 Lc(n){return typeof n=="string"&&jc.includes(n)}function Zs(n){return n!=null&&Lc(n)?"var(--dh-color-".concat(n,")"):n}var Ac=["color","UNSAFE_style"];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 mr(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){Rc(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 Rc(n,e,t){return(e=Fc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fc(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)}function Hc(n,e){if(n==null)return{};var t,r,i=Bc(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 Bc(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=m.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=Hc(n,Ac),o=m.useMemo(()=>mr(mr({},r),{},{color:Zs(t)}),[t,r]);return d.jsx(Du,mr(mr({},i),{},{ref:e,UNSAFE_style:o}))});Ys.displayName="Text";function bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ht(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bo(Object(t),!0).forEach(function(r){xn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xn(n,e,t){return(e=Uc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uc(n){var e=Wc(n,"string");return typeof e=="symbol"?e:e+""}function Wc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 yo="popper",Vc={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(n,e)=>{var t,r,i=(t=gs.Defaults.modifiers)===null||t===void 0||(t=t.preventOverflow)===null||t===void 0||(r=t.fn)===null||r===void 0?void 0:r.call(t,n,e);return i==null?n:(i.styles.maxHeight="".concat(document.documentElement.clientHeight-n.offsets.popper.top-2*e.padding,"px"),i??n)}},flip:{enabled:!1}}};class Ur extends m.Component{constructor(e){super(e),xn(this,"element",void 0),xn(this,"container",void 0),xn(this,"nodeRef",$.createRef()),xn(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=$.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:a,keepInParent:s}=this.props,l=s?Vc:{placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},u=Ht(Ht(Ht({},l),a),{},{modifiers:Ht(Ht(Ht({},l.modifiers),a.modifiers),{},{preventOverflow:Ht(Ht({},(e=l.modifiers)===null||e===void 0?void 0:e.preventOverflow),(t=a.modifiers)===null||t===void 0?void 0:t.preventOverflow)})});document.body.appendChild(this.element);var c=this.getVisibleElement(this.container.current);c==null&&(c=this.container.current);var h=new gs(o||c,this.element,u);h.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(i){var v=this.element.querySelector(".".concat(yo));v instanceof HTMLElement&&!v.contains(document.activeElement)&&v.focus()}}),mi.flushSync(()=>{this.setState({popper:h})})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),mi.flushSync(()=>{this.setState({show:!0})})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){var{closeOnBlur:t,onBlur:r}=this.props;e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||(r==null||r(e),t&&this.hide()))}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return d.jsx(ws,{isPortal:!0,children:d.jsx(bs,{in:a,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,nodeRef:this.nodeRef,children:d.jsx("div",{ref:this.nodeRef,onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:q(yo,{interactive:i},e),onBlur:this.handleBlur,tabIndex:o?-1:void 0,role:"presentation",children:d.jsxs("div",{className:"popper-content",children:[t,d.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return d.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Br.createPortal(this.renderContent(),this.element)})}}xn(Ur,"defaultProps",{options:{},className:"",timeout:Es.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,referenceObject:null,"data-testid":void 0});var bi;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 Kc(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){gt(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 gt(n,e,t){return(e=zc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zc(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 qc=U.module("Tooltip");class he extends m.Component{static handleHidden(){he.shownTooltipCount-=1,he.shownTooltipCount===0&&(he.lastHiddenTime=Date.now())}static handleShown(){he.shownTooltipCount+=1}constructor(e){super(e),gt(this,"container",void 0),gt(this,"popper",void 0),gt(this,"parent",void 0),gt(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=$.createRef(),this.popper=$.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?he.handleShown():he.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&he.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){qc.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(he.shownTooltipCount>0||Date.now()-he.lastHiddenTime<he.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),mi.flushSync(()=>{this.setState({isShown:!0})});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Kc({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Ur,{className:q(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:r,children:d.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}bi=he;gt(he,"defaultTimeout",500);gt(he,"defaultReshowTimeout",100);gt(he,"triggerReshowThreshold",300);gt(he,"shownTooltipCount",0);gt(he,"lastHiddenTime",Date.now());gt(he,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:bi.defaultReshowTimeout,timeout:bi.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var Xc=U.module("ThemeProvider"),Ai=m.createContext(null);Ai.displayName="ThemeContext";function hC(n){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:r=zu,children:i}=n,o=m.useMemo(()=>Gu(),[]),[a,s]=m.useState(null),[l,u]=m.useState(qu),c=m.useMemo(()=>e==null?null:Xu(l,{base:o,custom:e??[]}),[o,l,e]),h=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(c==null||e==null)){Zu(r);var f=Yu(r);Xc.debug2("updateThemePreloadData:",{active:c.map(p=>p.themeKey),custom:e.map(p=>p.themeKey),preloadStyleContent:f,selectedThemeKey:l}),Qu({themeKey:l,preloadStyleContent:f})}},[c,l,e,r]),m.useEffect(()=>{s({activeThemes:c,selectedThemeKey:l,themes:h,setSelectedThemeKey:u})},[c,l,h]),t&&c==null?null:d.jsxs(d.Fragment,{children:[c==null?null:d.jsx(d.Fragment,{children:c.map(v=>d.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:d.jsx(Ai.Provider,{value:a,children:d.jsx(ws,{children:i})})]})}function Qs(){return ir(Ai,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var Zc=["color","UNSAFE_style"];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 vr(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){Yc(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 Yc(n,e,t){return(e=Qc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qc(n){var e=Jc(n,"string");return typeof e=="symbol"?e:e+""}function Jc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 eh(n,e){if(n==null)return{};var t,r,i=th(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 th(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var Js=m.forwardRef((n,e)=>{var{color:t,UNSAFE_style:r}=n,i=eh(n,Zc),o=m.useMemo(()=>vr(vr({},r),{},{color:Zs(t)}),[t,r]);return d.jsx(Mu,vr(vr({},i),{},{ref:e,UNSAFE_style:o}))});Js.displayName="Heading";function nh(n){var{children:e,className:t,style:r,"data-testid":i}=n;return d.jsx("div",{className:q("btn-group",t),style:r,role:"group","data-testid":i,children:e})}var rh=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function wo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Eo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(r){ih(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function 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=ah(n,"string");return typeof e=="symbol"?e:e+""}function ah(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 sh(n,e){if(n==null)return{};var t,r,i=lh(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 lh(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 uh(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 q("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function dh(n){switch(n){case"group-end":return q("pl-2","pr-3")}}var se=$.forwardRef((n,e)=>{var{kind:t,variant:r,type:i="button",tooltip:o,icon:a,disabled:s=!1,active:l,onClick:u,onContextMenu:c,onMouseDown:h,onMouseUp:v,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,className:b,style:w,children:E,tabIndex:P,"data-testid":R,"aria-label":Z}=n,re=sh(n,rh),{UNSAFE_className:Y}=Nu({},"button"),k;r&&(k=dh(r));var B;a&&(B=$.isValidElement(a)?a:d.jsx(ve,{icon:a}));var Q=B!=null&&E==null,G=uh(t,Q),L;o!==void 0&&(L=typeof o=="string"?d.jsx(he,{children:o}):o);var W=Z;Z===void 0&&Q&&o!=null&&typeof o=="string"&&(W=o);var X=d.jsxs("button",Eo(Eo({"data-testid":R,ref:e,type:i,className:q("btn",G,k,{active:l},b,Y),onClick:u,onContextMenu:c,onMouseUp:v,onMouseDown:h,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,style:w,disabled:s,tabIndex:P,"aria-label":W},re),{},{children:[a&&B,E,o!=null&&!s&&L]}));return s&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[X,L]}):X});se.displayName="Button";function el(n){var{className:e,children:t,"data-testid":r}=n;return d.jsx("div",{className:q("modal-footer",e),"data-testid":r,children:t})}function Qn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:c="Discard",isConfirmDanger:h=!1,children:v,"data-testid":f}=n,p=m.useRef(null),g=m.useRef(null),b=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),w=m.useCallback(()=>{var P;(P=p.current)===null||P===void 0||P.focus()},[]),E="";return e&&(E=typeof r=="function"?r():r),d.jsxs(Ps,{isOpen:e,onOpened:w,children:[d.jsx(Ts,{closeButton:!1,children:t}),d.jsx(_s,{children:E}),d.jsxs(el,{children:[s&&d.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[d.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),d.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&d.jsx(se,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:c}),i&&d.jsx(se,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),d.jsxs(nh,{children:[d.jsx(se,{kind:h?"danger":"primary",onClick:b,ref:p,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:u}),v]})]})]})}function ch(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=mh(n,"string");return typeof e=="symbol"?e:e+""}function mh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ri(n){return n.then!==void 0}class Pe{static disableAllActions(){Pe.actionsDisabled=!0}static enableAllActions(){Pe.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,a;return((o=e.order)!==null&&o!==void 0?o:0)>((a=t.order)!==null&&a!==void 0?a:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(Pe.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Pe.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Pe.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var a=i[o],s=void 0;typeof a=="function"?s=a():s=a,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var a=(i+t*o+r.length)%r.length,s=r[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}ch(Pe,"actionsDisabled",!1);var Po=U.module("GlobalContextAction");class vh extends m.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:r}=this.props;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),Po.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Pe.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;Po.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class fh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){var s=d.jsx(vh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));r.push(s)}}return r}}function tl(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=gh(n,"string");return typeof e=="symbol"?e:e+""}function gh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var fr=U.module("ContextActions");class ne extends m.Component{static triggerMenu(e,t,r,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:r,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),tl(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=$.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=>!ri(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!ri(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:r}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0){for(var r=e.target,i=function(){var{classList:u}=r,c=t.find(h=>u.contains(h));if(c!==void 0)return fr.debug2('Contextmenu event ignored based on the target className "'.concat(c,'"')),{v:void 0};r=r.parentElement},o;r!=null;)if(o=i(),o)return o.v}if(Pe.isContextActionEvent(e)||(e.contextActions=[]),!!Pe.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>ri(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}fr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,r=0;r<t.length;r+=1){var i=t[r];if(!Pe.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;fr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),fr.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return d.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:d.jsx(fh,{actions:t})})}}tl(ne,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var nl=$.forwardRef((n,e)=>{var t,r,{closeMenu:i,children:o,menuItem:a,onMenuItemClick:s,onMenuItemMouseMove:l,onMenuItemContextMenu:u,isKeyboardSelected:c=!1,isMouseSelected:h=!1,"data-testid":v}=n,f=m.useCallback(G=>{s(a,G)},[a,s]),p=m.useCallback(G=>{l(a,G)},[a,l]),g=m.useCallback(G=>{u(a,G)},[a,u]);function b(G,L,W){if(typeof G.type=="string")return G;var X={menuItem:a,closeMenu:i,isKeyboardSelected:c,isMouseSelected:h,iconElement:L,displayShortcut:W,"data-testid":v};return $.cloneElement(G,{forwardedProps:X})}var w=(t=a.shortcutText)!==null&&t!==void 0?t:(r=a.shortcut)===null||r===void 0?void 0:r.getDisplayText(),E=null;if(a.icon){var P=a.icon;if($.isValidElement(P))E=P;else{var R;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(R={color:a.iconColor}),E=d.jsx(ve,{icon:P,style:R})}}var Z=null,re=!!o;a.actions&&(Z=d.jsx(ve,{icon:Ju}));var Y=null;if(a.menuElement)Y=d.jsx("div",{className:"custom-menu-item",onMouseMove:p,children:b(a.menuElement,E,w)});else{var k,B=a.disabled,Q=a.iconOutline;Y=d.jsx("button",{type:"button",className:q("btn-context-menu",{disabled:B},{active:(re||h)&&(B===void 0||!B)},{"keyboard-active":c&&(B===void 0||!B)}),onClick:f,onMouseMove:p,onContextMenu:g,title:(k=a.description)!==null&&k!==void 0?k:"",children:d.jsxs("div",{className:"btn-context-menu-wrapper",children:[d.jsx("span",{className:q("icon",{outline:Q}),children:E}),d.jsx("span",{className:"title",children:a.title}),w!==void 0&&d.jsx("span",{className:"shortcut",children:w}),Z&&d.jsx("span",{className:q("submenu-indicator",{disabled:B}),children:Z})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,Y]})});nl.displayName="ContextMenuItem";var rl=$.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o=!1,inputClassName:a,isInvalid:s=!1,labelClassName:l,name:u,onChange:c,"data-testid":h}=n,[v]=m.useState(_t()),f=Xs(e);m.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var p=m.useCallback(g=>{f.current&&(f.current.indeterminate=t===null),c&&c(g)},[f,t,c]);return d.jsxs("div",{className:q("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:q("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:u,onChange:p,"data-testid":h}),d.jsx("label",{className:q("custom-control-label",l),htmlFor:v,children:r})]})});rl.displayName="Checkbox";function Mr(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function il(n){return Mr(n)&&il(n.WrappedComponent)?!0:n.prototype!=null&&n.prototype.isReactComponent!=null}function bh(n){return!Mr(n)&&"$$typeof"in n&&n.$$typeof===ku.ForwardRef}function ol(n){return il(n)||bh(n)}var yh=["copy","tooltip","children"];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 _o(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){Ch(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 Ch(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=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)}function Eh(n,e){if(n==null)return{};var t,r,i=Ph(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 Ph(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 Oo="Copy";function al(n){var{copy:e,tooltip:t=Oo,children:r}=n,i=Eh(n,yh),[o,a]=kc(),s=o?"Copied":t;return d.jsxs(ju,_o(_o({},i),{},{"aria-label":s,onPress:()=>{a(typeof e=="function"?e():e)},children:[d.jsx(Lu,{UNSAFE_className:r==null?"action-button-icon-with-tooltip":void 0,children:d.jsx(ve,{icon:o?ed:Os})}),r!=null&&d.jsx(Ys,{children:r}),(r==null||s!==Oo)&&d.jsx(he,{children:s})]}))}al.displayName="CopyButton";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 Th(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){Xn(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 Xn(n,e,t){return(e=_h(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _h(n){var e=Oh(n,"string");return typeof e=="symbol"?e:e+""}function Oh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 sl extends m.PureComponent{constructor(e){var t;super(e),Xn(this,"container",void 0),Xn(this,"oldFocus",void 0),Xn(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=$.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:r}=e,i=(t=r.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Pe.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:Pe.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=Pe.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=Pe.getNextMenuItem(i??0,1,t)),r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(d.jsx("hr",{},"".concat(a,".separator")));var l=d.jsx(nl,{isKeyboardSelected:r===a,isMouseSelected:o===a,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(l)}var{menuStyle:u}=this.props;return d.jsx("div",{className:"context-menu-container",style:Th({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Xn(sl,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});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 Do(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){In(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 In(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 or extends m.PureComponent{constructor(e){super(e),In(this,"container",void 0),In(this,"parent",void 0),In(this,"popper",void 0),In(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=$.createRef(),this.parent=null,this.popper=$.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=Do({placement:"bottom"},s),a=Do({separateKeyboardMouse:!0},a),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Ur,{ref:this.popper,options:s,className:q("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(sl,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}In(or,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Kt(n,e,t){return(e=Dh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dh(n){var e=Mh(n,"string");return typeof e=="symbol"?e:e+""}function Mh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mo=U.module("Shortcut"),I=function(n){return n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n}({}),_=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}({}),Nh=new Set([_.ENTER,_.DELETE,_.F1,_.F2,_.F3,_.F4,_.F5,_.F6,_.F7,_.F8,_.F9,_.F10,_.F11,_.F12]);class Se extends ys{static isAllowedKey(e){return Object.values(_).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!Se.isMacPlatform&&e.metaKey||!Se.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Nh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case I.CTRL:t.ctrlKey=!0;break;case I.ALT:case I.OPTION:t.altKey=!0;break;case I.CMD:t.metaKey=!0;break;case I.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:r}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!Se.isAllowedKey(t)&&Se.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===_.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 _.ENTER:t+="⏎";break;case _.ESCAPE:t+="⎋";break;case _.BACKSPACE:t+="⌫";break;case _.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":Se.isMacPlatform?Se.getMacDisplayText(e):Se.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),Kt(this,"id",void 0),Kt(this,"name",void 0),Kt(this,"tooltip",void 0),Kt(this,"isEditable",void 0),Kt(this,"defaultKeyState",void 0),Kt(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=Se.isMacPlatform,u=l?i:r;this.defaultKeyState=Se.createKeyState(u),this.keyState=this.defaultKeyState}getDisplayText(){return Se.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Se.isValidKeyState(e)?(Mo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new zs("onUpdate",{detail:this}))):Mo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Se.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Se.NULL_KEY_STATE)}isNull(){return Se.doKeyStatesMatch(this.keyState,Se.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Se.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Se.getKeyStateFromEvent(e))}}Kt(Se,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Kt(Se,"isMacPlatform",Pe.isMacPlatform());function No(n,e,t){return(e=kh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kh(n){var e=jh(n,"string");return typeof e=="symbol"?e:e+""}function jh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ko=U.module("ShortcutRegistry");class Lh extends ys{constructor(){super(...arguments),No(this,"shortcutMap",new Map),No(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new Se(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return ko.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;ko.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new zs("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var ce=Object.freeze(new Lh),Xt={COPY:ce.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[I.CTRL,_.C],macShortcut:[I.CMD,_.C],isEditable:!1}),PASTE:ce.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[I.CTRL,_.V],macShortcut:[I.CMD,_.V],isEditable:!1}),SAVE:ce.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[I.CTRL,_.S],macShortcut:[I.CMD,_.S],isEditable:!1}),SELECT_ALL:ce.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[I.CTRL,_.A],macShortcut:[I.CMD,_.A],isEditable:!1}),REOPEN_CLOSED_PANEL:ce.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[I.ALT,I.SHIFT,_.T],macShortcut:[I.OPTION,I.SHIFT,_.T],isEditable:!0}),LINKER:ce.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[I.CTRL,_.L],macShortcut:[I.CMD,_.L]}),LINKER_CLOSE:ce.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[_.ESCAPE],macShortcut:[_.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:ce.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[I.CTRL,I.ALT,_.I],macShortcut:[I.CMD,I.SHIFT,_.I],isEditable:!0}),EXPORT_LOGS:ce.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[I.CTRL,I.ALT,I.SHIFT,_.L],macShortcut:[I.CMD,I.OPTION,I.SHIFT,_.L],isEditable:!0}),OPEN_DASHBOARD_LIST:ce.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[I.CTRL,I.SHIFT,_.D],macShortcut:[I.CMD,I.SHIFT,_.D],isEditable:!0}),NEXT:ce.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[_.ENTER],macShortcut:[_.ENTER],isEditable:!1}),PREVIOUS:ce.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[I.SHIFT,_.ENTER],macShortcut:[I.SHIFT,_.ENTER],isEditable:!1}),UNDO:ce.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[I.CTRL,_.Z],macShortcut:[I.CMD,_.Z],isEditable:!1}),REDO:ce.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[I.CTRL,I.SHIFT,_.Z],macShortcut:[I.CMD,I.SHIFT,_.Z],isEditable:!1})};function yi(n,e,t){return(e=Ah(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ah(n){var e=Rh(n,"string");return typeof e=="symbol"?e:e+""}function Rh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wr extends m.PureComponent{constructor(e){super(e),yi(this,"inputField",void 0),yi(this,"searchChangeSelection",void 0),this.inputField=$.createRef(),this.searchChangeSelection=$.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var{value:e,placeholder:t,endPlaceholder:r,onBlur:i,onChange:o,className:a,disabled:s,matchCount:l,id:u,onKeyDown:c,"data-testid":h,cursor:v}=this.props,f,p=[{action:()=>v==null?void 0:v.next("forward"),shortcut:Xt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:Xt.PREVIOUS}];return v&&l>1?f=d.jsxs(d.Fragment,{children:[d.jsx(se,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:xs,tooltip:"Previous match (".concat(Xt.PREVIOUS.getDisplayText(),")")}),d.jsxs("span",{className:"search-change-text",children:[v.index!==void 0&&"".concat(v.index+1," of "),l]}),d.jsx(se,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("forward")},icon:td,tooltip:"Next match (".concat(Xt.NEXT.getDisplayText(),")")})]}):f=l>0&&d.jsx("span",{className:"search-match",children:l}),d.jsxs("div",{className:q("search-group",a),children:[d.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:c,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:u,"data-testid":h}),l!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),d.jsx(ne,{actions:p})]}):d.jsxs("span",{className:"search-end-content",children:[(r??"")!==""&&e===""&&d.jsx("span",{className:"search-end-placeholder",children:r}),d.jsx(ve,{icon:nd})]})]})}}yi(Wr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function ll(n,e,t){return(e=Fh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fh(n){var e=$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)}class ul extends m.PureComponent{constructor(e){super(e),ll(this,"searchInput",void 0),this.searchInput=$.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=gn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":o}=this.props,{value:a}=this.state;return d.jsx(Wr,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}ll(ul,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function dl(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=Bh(n,"string");return typeof e=="symbol"?e:e+""}function Bh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Uh=U.module("ItemListItem");class Vr extends m.Component{static handleKeyDown(){return Uh.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),dl(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=$.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":a}=this.props;return d.jsx("div",{className:q("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:Vr.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:o})}}dl(Vr,"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 xr;function jo(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?jo(Object(t),!0).forEach(function(r){ct(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):jo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ct(n,e,t){return(e=Wh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wh(n){var e=Vh(n,"string");return typeof e=="symbol"?e:e+""}function Vh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ao=U.module("ItemList"),Ro=5;class yt extends m.PureComponent{static renderItem(e){var t,r,{item:i}=e;return d.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),ct(this,"list",void 0),ct(this,"listContainer",void 0),ct(this,"getItemSelected",On((i,o)=>ft.isSelected(o,i),{max:yt.CACHE_SIZE})),ct(this,"getCachedItem",On((i,o,a,s,l,u,c,h)=>{var v=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:c});return d.jsx(Vr,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:c,children:v},o)},{max:yt.CACHE_SIZE})),ct(this,"getOuterElement",On(i=>{var o=$.forwardRef((a,s)=>d.jsx("div",Lo({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),ct(this,"getInnerElement",On(()=>{var i=$.forwardRef((o,a)=>d.jsx("div",Lo({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),ct(this,"getItemData",On((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=$.createRef(),this.listContainer=$.createRef();var{isStickyBottom:t,selectedRanges:r}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:r,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:u}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==u)this.setSelectedRanges(r);else if(u!==t.selectedRanges){var{onSelectionChange:c}=this.props;c(u)}if(o!==t.focusIndex){var{onFocusChange:h}=this.props;h(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:r}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:r}=this.state,i=ft.isSelected(r,e),o=i||Pe.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:ft.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Ao.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){Ao.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:u}=this.state;if(!(a==null||o)){var c=Math.abs(t.clientX-(l??0)),h=Math.abs(t.clientY-(u??0));c>Ro&&h>Ro&&this.setState({isDragging:!0}),(r||a===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,s)&&!Pe.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Pe.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:a,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!s){var l=t.shiftKey,u=Pe.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,u,r),!i&&!l&&!u&&o(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:r,onSelect:i}=this.props,{focusIndex:o}=this.state,a=o;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&i(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=r-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,r-1):a=0;else return;if(o!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else if(this.deselectAll(),a!==null)this.selectItem(a);else{var u;(u=this.listContainer.current)===null||u===void 0||u.focus()}this.scrollIntoView(a)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:a}=this.state;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){ft.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:ft.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){ft.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:ft.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);r(o,a)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:u}=this.state;if(t<o||t>=o+i.length)return null;var c=i[t-o];return this.getCachedItem(t,t,c,t===l&&!s,this.getItemSelected(t,u),a,r,s)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return d.jsx(Au,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:c,height:h}=u;return d.jsx(Ru,{className:"item-list-scroll-pane",height:h,width:c,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":a,children:this.renderInnerElement})}})}}xr=yt;ct(yt,"CACHE_SIZE",1e3);ct(yt,"DEFAULT_ROW_HEIGHT",20);ct(yt,"DEFAULT_OVERSCAN",10);ct(yt,"defaultProps",{offset:0,items:[],rowHeight:xr.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:xr.DEFAULT_OVERSCAN,renderItem:xr.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var Kh=U.module("ErrorBoundary");class zh extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;Kh.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??d.jsx("div",{className:t,children:d.jsx(bn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function Gh(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=n;return d.jsx("button",{type:"button",className:q("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:d.jsx("div",{className:"handle"})})}var qh=["classNames","timeout","children","onEnter"];function Fo(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 $o(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fo(Object(t),!0).forEach(function(r){Xh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xh(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)}function Qh(n,e){if(n==null)return{};var t,r,i=Jh(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 Jh(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 em={display:"contents"};function mC(n){var{classNames:e,timeout:t=Es.transitionMs,children:r,onEnter:i}=n,o=Qh(n,qh),a=m.useRef(null),s=m.useCallback(u=>{var c=a.current;c&&(i==null||i(c,u))},[i]),l=m.useCallback(u=>{a.current=u==null?void 0:u.firstElementChild},[]);return d.jsx(bs,$o($o({nodeRef:a,timeout:t,classNames:q("fade",e),onEnter:s},o),{},{children:d.jsx("div",{ref:l,style:em,children:r})}))}var tm=["children","className","isInvalid","onChange","data-testid"];function Ho(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?Ho(Object(t),!0).forEach(function(r){nm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ho(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nm(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)}function om(n,e){if(n==null)return{};var t,r,i=am(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 am(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 cl=$.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":a}=n,s=om(n,tm),l=Xs(e),u=m.useCallback(c=>{o(c.target.value)},[o]);return d.jsx("select",Bo(Bo({ref:l,className:q("custom-select",r,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});cl.displayName="Select";var Ri=$.createContext(new Map);Ri.displayName="XComponentMapContext";var vC=Ri.Provider;function sm(n){var e,t=m.useContext(Ri);return(e=t.get(n))!==null&&e!==void 0?e:n.Original}function Uo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ii(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){lm(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 lm(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=dm(n,"string");return typeof e=="symbol"?e:e+""}function dm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 hl(n){var e,t;function r(i,o){var a=sm(t);return ol(n)?d.jsx(a,ii(ii({},i),{},{ref:o})):d.jsx(a,ii({},i))}return r.displayName="XComponent(".concat((e=n.displayName)!==null&&e!==void 0?e:n.name,")"),t=m.forwardRef(r),t.Original=n,t.isXComponent=!0,t}function cm(){return ir(rd,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function ml(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function vl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function fC(n){return ml(n)||vl(n)}var fl=m.createContext(null);fl.displayName="ObjectFetcherContext";function pC(n){if(vl(n))return{id:n.id,type:n.type};if(ml(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function hm(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 gC(){return ir(fl,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var Fi=Object.freeze({}),mm=new Map,bC=n=>n.api,yC=n=>n.user,pl=n=>n.storage,gl=n=>pl(n).commandHistoryStorage,bl=n=>pl(n).fileStorage,vm=n=>n.defaultWorkspaceSettings,yl=n=>{var{workspace:e}=n;return e},Fe=Fu(n=>{var e,t,r=(e=(t=yl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=vm(n),o=$u({},i,r,(a,s)=>{if(Array.isArray(a)&&Array.isArray(s))return s});return o}),CC=n=>n.defaultWorkspaceSettings,SC=n=>Fe(n).defaultDateTimeFormat,wC=n=>{var e;return(e=Fe(n).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Fi},EC=n=>{var e;return(e=Fe(n).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Fi},PC=n=>{var e;return(e=Fe(n).formatter)!==null&&e!==void 0?e:[]},fm=n=>Fe(n).timeZone,TC=n=>Fe(n).showTimeZone,_C=n=>Fe(n).showTSeparator,OC=n=>Fe(n).truncateNumbersWithPound,xC=n=>Fe(n).showEmptyStrings,IC=n=>Fe(n).showNullStrings,DC=n=>Fe(n).showExtraGroupColumn,MC=n=>Fe(n).shortcutOverrides,NC=n=>Fe(n).webgl,kC=n=>Fe(n).webglEditable,Cl=n=>{var e;return(e=Fe(n).notebookSettings)!==null&&e!==void 0?e:Fi},jC=n=>n.activeTool,pm=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:mm};function Wo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Lt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wo(Object(t),!0).forEach(function(r){gm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gm(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=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 LC=n=>({type:dd,payload:n}),AC=n=>({type:ad,payload:n}),Sl=n=>({type:hd,payload:n}),RC=n=>({type:md,payload:n}),FC=n=>({type:cd,payload:n}),$C=n=>({type:ld,payload:n}),HC=n=>({type:ud,payload:n}),Cm=n=>(e,t)=>{e(Sl(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i==null?void 0:i.save(n)},Sm=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=Lt(Lt({},r),{},{data:Lt(Lt(Lt({},i),n),{},{settings:Lt(Lt({},i==null?void 0:i.settings),n.settings)})});return e(Cm(o))},wm=n=>(e,t)=>{var{notebookSettings:r}=Fe(t()),i=Lt(Lt({},r),n);return e(Em({notebookSettings:i}))},Em=n=>e=>e(Sm({settings:n})),BC=n=>({type:id,payload:n}),UC=n=>({type:od,payload:n}),WC=n=>({type:sd,payload:n});function Vo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ko(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vo(Object(t),!0).forEach(function(r){Pm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Pm(n,e,t){return(e=Tm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tm(n){var e=_m(n,"string");return typeof e=="symbol"?e:e+""}function _m(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Om(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i==null?void 0:i.type){case n:{var{id:o,payload:a}=i;return t&&Yn({payload:a},{payload:r[o]})?r:Ko(Ko({},r),{},{[o]:a})}default:return r}}}function wl(n){var{type:e}=n,t=cm();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return d.jsx(ve,{icon:fd});case t.VariableType.FIGURE:return d.jsx(ve,{icon:Ds});case t.VariableType.PANDAS:return d.jsx(ve,{icon:vd});default:return d.jsx(ve,{icon:Is})}}function zo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function xm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){zo(o,r,i,a,s,"next",l)}function s(l){zo(o,r,i,a,s,"throw",l)}a(void 0)})}}function El(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=Qs();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=xm(function*(){if(e!=null&&o!=null){var u=yield De.colorize(e.toString(),t,{});a||i(u)}}),l.apply(this,arguments)}return s(),()=>{a=!0}},[o,e,t]),d.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class Pl{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Nr{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)?[]:Hu.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 Nr.isTableType(e,t)||Nr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function Im(n){var{children:e}=n;return d.jsxs("div",{className:"console-history-item-result",children:[d.jsx("div",{className:"console-history-gutter",children:"-"}),d.jsx("div",{className:"console-history-content",children:e})]})}function Ci(n,e,t){return(e=Dm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dm(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)}class Tl extends m.Component{constructor(e){super(e),Ci(this,"timer",void 0),Ci(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=window.setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer!=null&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:r}=this.state;return d.jsx("div",{className:q("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(Ms,{className:"ml-2"}),"Running... ",qe.formatElapsedTime(r)," ",d.jsx(se,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:pd,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Ci(Tl,"defaultProps",{disabled:!1});function Zn(n,e,t){return(e=Nm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nm(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 kn extends m.PureComponent{constructor(e){super(e),Zn(this,"mouseX",void 0),Zn(this,"mouseY",void 0),Zn(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=kn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=kn.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;A(r);var i=r.trimEnd(),o=i.indexOf(`
|
|
4
|
+
`),a=o>-1,s=i;a&&(s=i.slice(0,o));var l=i.slice(o),u=t?"error-btn-link error-btn-link--active":"error-btn-link";return d.jsxs("div",{className:q("error-message",{expanded:e}),children:[a&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"error-gutter",children:d.jsx("button",{type:"button",onClick:this.handleToggleError,className:u,tabIndex:-1,children:d.jsx(ve,{icon:e?vi:gd,transform:"left-3"})})}),d.jsxs("div",{className:"error-content",children:[d.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:s}),e?l:""]})]}),!a&&d.jsx("div",{className:"error-content",children:d.jsx("div",{className:"console-error-text",children:s})})]},"error")}}Zn(kn,"defaultProps",{message:""});Zn(kn,"mouseDragThreshold",5);var _l=m.memo(n=>{var{item:e}=n,{startTime:t,serverStartTime:r,serverEndTime:i}=e,o=m.useMemo(()=>{var c;return(c=e.endTime)!==null&&c!==void 0?c:Date.now()},[e.endTime]),a=qe.formatConvertedDuration(t,o),s=!!a,l=null;r!=null&&i!=null&&(l=qe.formatConvertedDuration(r,i,"ns"));var u=!!l;return d.jsxs(d.Fragment,{children:[d.jsx(Js,{children:"Execution Info"}),d.jsx(Bu,{children:d.jsxs("div",{className:"console-history-item-contextual-help-content",children:[s&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"Elapsed time"}),d.jsx("div",{children:a})]}),u&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"Server query time"}),d.jsx("div",{children:l})]})]})})]})});_l.displayName="ConsoleHistoryItemTooltip";var jm=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)},Ol=m.memo(n=>{var{item:e,onCommandSubmit:t,handleTooltipVisible:r}=n,i=m.useMemo(()=>jm(e),[e]);return d.jsxs("div",{className:q("console-history-actions",i),children:[e.command!=null&&d.jsx(al,{copy:e.command}),d.jsx(se,{icon:bd,kind:"inline",onClick:()=>{var o;return t((o=e.command)!==null&&o!==void 0?o:"")},tooltip:"Rerun",children:null}),d.jsx(Uu,{variant:"info",onOpenChange:r,UNSAFE_className:"console-history-item-contextual-help",children:d.jsx(_l,{item:e})})]})});Ol.displayName="ConsoleHistoryItemActions";function Lm(n,e,t){return(e=Am(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Am(n){var e=Rm(n,"string");return typeof e=="symbol"?e:e+""}function Rm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Go=U.module("ConsoleHistoryItem");class xl extends m.PureComponent{constructor(e){super(e),this.state={isTooltipVisible:!1},this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Go.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Go.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{isTooltipVisible:e}=this.state,{disabled:t,item:r,language:i,iconForType:o,onCommandSubmit:a}=this.props,{disabledObjects:s,result:l}=r,u=r.command!=null&&r.command!=="",c=null;u&&(c=d.jsxs("div",{className:q("console-history-item-command",{"console-history-item-command-tooltip-active":e}),children:[d.jsx("div",{className:"console-history-gutter",children:">"}),d.jsxs("div",{className:"console-history-content",children:[d.jsx(El,{language:i,children:r.command}),d.jsx(Ol,{item:r,onCommandSubmit:a,handleTooltipVisible:k=>this.setState({isTooltipVisible:k})})]})]}));var h=[],v=!1;if(l){var{error:f,message:p,changes:g}=l;if(g){var{created:b,updated:w}=g;[...b,...w].forEach(k=>{v=!0;var{title:B}=k,Q="".concat(B),G=t===void 0||t||(s??[]).indexOf(Q)>=0,L=d.jsx(se,{kind:"primary",onClick:()=>this.handleObjectClick(k),className:"btn-console-object",disabled:G,icon:o(k.type),children:B},Q);h.push(L)})}if(f!=null&&!u){var E,P="".concat((E=f.message)!==null&&E!==void 0?E:f);P||(P=f);var R=d.jsx(kn,{message:P},"result-error");h.push(R)}if(p!==void 0&&p!==""){var Z=d.jsx("div",{className:"log-message",children:p},"log-message");h.push(Z)}}else{v=!0;var re=d.jsx(Tl,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");h.push(re)}var Y=null;return h.length>0&&(Y=d.jsx(Im,{children:h})),d.jsxs("div",{className:q("console-command-result",{"console-result-buttons":v}),children:[c,Y]})}}Lm(xl,"defaultProps",{disabled:!1});function Fm(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var $m=$.forwardRef(function(e,t){for(var{disabled:r=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l,onCommandSubmit:u}=e,c=[],h=0;h<i.length;h+=1){var v=i[h],f=d.jsx(xl,{disabled:r,item:v,openObject:a,language:o,supportsType:s,iconForType:l,onCommandSubmit:u},Fm(h,v));c.push(f)}return d.jsx("div",{ref:t,className:"container-fluid console-history",children:c})}),Hm={name:"Console",CLEAR:ce.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[I.CTRL,_.L],macShortcut:[I.CTRL,_.C]}),FOCUS_HISTORY:ce.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[I.CTRL,_.H],macShortcut:[I.CTRL,I.OPTION,_.H]})},Bm={name:"Command History",FOCUS_HISTORY:ce.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[I.CTRL,_.H],macShortcut:[I.CTRL,I.OPTION,_.H]}),SEND_TO_CONSOLE:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[_.ENTER],macShortcut:[_.ENTER]}),SEND_TO_NOTEBOOK:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[I.CTRL,_.ENTER],macShortcut:[I.CMD,_.ENTER]}),RUN:ce.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[I.ALT,_.R],macShortcut:[I.OPTION,_.R]})},Um={name:"Notebook",RUN:ce.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[I.ALT,_.R],macShortcut:[I.OPTION,_.R]}),RUN_SELECTED:ce.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[I.ALT,I.SHIFT,_.R],macShortcut:[I.OPTION,I.SHIFT,_.R]}),FIND:ce.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[I.CTRL,_.F],macShortcut:[I.CMD,_.F],isEditable:!1}),MINIMAP:ce.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[I.ALT,_.M],macShortcut:[I.OPTION,_.M]}),WORDWRAP:ce.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[I.ALT,_.Z],macShortcut:[I.OPTION,_.Z]})},Ve={CONSOLE:Hm,COMMAND_HISTORY:Bm,NOTEBOOK:Um};const Ie=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Wm="var(--dh-color-editor-bg)",Vm="var(--dh-color-editor-fg)",Km="var(--dh-color-editor-string)",zm="var(--dh-color-editor-delimiter)",Gm="var(--dh-color-editor-predefined)",qm="var(--dh-color-editor-keyword)",Xm="var(--dh-color-editor-storage)",Zm="var(--dh-color-editor-number)",Ym="var(--dh-color-editor-operator)",Qm="var(--dh-color-editor-identifier)",Jm="var(--dh-color-editor-comment)",Si={"error-foreground":"var(--dh-color-editor-error-fg)",background:Wm,foreground:Vm,"line-height":"19px",string:Km,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:zm,predefined:Gm,keyword:qm,storage:Xm,number:Zm,operator:Ym,identifier:Qm,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Jm,"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 ev="python",tv={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/}}},nv={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"]]}},rv={id:ev,conf:tv,language:nv},iv="groovy",ov={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/}}},av={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"]]}},sv={id:iv,conf:ov,language:av},lv="scala",uv={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>))/}}},dv={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"]]}},cv={id:lv,conf:uv,language:dv},hv="deephavenDb",mv={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/}}},vv={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"]]}},fv={id:hv,conf:mv,language:vv},pv="log",gv={},bv={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"}]]}},yv={id:pv,conf:gv,language:bv},Cv={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 qo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Sv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){qo(o,r,i,a,s,"next",l)}function s(l){qo(o,r,i,a,s,"throw",l)}a(void 0)})}}function en(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=Ev(n,"string");return typeof e=="symbol"?e:e+""}function Ev(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 st=U.module("MonacoCompletionProvider");class H extends m.PureComponent{static initRuff(){return Sv(function*(){if(H.isRuffEnabled)return H.initRuffPromise||(H.initRuffPromise=Wu({}).then(()=>{st.debug("Initialized Ruff",no.version()),H.isRuffInitialized=!0,H.updateRuffWorkspace()})),H.initRuffPromise})()}static updateRuffWorkspace(){if(H.isRuffInitialized){var e=console.log;try{console.log=()=>{},H.ruffWorkspace=new no(H.ruffSettings)}finally{console.log=e}H.lintAllPython()}}static setRuffSettings(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:H.ruffSettings;if(H.ruffSettings=e,!H.isRuffInitialized){H.initRuff();return}H.updateRuffWorkspace()}static getDiagnostics(e){if(!H.ruffWorkspace)return[];var t=H.ruffWorkspace.check(e.getValue());return me.isConsoleModel(e)?t.filter(r=>r.code==null):t}static lintAllPython(){if(!H.isRuffEnabled){De.removeAllMarkers("ruff");return}De.getModels().filter(e=>e.getLanguageId()==="python").forEach(H.lintPython)}static lintPython(e){if(H.isRuffEnabled&&H.ruffWorkspace){var t=H.getDiagnostics(e);st.debug("Linting Python document: ".concat(e.uri.toString()),t),De.setModelMarkers(e,"ruff",t.map(r=>{var i=r.code==="F401"||r.code==="F841",o=r.code==null;return{startLineNumber:r.location.row,startColumn:r.location.column,endLineNumber:r.end_location.row,endColumn:r.end_location.column,message:o?r.message:"".concat(r.code,": ").concat(r.message),severity:o?lo.Error:lo.Warning,tags:i?[Ud.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=it.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}static handlePythonCodeActionRequest(e,t){if(!H.isRuffEnabled||!H.ruffWorkspace)return{actions:[],dispose:()=>{}};var r=H.getDiagnostics(e).filter(u=>{var c=new Fs(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&c.intersectRanges(t)}),i=r.filter(u=>{var{fix:c}=u;return c!=null}).map(u=>{var c="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?c="".concat(u.code,": ").concat(u.fix.message):c="Fix ".concat(u.code)),{title:c,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(h=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:h.location.row,startColumn:h.location.column,endLineNumber:h.end_location.row,endColumn:h.end_location.column},text:(v=h.content)!==null&&v!==void 0?v:""}}})}:void 0}}),o=new Set,a=new Set;r.forEach(u=>{u.code!=null&&(o.has(u.code)&&a.add(u.code),o.add(u.code))});var s=r.map(u=>{if(u.code==null)return[];var c=e.getLineContent(u.location.row),h=De.tokenize(c,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:u.location.row,startColumn:c.length+1,endLineNumber:u.location.row,endColumn:c.length+1},text:" # noqa: ".concat(u.code)};return h!=null&&h.type.startsWith("comment")&&(v.text="# noqa: ".concat(u.code," "),c.startsWith("# noqa:",h.offset)?(v.range.startColumn=h.offset+1,v.range.endColumn=h.offset+9):(v.range.startColumn=h.offset+1,v.range.endColumn=c.startsWith("# ",h.offset)?h.offset+3:h.offset+2)),[{title:"Disable ".concat(u.code," for ").concat(a.has(u.code)?"line ".concat(u.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:v}]}}]}).flat().filter((u,c,h)=>h.find(v=>v.title===u.title)===u),l=[...o].map(u=>({title:"Disable ".concat(u," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(u,`
|
|
6
|
+
`)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(H.ruffWorkspace)return st.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:H.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),en(this,"registeredCompletionProvider",void 0),en(this,"registeredSignatureProvider",void 0),en(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=it.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=it.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=it.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);st.debug("Requested completion items",a);var l=s.then(u=>{st.debug("Completion items received: ",a,u);var c=u.map(h=>{var{label:v,kind:f,detail:p,documentation:g,sortText:b,filterText:w,textEdit:E,insertTextFormat:P}=h;return{label:v,kind:H.lspToMonacoKind(f),detail:p,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:w,insertText:E.text,insertTextRules:P===2?4:P,range:H.lspToMonacoRange(E.range)}});return{incomplete:!0,suggestions:c}}).catch(u=>(st.error("There was an error retrieving completion items",u),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t),context:i},u=s.getSignatureHelp(l);st.debug("Requested signature help",l);var c=u.then(h=>{st.debug("Signatures received: ",l,u);var v=h.map(p=>{var{label:g,documentation:b,parameters:w}=p;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:w??[]}});if(v.length===0)return o;var f=0;return{value:{signatures:v,activeSignature:f,activeParameter:h[f].activeParameter},dispose:()=>{}}}).catch(h=>(st.error("There was an error retrieving completion items",h),o));return c}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:H.monacoToLspPosition(t)},a=i.getHover(o);st.debug("Requested hover",o);var s=a.then(l=>{st.debug("Hover received: ",o,l);var{contents:u}=l;return{contents:u!=null?[u]:[]}}).catch(l=>(st.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}en(H,"ruffWorkspace",void 0);en(H,"initRuffPromise",void 0);en(H,"isRuffInitialized",!1);en(H,"isRuffEnabled",!0);en(H,"ruffSettings",Cv);function Xo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Pv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Xo(o,r,i,a,s,"next",l)}function s(l){Xo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Zo(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 Yo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zo(Object(t),!0).forEach(function(r){Tv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Tv(n,e,t){return(e=_v(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _v(n){var e=Ov(n,"string");return typeof e=="symbol"?e:e+""}function Ov(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mt=U.module("MonacoUtils"),Qo="inmemory://dh-console/";class me{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Mt.debug("Initializing Monaco..."),e!==void 0&&me.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=me;t(),r([fv,rv,sv,yv,cv]),it.onLanguage("python",()=>{it.registerCodeActionProvider("python",{provideCodeActions:H.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),it.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:H.handlePythonFormatRequest})}),De.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){H.ruffWorkspace!=null&&H.lintPython(i);var o=Hr(a=>H.lintPython(a),250);i.onDidChangeContent(()=>{o(i)})}}),me.removeConflictingKeybindings(),Mt.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=me,i=Ns(Si);Mt.debug2("Monaco theme:",Si),Mt.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"],"diffEditor.insertedTextBackground":i["diff-editor-inserted-text-background"],"diffEditor.removedTextBackground":i["diff-editor-removed-text-background"],"diffEditor.insertedLineBackground":i["diff-editor-inserted-line-background"],"diffEditor.removedLineBackground":i["diff-editor-removed-line-background"]};De.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{De.setTheme("dh-dark")}catch(s){Mt.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),De.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Yo(Yo({},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});it.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Mt.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{me.registerLanguage(r)})}static registerLanguage(e){Mt.debug2("Registering language: ",e.id),it.register(e),it.onLanguage(e.id,()=>{it.setLanguageConfiguration(e.id,e.conf),it.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();A(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Mt.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,u=[],c=0;c<s.length;c+=1){var h=s[c],{range:v,rangeLength:f,text:p}=h,g={range:{start:{line:v.startLineNumber-1,character:v.startColumn-1},end:{line:v.endLineNumber-1,character:v.endColumn-1}},rangeLength:f,text:p};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};Mt.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();A(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();A(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){De.addKeybindingRule({keybinding:rt.CtrlCmd|Jt.KeyD,command:null}),me.isMacPlatform()||De.addKeybindingRule({keybinding:rt.CtrlCmd|Jt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(_t()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=me.isMacPlatform();return i?(t.metaKey?rt.CtrlCmd:0)|(t.shiftKey?rt.Shift:0)|(t.altKey?rt.Alt:0)|(t.ctrlKey?rt.WinCtrl:0)|uo.fromString(r):(t.ctrlKey?rt.CtrlCmd:0)|(t.shiftKey?rt.Shift:0)|(t.altKey?rt.Alt:0)|(t.metaKey?rt.WinCtrl:0)|uo.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=Vu(s),u=l.filter(c=>c.type==="url"?/^https?:\/\//.test(c.value):!0);u.forEach(c=>{t.push({url:c.href,range:new Fs(a,c.start+1,a,c.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return Wd.parse("".concat(Qo).concat(_t()))}static isConsoleModel(e){return e.uri.toString().startsWith(Qo)}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 Pv(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function Jo(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 xv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jo(Object(t),!0).forEach(function(r){kr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function kr(n,e,t){return(e=Iv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iv(n){var e=Dv(n,"string");return typeof e=="symbol"?e:e+""}function Dv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Il extends m.Component{constructor(e){super(e),kr(this,"container",void 0),kr(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();A(t),De.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=xv({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),A(this.container),this.editor=De.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[rt.CtrlCmd|Jt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),it.registerLinkProvider("plaintext",{provideLinks:me.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;A(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return d.jsx("div",{className:q("editor-container",e),ref:t=>{this.container=t}})}}kr(Il,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});function ea(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Mv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ea(o,r,i,a,s,"next",l)}function s(l){ea(o,r,i,a,s,"throw",l)}a(void 0)})}}function nt(n,e,t){return(e=Nv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nv(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 oi=U.module("ConsoleInput"),jr=parseInt(Si["line-height"],10),Dl=6,Ml=6,jv=jr+Dl+Ml,ai=100;class jn extends m.PureComponent{constructor(e){super(e),nt(this,"cancelListener",void 0),nt(this,"resizeObserver",void 0),nt(this,"commandContainer",void 0),nt(this,"commandEditor",void 0),nt(this,"commandHistoryIndex",void 0),nt(this,"commandSuggestionContainer",void 0),nt(this,"loadingPromise",void 0),nt(this,"timestamp",void 0),nt(this,"bufferIndex",void 0),nt(this,"history",void 0),nt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=$.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:jr,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(oi.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r=De.createModel("",e,me.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:jr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Dl,bottom:Ml},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:r},o=this.commandContainer.current;A(o),this.commandEditor=De.create(o,i),me.setEOL(this.commandEditor),me.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:l}=this,u=s==null?void 0:s.getPosition();A(u);var{lineNumber:c}=u;if(!a.altKey&&!a.shiftKey&&!a.metaKey){if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&c===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&c===(r==null?void 0:r.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(a.keyCode===Jt.Enter&&!this.isSuggestionMenuPopulated()){var h;a.stopPropagation(),a.preventDefault();var v=(h=this.commandEditor)===null||h===void 0?void 0:h.getValue().trim();if(v!==void 0){var f;this.processCommand(v),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}}),me.disableKeyBindings(this.commandEditor,[rt.CtrlCmd|Jt.KeyF]),me.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(o),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(me.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();A(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);A(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();A(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);A(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(r??i),e!==null&&e>this.history.length-ai&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Mv(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=_e.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+ai-1}),e.loadingPromise=_e.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=ai,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,u)=>{var{name:c}=s;return l===0||c!==u[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,_e.isCanceled(s)){oi.debug2("Promise canceled, not loading history");return}oi.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),A(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;A(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),jv),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return d.jsx("div",{className:q("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:q("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:jn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&d.jsx(H,{model:a,language:t,session:r})]})})}}nt(jn,"defaultProps",{maxHeight:jr*10,scope:null,disabled:!1});nt(jn,"INPUT_CLASS_NAME","console-input");function Gt(n,e,t){return(e=Lv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lv(n){var e=Av(n,"string");return typeof e=="symbol"?e:e+""}function Av(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ta="pasted values",Rv=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],si=[".csv",".tsv",".tab",".psv",".dsv",".txt"],na=[".zip"];class Ke extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Rv.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return si.some(r=>e.endsWith(r))||t&&na.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===ta?oo:e.endsWith(".csv")?yd:e.endsWith(".zip")?Cd:Sd}constructor(e){super(e),Gt(this,"fileElem",void 0),Gt(this,"divElem",void 0),Gt(this,"getValidExtensions",Qt(t=>t?[...si,...na]:[...si])),Gt(this,"getAcceptString",Qt(t=>this.getValidExtensions(t).join(", "))),Gt(this,"getFileTypeErrorString",Qt(t=>Gs.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=$.createRef(),this.divElem=$.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();A(o),Ke.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Ke.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:ta,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:oo,action:this.handleMenuPaste,shortcut:Xt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ke.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(ne,{actions:s}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:wd})}),d.jsx("label",{children:"Drop file (or paste values) here to import"}),d.jsx("div",{className:"message-small",children:d.jsx("label",{children:"or"})}),d.jsx(se,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(ve,{icon:Ke.getIcon(i)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[i,!r&&d.jsx(se,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:ks,tooltip:"Remove"})]})]})]}),!!a&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ve,{icon:js})}),d.jsx("label",{children:a}),a===Ke.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Gt(Ke,"defaultProps",{allowZip:!1,dragError:null});Gt(Ke,"MULTIPLE_FILE_ERROR","Please select only one file");Gt(Ke,"FILE_TYPE_ERROR","Filetype not supported.");function $i(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)}class Ne{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""}}$i(Ne,"TYPE_GLOBAL","type-global");$i(Ne,"TYPE_CONTEXT_PRESET","type-context-preset");$i(Ne,"TYPE_CONTEXT_CUSTOM","type-context-custom");class Hv extends Ne{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Bv extends Ne{format(e){return String.fromCharCode(e)}}function zt(n,e,t){return(e=Uv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uv(n){var e=Wv(n,"string");return typeof e=="symbol"?e:e+""}function Wv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ra=U.module("DateTimeColumnFormatter");class pt extends Ne{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]:Ne.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(),zt(this,"dh",void 0),zt(this,"dhTimeZone",void 0),zt(this,"defaultDateTimeFormatString",void 0),zt(this,"showTimeZone",void 0),zt(this,"showTSeparator",void 0),zt(this,"formatStringMap",void 0);var a=t||pt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{ra.error("Unsupported time zone id",a),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{ra.error("Invalid format arguments")}return""}}zt(pt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");zt(pt,"DEFAULT_TIME_ZONE_ID","America/New_York");var Ft;function Ct(n,e,t){return(e=Vv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vv(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 zv=U.module("DecimalColumnFormatter");class ze extends Ne{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]:Ne.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 ze.makeFormat(e,t,Ne.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 ze.makeFormat("Custom Format",e,Ne.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=ze.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ct(this,"defaultFormatString",void 0),Ct(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{zv.error("Invalid format arguments")}return""}}Ft=ze;Ct(ze,"DEFAULT_FORMAT_STRING","###,##0.0000");Ct(ze,"FORMAT_PERCENT",Ft.makePresetFormat("Percent","##0.00%"));Ct(ze,"FORMAT_BASIS_POINTS",Ft.makePresetFormat("Basis Points","###,##0 bp",1e4));Ct(ze,"FORMAT_THOUSANDS",Ft.makePresetFormat("Thousands","##0.000 k",.001));Ct(ze,"FORMAT_MILLIONS",Ft.makePresetFormat("Millions","###,##0.000 mm",1e-6));Ct(ze,"FORMAT_SCIENTIFIC_NOTATION",Ft.makePresetFormat("Scientific Notation","0.0000E0"));Ct(ze,"FORMAT_ROUND",Ft.makePresetFormat("Round","###,##0"));Ct(ze,"FORMAT_ROUND_TWO_DECIMALS",Ft.makePresetFormat("0.00","###,##0.00"));Ct(ze,"FORMAT_ROUND_FOUR_DECIMALS",Ft.makePresetFormat("0.0000","###,##0.0000"));class Gv extends Ne{format(e){return"".concat(e)}}var Kr;function Ln(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=Xv(n,"string");return typeof e=="symbol"?e:e+""}function Xv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Zv=U.module("IntegerColumnFormatter");class Ot extends Ne{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]:Ne.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 Ot.makeFormat(e,t,Ne.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 Ot.makeFormat("Custom Format",e,Ne.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=Ot.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ln(this,"dh",void 0),Ln(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{Zv.error("Invalid format arguments")}return""}}Kr=Ot;Ln(Ot,"DEFAULT_FORMAT_STRING","###,##0");Ln(Ot,"FORMAT_THOUSANDS",Kr.makePresetFormat("Thousands","##0.000 k",.001));Ln(Ot,"FORMAT_MILLIONS",Kr.makePresetFormat("Millions","###,##0.000 mm",1e-6));Ln(Ot,"FORMAT_SCIENTIFIC_NOTATION",Kr.makePresetFormat("Scientific Notation","0.0000E0"));class Yv extends Ne{format(e){return e}}function ia(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 oa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(t),!0).forEach(function(r){Hi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Hi(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=Jv(n,"string");return typeof e=="symbol"?e:e+""}function Jv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ef=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class Ee{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var c="".concat(r).padStart(4,"0"),h="".concat(i+1).padStart(2,"0"),v="".concat(o).padStart(2,"0"),f="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),b="".concat(u).padStart(9,"0"),w="".concat(c,"-").concat(h,"-").concat(v," ").concat(f,":").concat(p,":").concat(g,".").concat(b);return e.i18n.DateTimeFormat.parse(Ee.FULL_DATE_FORMAT,w,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:u,seconds:c,nanos:h}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;h=Ee.getNextNanos(t.nanos),h>999999999&&(c+=1,h=0)}else t.seconds!=null?c+=1:t.minutes!=null?u+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var v=new Date(o,a,s,l,u,c);return Ee.makeDateWrapper(e,i,v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),h)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<Ee.months.length;i+=1)if(Ee.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),u=t!=null?this.parseMonth(t):0,c=r!=null?parseInt(r,10):1,h=i!=null?parseInt(i,10):0,v=o!=null?parseInt(o,10):0,f=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(h)||Number.isNaN(v)||Number.isNaN(f)||Number.isNaN(p)?null:{year:l,month:u,date:c,hours:h,minutes:v,seconds:f,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=ef.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,u,,c,h]=r;if(!t&&h!=null&&h.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(h));var v={year:i,month:o,date:a,hours:s,minutes:l,seconds:u,nanos:c};return t?oa(oa({},v),{},{overflow:h}):v}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=Ee.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=Ee.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var u=new Date(Date.now()),c=new Date(u.getFullYear(),u.getMonth(),u.getDate()-1),h=Ee.makeDateWrapper(e,r,c.getFullYear(),c.getMonth(),c.getDate()),v=Ee.makeDateWrapper(e,r,u.getFullYear(),u.getMonth(),u.getDate());return[h,v]}if(i==="now"){var f=new Date(Date.now()),p=e.DateWrapper.ofJsDate(f);return[p,null]}var g=Ee.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var b=Ee.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(b==null)throw new Error("Unable to extract date values from ".concat(g));var w=Ee.makeDateWrapper(e,r,b.year,b.month,b.date,b.hours,b.minutes,b.seconds,b.nanos),E=Ee.getNextDate(e,g,b,r);return[w,E]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=Ee.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Hi(Ee,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Hi(Ee,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function VC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function KC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=Nl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function Nl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i==null?void 0:i.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function tf(n,e,t,r){return Nl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function zC(n,e,t,r,i){return function(a){var s=a==null?void 0:a.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function GC(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function qC(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Bi(n,e,t){return(e=nf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nf(n){var e=rf(n,"string");return typeof e=="symbol"?e:e+""}function rf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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{}Bi(Jn,"not","not");Bi(Jn,"and","and");Bi(Jn,"or","or");function XC(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function Ce(n,e,t){return(e=of(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function of(n){var e=af(n,"string");return typeof e=="symbol"?e:e+""}function af(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class T{}Ce(T,"eq","eq");Ce(T,"eqIgnoreCase","eqIgnoreCase");Ce(T,"notEq","notEq");Ce(T,"notEqIgnoreCase","notEqIgnoreCase");Ce(T,"greaterThan","greaterThan");Ce(T,"greaterThanOrEqualTo","greaterThanOrEqualTo");Ce(T,"lessThan","lessThan");Ce(T,"lessThanOrEqualTo","lessThanOrEqualTo");Ce(T,"in","in");Ce(T,"inIgnoreCase","inIgnoreCase");Ce(T,"notIn","notIn");Ce(T,"notInIgnoreCase","notInIgnoreCase");Ce(T,"isTrue","isTrue");Ce(T,"isFalse","isFalse");Ce(T,"isNull","isNull");Ce(T,"invoke","invoke");Ce(T,"contains","contains");Ce(T,"notContains","notContains");Ce(T,"containsIgnoreCase","containsIgnoreCase");Ce(T,"startsWith","startsWith");Ce(T,"endsWith","endsWith");Ce(T,"containsAny","containsAny");var sf="DH_ITEM_KEY",aa=U.module("ViewportDataUtils");function kl(n){return"".concat(sf,"_").concat(n)}function ZC(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;aa.debug("table updated",i.detail);var l=new Map;s.forEach((u,c)=>{var h=e(u,o),v=kl(a+c);l.set(v,{key:v,item:h})}),aa.debug("update keys",l),t(l)}}function YC(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*QC(n,e){for(var t=n;t<=e;++t)yield{key:kl(t)}}function lf(n){return n==null||uf(n)?0:n.size}function uf(n){return n!=null&&typeof n=="object"&&"isClosed"in n&&typeof n.isClosed=="boolean"?n.isClosed:!1}function JC(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=ro(n-t,o,a),l=ro(i+t,o,a);return[s,l]}var wi;function sa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Vt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){sa(o,r,i,a,s,"next",l)}function s(l){sa(o,r,i,a,s,"throw",l)}a(void 0)})}}function Cn(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=cf(n,"string");return typeof e=="symbol"?e:e+""}function cf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Nt=U.module("TableUtils");function e0(n){return n===y.sortDirection.ascending||n===y.sortDirection.descending||n===y.sortDirection.reverse||n===y.sortDirection.none}class y{static copyTableAndApplyFilters(e){var t=arguments;return Vt(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(ti(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=y.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return y.isBooleanType(e)?[T.isTrue,T.isFalse,T.isNull]:y.isCharType(e)||y.isNumberType(e)||y.isDateType(e)?[T.eq,T.notEq,T.greaterThan,T.greaterThanOrEqualTo,T.lessThan,T.lessThanOrEqualTo]:y.isTextType(e)?[T.eq,T.eqIgnoreCase,T.notEq,T.notEqIgnoreCase,T.contains,T.notContains,T.startsWith,T.endsWith]:[]}static getNextSort(e,t,r){var i=e[r];if(i==null)return null;var o=y.getSortForColumn(t,i.name);return o===null?this.makeColumnSort(e,r,y.sortDirection.ascending,!1):o.direction===y.sortDirection.ascending?this.makeColumnSort(e,r,y.sortDirection.descending,!1):null}static makeColumnSort(e,t,r,i){var o=e[t];return o==null||r===y.sortDirection.none?null:{column:{name:o.name,type:o.type},isAbs:i,direction:r}}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t[r]==null)return[];var o=y.getNextSort(t,e,r);return y.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=y.makeColumnSort(t,r,i,o);return y.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=y.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==y.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case y.dataType.BOOLEAN:return y.dataType.BOOLEAN;case"char":case"java.lang.Character":case y.dataType.CHAR:return y.dataType.CHAR;case"java.lang.String":case y.dataType.STRING:return y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case y.dataType.DATETIME:return y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case y.dataType.DECIMAL:return y.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case y.dataType.INT:return y.dataType.INT;default:return y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return y.isIntegerType(e)||y.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return y.getNormalizedType(e)===y.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return _e.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return y.makeCancelableEventPromise(e,t,{timeout:r,matcher:i??void 0})}static makeCancelableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{timeout:i=0,matcher:o}=r,a,s,l=!0,u=new Promise((c,h)=>{s=setTimeout(()=>{a(),l=!1,h(new Ss('Event "'.concat(t,'" timed out.')))},i),a=e.addEventListener(t,v=>{if(o!=null&&!o(v)){Nt.debug2("Event triggered, but matcher returned false.");return}Nt.debug2("Event triggered, resolving."),a(),clearTimeout(s),l=!1,c(v)})});return u.cancel=()=>{if(l){Nt.debug2("Pending promise cleanup."),a(),clearTimeout(s),l=!1;return}Nt.debug2("Ignoring non-pending promise cancel.")},u}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=y.removeCommas(t);if(y.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case T.eq:return"=";case T.notEq:return"!=";case T.greaterThan:return">";case T.greaterThanOrEqualTo:return">=";case T.lessThan:return"<";case T.lessThanOrEqualTo:return"<=";case T.contains:return"~";case T.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return Gs.sort(o,a,t)})}constructor(e){Cn(this,"dh",void 0),this.dh=e,Gd(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return Vt(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),u=3;u<s;u++)l[u-3]=i[u];l.length>0&&(a=yield e.copy(),yield a.applyFilter(ti(...l.map(f=>f(a)))));var c=a.findColumn(t),h=yield a.selectDistinct([c]);a!==e&&a.close();var v=h.findColumn(t).sort()[r]();return o.applySort(h,[v])})()}doesColumnValueExist(e,t,r,i){var o=this;return Vt(function*(){if(e==null)return null;var a=tf(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,ti(a(s)));var l=lf(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=y.getNormalizedType(e);switch(t){case y.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case y.dataType.CHAR:case y.dataType.STRING:return this.dh.ValueType.STRING;case y.dataType.DATETIME:return this.dh.ValueType.DATETIME;case y.dataType.DECIMAL:case y.dataType.INT:return y.isBigDecimalType(e)||y.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),u=null,c=0;c<l.length;c+=1){var h=l[c].trim();if(h.length>0){var v=this.makeQuickFilterFromComponent(e,h,r);if(v)u?u=u.and(v):u=v;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&u?o=o.or(u):o=u}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return y.isNumberType(i)?this.makeQuickNumberFilter(e,t):y.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&y.isDateType(i)?this.makeQuickDateFilter(e,t,r):y.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,u=null,c=null,h=null,v=null;if(s!==null&&s.length>3&&([,l,u,c,h,v]=s),v!=null&&v.trim().length>0)return null;if(l==null&&(l="="),h!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(h=h.trim().toLowerCase(),h){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":u!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(c==null)return null;if(c=y.removeCommas(c),y.isLongType(e.type))try{c=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(u!=null?"-":"").concat(c)))}catch(f){return Nt.warn("Unable to create long filter",f),null}else{if(c=parseFloat(c),c==null||Number.isNaN(c))return null;c=i.FilterValue.ofNumber(u!=null?0-c:c)}return o=e.filter(),y.makeRangeFilterWithOperation(o,l,c)}static escapeQuickTextFilter(e){if(e==null)return null;var t=/^(!~|!=|~|=|!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null?"\\".concat(o).concat(a??""):a!=null&&r.test(a.toLowerCase())||a!=null&&a.startsWith("*")?"\\".concat(a):a!=null&&a.endsWith("*")&&!a.endsWith("\\*")?(a=a.substring(0,a.length-1),"".concat(a,"\\*")):"".concat(o??"").concat(a??"")}static unescapeQuickTextFilter(e){var t=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,r=/^\\*null$/,i=t.exec(e),o=null,a=null;return i!==null&&i.length>2&&([,o,a]=i),o!=null&&(o=o.replace("\\","")),a!=null&&r.test(a.toLowerCase())&&(a=a.replace("\\","")),o==null&&a!=null&&a.startsWith("\\*")&&(a=a.substring(1)),o==null&&a!=null&&a.endsWith("\\*")?(a=a.substring(0,a.length-2),"".concat(a,"*")):"".concat(o??"").concat(a??"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not()}var c=null,h=null;switch(l.startsWith("*")?(c="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(h="*",l=l.substring(0,l.length-1)),l=y.unescapeQuickTextFilter(l),s){case"~":return u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return c==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):h==="*"?u.isNull().or(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):u.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return c==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):h==="*"?u.isNull().not().and(u.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):u.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),u=e.filter();try{var c=y.makeBooleanValue(l);return c!=null&&c?u=u.isTrue():c===null?u=u.isNull():u=u.isFalse(),s?u.not():u}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var u=T.eq;switch(s){case"<":u=T.lessThan;break;case"<=":case"=<":u=T.lessThanOrEqualTo;break;case">":u=T.greaterThan;break;case">=":case"=>":u=T.greaterThanOrEqualTo;break;case"!=":case"!":u=T.notEq;break;case"=":case"==":default:u=T.eq;break}return this.makeQuickDateFilterWithOperation(e,l,u,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=Ee.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,u=s!=null?o.FilterValue.ofNumber(s):null,c=e.filter();if(l==null)return r===T.notEq?c.isNull().not():c.isNull();switch(r){case T.eq:{if(u!=null){var h=c.greaterThanOrEqualTo(l),v=c.lessThan(u);return h.and(v)}return c.eq(l)}case T.lessThan:return c.lessThan(l);case T.lessThanOrEqualTo:return u!=null?c.lessThan(u):c.lessThanOrEqualTo(l);case T.greaterThan:return u!=null?c.greaterThanOrEqualTo(u):c.greaterThan(l);case T.greaterThanOrEqualTo:return c.greaterThanOrEqualTo(l);case T.notEq:{if(u!=null){var f=c.lessThan(l),p=c.greaterThanOrEqualTo(u);return f.or(p)}return c.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,u=null;if(a!==null&&a.length>3&&([,s,l,u]=a),u!=null&&u.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var c=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return c.isNull();case"!=":case"!":return c.isNull().not();default:return null}var h=r.FilterValue.ofString(y.isRangeOperation(s)?y.quoteValue(l):l);return y.makeRangeFilterWithOperation(c,s,h)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,u=0;u<i.length;u+=1){var c=i[u],{selectedType:h,value:v}=c;if(h!=null&&h.length>0&&v!=null&&v.length>0)try{var f=this.makeAdvancedValueFilter(e,h,v,r);if(f!=null){if(u===0)l=f;else if(l!==null&&u-1<o.length){var p=o[u-1];if(p===Jn.and)l=l.and(f);else if(p===Jn.or)l=l.or(f);else{Nt.error("Unexpected filter operator",p,f),l=null;break}}}else Nt.debug2("Empty filter ignored for",h,v)}catch(b){Nt.error("Unable to create filter",b),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(y.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(y.isNumberType(e.type)||y.isCharType(e.type))return this.makeQuickFilter(e,"".concat(y.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case T.eq:return s.eq(a);case T.eqIgnoreCase:return s.eqIgnoreCase(a);case T.notEq:return s.notEq(a);case T.notEqIgnoreCase:return s.notEqIgnoreCase(a);case T.greaterThan:return s.greaterThan(a);case T.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case T.lessThan:return s.lessThan(a);case T.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case T.isTrue:return s.isTrue();case T.isFalse:return s.isFalse();case T.isNull:return s.isNull();case T.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case T.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case T.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case T.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case T.in:case T.inIgnoreCase:case T.notIn:case T.notInIgnoreCase:case T.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return A(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,Ee.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return A(a),a}return y.isBigDecimalType(e.type)||y.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return Vt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:y.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return y.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;y.isTextType(e.type)?r=t.FilterValue.ofString("a"):y.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):y.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=y.getBaseType(e);return y.isTextType(i)?r.FilterValue.ofString(t):y.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(y.removeCommas(t))):r.FilterValue.ofNumber(y.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return y.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):y.isTextType(e)?r.FilterValue.ofString(t):y.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(y.isTextType(e))return t;if(y.isLongType(e))return i.LongWrapper.ofString(y.removeCommas(t));if(y.isBooleanType(e))return y.makeBooleanValue(t,!0);if(y.isDateType(e)){var[o]=Ee.parseDateRange(i,t,r);return o}return y.isNumberType(e)?y.makeNumberValue(t):(Nt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:y.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):y.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}wi=y;Cn(y,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});Cn(y,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});Cn(y,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);Cn(y,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));Cn(y,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);Cn(y,"executeAndWaitForEvent",function(){var n=Vt(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:wi.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=wi.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function En(n,e,t){return(e=hf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hf(n){var e=mf(n,"string");return typeof e=="symbol"?e:e+""}function mf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 jl{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=y.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o==null||o.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hs,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;En(this,"defaultColumnFormatter",void 0),En(this,"typeFormatterMap",void 0),En(this,"columnFormatMap",void 0),En(this,"truncateNumbersWithPound",void 0),En(this,"showEmptyStrings",void 0),En(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Gv,this.typeFormatterMap=new Map([[y.dataType.BOOLEAN,new Hv],[y.dataType.CHAR,new Bv],[y.dataType.DATETIME,new pt(e,r)],[y.dataType.DECIMAL,new ze(e,i)],[y.dataType.INT,new Ot(e,o)],[y.dataType.STRING,new Yv]]),this.columnFormatMap=jl.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=y.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i==null?void 0:i.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=y.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(y.dataType.DATETIME);return Ed(e,pt),e.dhTimeZone.id}}function Sn(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=ff(n,"string");return typeof e=="symbol"?e:e+""}function ff(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ee{}Sn(ee,"INTEGER","int");Sn(ee,"LONG","long");Sn(ee,"DOUBLE","double");Sn(ee,"BOOLEAN","bool");Sn(ee,"STRING","string");Sn(ee,"DATE_TIME","datetime");Sn(ee,"LOCAL_TIME","localtime");function Ll(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 la(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ua(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(r){Ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ue(n,e,t){return(e=pf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pf(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)}var da="unknown",bf=2147483647,yf=-2147483648,ca=/^[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]+)?$/,ha=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class je{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case ee.STRING:return ee.STRING;case ee.INTEGER:return je.checkInteger(e);case ee.LONG:return je.checkLong(e);case ee.DOUBLE:return je.checkDouble(e);case ee.BOOLEAN:return je.checkBoolean(e);case ee.DATE_TIME:return je.checkDateTime(e);case ee.LOCAL_TIME:return je.checkLocalTime(e);default:return je.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:je.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:t.includes(".")?ee.DOUBLE:ee.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return je.isNotParsableNumber(t)?ee.STRING:ee.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ee.BOOLEAN:ee.STRING}static checkDateTime(e){return ca.test(e)?ee.DATE_TIME:ee.STRING}static checkLocalTime(e){return ha.test(e)?ee.LOCAL_TIME:ee.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(je.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?ee.BOOLEAN:ca.test(e)&&e.includes(":")?ee.DATE_TIME:ha.test(e)?ee.LOCAL_TIME:ee.STRING}return je.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ee.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ee.LONG;var r=parseInt(e,10);return r>bf||r<yf?ee.LONG:ee.INTEGER}constructor(e,t,r,i,o,a,s,l,u,c){Ue(this,"onFileCompleted",void 0),Ue(this,"file",void 0),Ue(this,"readHeaders",void 0),Ue(this,"nullString",void 0),Ue(this,"onProgress",void 0),Ue(this,"onError",void 0),Ue(this,"types",void 0),Ue(this,"chunks",void 0),Ue(this,"totalChunks",void 0),Ue(this,"rowCount",void 0),Ue(this,"isZip",void 0),Ue(this,"shouldTrim",void 0),Ue(this,"zipProgress",void 0),Ue(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=c,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=ua(ua({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Gn.parse(this.file,this.config);else{var e=Ll(this.file,this.handleNodeUpdate);Gn.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(da),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,A(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=je.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
7
7
|
Expected length `.concat(i.length," but found ").concat(s.length,`.
|
|
8
|
-
Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var a=this.onProgress(o);a&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;A(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===
|
|
9
|
-
`).concat(a));for(var s=0;s<e;s+=1){var l=this.type.shouldTrim?t[o][s].trim():t[o][s];i[s][o]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)Gn.parse(this.file,this.config);else{var o=
|
|
8
|
+
Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var a=this.onProgress(o);a&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;A(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===da||i===ee.LOCAL_TIME?ee.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}var Al;function ge(n,e,t){return(e=Cf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cf(n){var e=Sf(n,"string");return typeof e=="symbol"?e:e+""}function Sf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var pr=U.module("CsvParser"),wf=650;class An{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(An.generateHeaderRecursive(Math.floor(e/26)-1)),r=e%26),t.concat(String.fromCharCode(65+r))}constructor(e){var{onFileCompleted:t,session:r,file:i,type:o,readHeaders:a=!0,onProgress:s,onError:l,timeZone:u,isZip:c}=e;ge(this,"onFileCompleted",void 0),ge(this,"session",void 0),ge(this,"file",void 0),ge(this,"isZip",void 0),ge(this,"type",void 0),ge(this,"readHeaders",void 0),ge(this,"timeZone",void 0),ge(this,"onProgress",void 0),ge(this,"onError",void 0),ge(this,"tables",void 0),ge(this,"headers",void 0),ge(this,"types",void 0),ge(this,"rowCount",void 0),ge(this,"rowsProcessed",void 0),ge(this,"chunks",void 0),ge(this,"totalChunks",void 0),ge(this,"isComplete",void 0),ge(this,"zipProgress",void 0),ge(this,"consolidatedChunks",void 0),ge(this,"numConsolidated",void 0),ge(this,"isCancelled",void 0),ge(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=c,this.type=o,this.readHeaders=a,this.timeZone=u,this.onProgress=s,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=c?0:Math.ceil(i.size/Gn.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:o.delimiter,newline:o.newline,escapeChar:o.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:o.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var r=t.length,i=new Array(e).fill(null).map(()=>new Array(r)),o=0;o<r;o+=1){var a=t[o];if(a.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(a.length,`
|
|
9
|
+
`).concat(a));for(var s=0;s<e;s+=1){var l=this.type.shouldTrim?t[o][s].trim():t[o][s];i[s][o]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)Gn.parse(this.file,this.config);else{var o=Ll(this.file,this.handleNodeUpdate);Gn.parse(o,this.config),o.resume()}},t=new je(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:r,onError:i,handleCreateTable:o,isZip:a,tables:s}=this;if(this.isCancelled){pr.debug2("CSV parser cancelled."),t.abort(),s.forEach(h=>h.close());return}var{data:l}=e;this.headers||(r?(this.headers=It.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=An.generateHeaders(l[0].length));var u=[];try{if(u=this.transpose(this.headers.length,l),a)this.consolidateChunks(u,t);else{var c=this.chunks;this.chunks+=1,o(c,u,t)}}catch(h){i(h)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var r=0;r<e.length;r+=1)this.consolidatedChunks[r]=this.consolidatedChunks[r].concat(e[r]);this.numConsolidated+=1,(this.numConsolidated>=wf||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,A(o),r(i,o,e)}handleCreateTable(e,t,r){var{session:i,tables:o,onFileCompleted:a,totalChunks:s,types:l,onProgress:u,onError:c}=this;r&&r.pause(),A(this.headers),A(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(h=>{if(this.isCancelled){pr.debug2("CSV parser cancelled."),r&&r.abort(),o.forEach(f=>f.close());return}r&&r.resume(),o[e]=h;var v=0;s>0?v=Math.round(o.length/s*50)+50:v=Math.round(this.rowsProcessed/this.rowCount*50)+50,pr.debug2("CSV parser progress ".concat(v)),u(v),this.isComplete&&o.length===this.chunks&&(pr.debug2("CSV parser complete."),a(o))}).catch(h=>{!this.isComplete&&r&&r.abort(),c(h)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}Al=An;ge(An,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(Al.generateHeaderRecursive(t));return e});function Ui(n,e,t){return(e=Ef(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ef(n){var e=Pf(n,"string");return typeof e=="symbol"?e:e+""}function Pf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zt{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Ui(Zt,"DEFAULT_TYPE","DEFAULT_CSV");Ui(Zt,"AUTO","AUTODETECT");Ui(Zt,"TYPES",Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
|
|
10
10
|
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
11
11
|
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
12
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 jl(n,e,t){return(e=wf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wf(n){var e=Ef(n,"string");return typeof e=="symbol"?e:e+""}function Ef(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 da=U.module("CsvInputBar"),Pf=Object.entries(Xt.TYPES).map(n=>{var[e,t]=n;return d.jsx("option",{value:e,children:t.name},e)});class Ll extends m.Component{constructor(e){super(e),jl(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=$.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Xt.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 a,s=t.name.lastIndexOf("."),l=It.makeVariableName(t.name.substring(0,s));this.setState({tableName:l,tableNameSet:!0}),(a=this.inputRef.current)===null||a===void 0||a.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:Xt.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:Xt.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;da.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;da.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:a,isFirstRowHeaders:s,type:l}=this.state,u=h=>{h.length===1?r.bindTableToVariable(h[0],a).then(()=>this.openTable()).catch(v=>this.handleError(v)):r.mergeTables(h).then(v=>{r.bindTableToVariable(v,a).then(()=>this.openTable()).catch(f=>this.handleError(f)),h.forEach(f=>f.close())}).catch(v=>this.handleError(v))},c=new An({onFileCompleted:u,session:r,file:e,type:Xt.TYPES[l],readHeaders:s,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,a=0;a<i.length;a+=1){var s=i[a];if(ze.isValidExtension(s.name)){t("Loading ".concat(s.name," as csv from ").concat(e.name)),o=!0,this.handleFile(s,!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:a,type:s}=this.state,l=!!t&&!r;return d.jsxs("div",{className:"csv-input-bar",children:[!o&&d.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),d.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:q("form-control",{"is-invalid":l}),value:r,onChange:this.handleTableName})]}),d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"formatSelect",children:"File format"}),d.jsx(ll,{id:"formatSelect",className:"custom-select",value:s,onChange:this.handleQueryTypeChange,children:Pf})]}),d.jsx(el,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),d.jsxs("div",{className:"csv-input-buttons form-group",children:[d.jsx(se,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),d.jsx(se,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!r,children:"Upload"})]})]}),o&&d.jsxs("div",{className:"csv-progress-container",children:[d.jsx("label",{children:"Uploading Table"}),d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(a,"%")},"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100})}),d.jsxs("label",{children:[a,"%"]}),d.jsx(se,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}jl(Ll,"defaultProps",{file:null,paste:null,unzip:null});function ca(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Tf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ca(o,r,i,a,s,"next",l)}function s(l){ca(o,r,i,a,s,"throw",l)}a(void 0)})}}var _f={placement:"bottom-end"};function Of(n){var{children:e,dh:t,session:r,overflowActions:i}=n,[o,a]=m.useState(0),s=m.useCallback(function(){var h=Tf(function*(v){a(p=>p+1);try{var{result:f}=v.detail;yield f}catch{}a(p=>p-1)});return function(v){return h.apply(this,arguments)}}(),[]);m.useEffect(function(){return r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,s)},[t,s,r]);var l=null,u=null;o>0?(l="console-status-icon-pending",u="Worker is busy"):(l="console-status-icon-idle",u="Worker is idle");var c=i!=null&&(!Array.isArray(i)||i.length>0);return d.jsxs("div",{className:"console-pane-status-bar",children:[d.jsxs("div",{children:[d.jsx("div",{className:q("console-status-icon",l)}),d.jsx(he,{children:u})]}),e,c&&d.jsx(se,{kind:"ghost",icon:Ns,tooltip:"More Actions...","aria-label":"More Actions...",onClick:Fs,children:d.jsx(or,{actions:i,popperOptions:_f})})]})}var xf=5e3;function If(n){var{openObject:e,objects:t}=n,[r,i]=m.useState(""),o=m.useRef(null),a=Tc(()=>{i("")},xf),s=m.useCallback(()=>{var c;a.cancel(),(c=o.current)===null||c===void 0||c.select()},[a]),l=m.useCallback(()=>{a()},[a]),u=m.useMemo(()=>{if(t.length===0)return[];var c={menuElement:d.jsx(Wr,{value:r,onChange:f=>{i(f.target.value)},className:"console-menu",ref:o})},h=r?t.filter(f=>{var{title:p}=f;return p!=null&&p.toLowerCase().includes(r.toLowerCase())}):t,v=h.map(f=>({title:f.title,action:()=>{e(f)},icon:d.jsx(yl,{type:f.type})}));return[c,...v]},[t,r,e]);return d.jsx(se,{"aria-label":"Objects",kind:"ghost",disabled:t.length===0,onClick:Fs,tooltip:t.length===0?"No objects available":"Objects",icon:d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(ve,{mask:Os,icon:vi,transform:"right-5 down-5"}),d.jsx(ve,{icon:vi,transform:"right-8 down-6"})]}),children:d.jsx(or,{actions:u,onMenuOpened:s,onMenuClosed:l,options:{initialKeyboardIndex:1},popperOptions:{placement:"bottom-end"}})})}function ha(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ha(Object(t),!0).forEach(function(r){et(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function et(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=Mf(n,"string");return typeof e=="symbol"?e:e+""}function Mf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=U.module("Console"),ma={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function Nf(){return!0}function kf(n){return d.jsx(d.Fragment,{})}class Zt extends m.PureComponent{static isErrorLevel(e){return e===Ie.STDERR||e===Ie.ERROR||e===Ie.FATAL}static isOutputLevel(e){return e===Ie.STDOUT||Zt.isErrorLevel(e)}constructor(e){super(e),et(this,"cancelListener",void 0),et(this,"consolePane",void 0),et(this,"consoleInput",void 0),et(this,"consoleHistoryScrollPane",void 0),et(this,"consoleHistoryContent",void 0),et(this,"pending",void 0),et(this,"queuedLogMessages",void 0),et(this,"resizeObserver",void 0),et(this,"processLogMessageQueue",Hr(()=>{this.setState(i=>{lt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=i;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Zt.LOG_THROTTLE)),et(this,"getObjects",Yt(i=>Array.from(i.values()))),et(this,"getContextActions",Yt(i=>[...i,{action:this.handleClearShortcut,shortcut:Ke.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Ke.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=$.createRef(),this.consoleInput=$.createRef(),this.consoleHistoryScrollPane=$.createRef(),this.consoleHistoryContent=$.createRef(),this.pending=new nr,this.queuedLogMessages=[],this.resizeObserver=new window.ResizeObserver(this.handleHistoryResize);var{objectMap:t,settings:r}=this.props;this.state=mt(mt({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},ma),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:a,language:s,scope:l}=this.props,u=a.addItem(s,l,t,{command:t,startTime:new Date().toJSON()});u.catch(c=>{lt.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom()}),i.then(c=>{this.handleCommandResult(c,o,u)}).catch(c=>{this.handleCommandError(c,o,u)})}handleCommandResult(e,t,r){var i,o,a=e==null||(i=e.startTimestamp)===null||i===void 0?void 0:i.asNumber(),s=e==null||(o=e.endTimestamp)===null||o===void 0?void 0:o.asNumber(),l=mt(mt({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result,serverStartTime:a,serverEndTime:s});this.setState(u=>{var{consoleHistory:c}=u,h=c.lastIndexOf(t);if(h<0)return lt.error("historyItem not found in consoleHistory"),null;var v=c.concat();return v[h]=l,{consoleHistory:v}}),e&&(this.scrollConsoleHistoryToBottom(),this.updateHistory(e,l),this.updateKnownObjects(l),this.updateWorkspaceHistoryItem({error:e.error,serverStartTime:a,serverEndTime:s},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(_e.isCanceled(e)){lt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),a=o.lastIndexOf(t),s=mt({},t);return s.wrappedResult=void 0,s.cancelResult=void 0,s.endTime=Date.now(),s.result={error:e},o[a]=s,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&Zt.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};Zt.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){lt.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)){lt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,a,{consoleHistory:s}=r,l=s.lastIndexOf(e);if(l<0)return lt.error("historyItem not found in state.consoleHistory"),null;var u=new Map(r.objectHistoryMap),c=new Map(r.objectMap),h=function(f){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:g}=f;A(g);var b=u.get(g);if(b!=null&&b>=0){var w;s===r.consoleHistory&&(s=s.concat());var E=mt(mt({},s[b]),{},{disabledObjects:[...(w=s[b].disabledObjects)!==null&&w!==void 0?w:[],g]});s[b]=E}u.set(g,l),p?c.delete(g):c.set(g,f)};return(i=t)===null||i===void 0||i.updated.forEach(v=>h(v)),(o=t)===null||o===void 0||o.removed.forEach(v=>h(v,!0)),(a=t)===null||a===void 0||a.created.forEach(v=>{var{title:f}=v;A(f),u.set(f,l),c.set(f,v)}),{objectHistoryMap:u,objectMap:c,consoleHistory:s}})}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 a=mt(mt({},o),{},{data:mt(mt({},o.data),{},{endTime:i,result:e})}),{commandHistoryStorage:s,language:l}=this.props;s.updateItem(l,a).catch(u=>{lt.warn("Error updating command history storage",u)})}).catch(o=>{lt.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){lt.debug("handleScrollPaneScroll",e);var t=this.consoleHistoryScrollPane.current;A(t),this.setState({isScrollDecorationShown:t.scrollTop>0&&t.scrollHeight>t.clientHeight,isStuckToBottom:this.isAtBottom()})}handleHistoryResize(e){lt.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:ze.MULTIPLE_FILE_ERROR});return}var r=t[0];ze.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:ze.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:a}=this.props,{consoleHistory:s,objectMap:l}=this.state,u={name:e,title:e,type:t.VariableType.TABLE},c=l.has(e),h={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[c?"updated":"created"]:[u]}}},v=s.concat(h);this.setState({consoleHistory:v}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(h),r({name:e,type:t.VariableType.TABLE}),i.addItem(o,a,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:ne.groups.high,icon:r?Mn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ne.groups.high,icon:e?Mn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ne.groups.high,icon:t?Mn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ne.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=>{lt.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(ma),o={},a=!1,s=0;s<i.length;s+=1){var l=i[s],{[l]:u}=t,{[l]:c}=e;u!==c&&(a=!0),o[l]=u}if(!(r&&!a)){var{onSettingsChange:h}=this.props;h(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:a,session:s,scope:l,commandHistoryStorage:u,timeZone:c,disabled:h,unzip:v,supportsType:f,iconForType:p,showObjectsMenu:g}=this.props,{consoleHeight:b,consoleHistory:w,isScrollDecorationShown:E,objectMap:P,showCsvOverlay:R,csvFile:Z,csvPaste:re,dragError:Y,csvUploadInProgress:k}=this.state,B=this.getObjects(P),Q=Math.round(b*.7),G=this.getContextActions(e);return d.jsxs("div",{role:"presentation",className:q("iris-console","h-100","w-100",{disabled:h}),children:[d.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[d.jsxs(Of,{dh:t,session:s,overflowActions:this.handleOverflowActions,children:[o,g===!0&&d.jsx(If,{openObject:a,objects:B})]}),d.jsxs("div",{className:"console-csv-container",onDragOver:ze.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[R&&d.jsx(ze,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:Y,onError:this.handleCsvError,uploadInProgress:k,allowZip:v!=null}),d.jsxs("div",{role:"presentation",className:q("scroll-pane no-scroll-x",{"scroll-decoration":E}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[d.jsx(Am,{items:w,openObject:a,language:i,disabled:h,supportsType:f,iconForType:p,ref:this.consoleHistoryContent,onCommandSubmit:this.handleCommandSubmit}),r]})]}),!R&&d.jsx(jn,{ref:this.consoleInput,session:s,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:Q,commandHistoryStorage:u}),R&&d.jsx(Ll,{session:s,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:Z??void 0,paste:re??void 0,onInProgress:this.handleCsvInProgress,timeZone:c,unzip:v})]}),d.jsx(ne,{actions:G,ignoreClassNames:[jn.INPUT_CLASS_NAME]})]})}}et(Zt,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:Nf,iconForType:kf,showObjectsMenu:!0});et(Zt,"LOG_THROTTLE",500);var jf={groovy:"Groovy",python:"Python",scala:"Scala"};class Ei{static normalizeScriptLanguage(e){return jf[e]||null}static getDisabledRunTooltip(e,t,r,i){return e?t?null:"".concat(r," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
|
|
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 Rl(n,e,t){return(e=Tf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tf(n){var e=_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 ma=U.module("CsvInputBar"),Of=Object.entries(Zt.TYPES).map(n=>{var[e,t]=n;return d.jsx("option",{value:e,children:t.name},e)});class Fl extends m.Component{constructor(e){super(e),Rl(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=$.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Zt.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 a,s=t.name.lastIndexOf("."),l=It.makeVariableName(t.name.substring(0,s));this.setState({tableName:l,tableNameSet:!0}),(a=this.inputRef.current)===null||a===void 0||a.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:Zt.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:Zt.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;ma.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;ma.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:a,isFirstRowHeaders:s,type:l}=this.state,u=h=>{h.length===1?r.bindTableToVariable(h[0],a).then(()=>this.openTable()).catch(v=>this.handleError(v)):r.mergeTables(h).then(v=>{r.bindTableToVariable(v,a).then(()=>this.openTable()).catch(f=>this.handleError(f)),h.forEach(f=>f.close())}).catch(v=>this.handleError(v))},c=new An({onFileCompleted:u,session:r,file:e,type:Zt.TYPES[l],readHeaders:s,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,a=0;a<i.length;a+=1){var s=i[a];if(Ke.isValidExtension(s.name)){t("Loading ".concat(s.name," as csv from ").concat(e.name)),o=!0,this.handleFile(s,!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:a,type:s}=this.state,l=!!t&&!r;return d.jsxs("div",{className:"csv-input-bar",children:[!o&&d.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),d.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:q("form-control",{"is-invalid":l}),value:r,onChange:this.handleTableName})]}),d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"formatSelect",children:"File format"}),d.jsx(cl,{id:"formatSelect",className:"custom-select",value:s,onChange:this.handleQueryTypeChange,children:Of})]}),d.jsx(rl,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),d.jsxs("div",{className:"csv-input-buttons form-group",children:[d.jsx(se,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),d.jsx(se,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!r,children:"Upload"})]})]}),o&&d.jsxs("div",{className:"csv-progress-container",children:[d.jsx("label",{children:"Uploading Table"}),d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(a,"%")},"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100})}),d.jsxs("label",{children:[a,"%"]}),d.jsx(se,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Rl(Fl,"defaultProps",{file:null,paste:null,unzip:null});function va(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function xf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){va(o,r,i,a,s,"next",l)}function s(l){va(o,r,i,a,s,"throw",l)}a(void 0)})}}var If={placement:"bottom-end"};function Df(n){var{children:e,dh:t,session:r,overflowActions:i}=n,[o,a]=m.useState(0),s=m.useCallback(function(){var h=xf(function*(v){a(p=>p+1);try{var{result:f}=v.detail;yield f}catch{}a(p=>p-1)});return function(v){return h.apply(this,arguments)}}(),[]);m.useEffect(function(){return r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,s)},[t,s,r]);var l=null,u=null;o>0?(l="console-status-icon-pending",u="Worker is busy"):(l="console-status-icon-idle",u="Worker is idle");var c=i!=null&&(!Array.isArray(i)||i.length>0);return d.jsxs("div",{className:"console-pane-status-bar",children:[d.jsxs("div",{children:[d.jsx("div",{className:q("console-status-icon",l)}),d.jsx(he,{children:u})]}),e,c&&d.jsx(se,{kind:"ghost",icon:Ls,tooltip:"More Actions...","aria-label":"More Actions...",onClick:Bs,children:d.jsx(or,{actions:i,popperOptions:If})})]})}var Mf=5e3;function Nf(n){var{openObject:e,objects:t}=n,[r,i]=m.useState(""),o=m.useRef(null),a=xc(()=>{i("")},Mf),s=m.useCallback(()=>{var c;a.cancel(),(c=o.current)===null||c===void 0||c.select()},[a]),l=m.useCallback(()=>{a()},[a]),u=m.useMemo(()=>{if(t.length===0)return[];var c={menuElement:d.jsx(Wr,{value:r,onChange:f=>{i(f.target.value)},className:"console-menu",ref:o})},h=r?t.filter(f=>{var{title:p}=f;return p!=null&&p.toLowerCase().includes(r.toLowerCase())}):t,v=h.map(f=>({title:f.title,action:()=>{e(f)},icon:d.jsx(wl,{type:f.type})}));return[c,...v]},[t,r,e]);return d.jsx(se,{"aria-label":"Objects",kind:"ghost",disabled:t.length===0,onClick:Bs,tooltip:t.length===0?"No objects available":"Objects",icon:d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(ve,{mask:Ds,icon:vi,transform:"right-5 down-5"}),d.jsx(ve,{icon:vi,transform:"right-8 down-6"})]}),children:d.jsx(or,{actions:u,onMenuOpened:s,onMenuClosed:l,options:{initialKeyboardIndex:1},popperOptions:{placement:"bottom-end"}})})}function fa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(r){et(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function et(n,e,t){return(e=kf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kf(n){var e=jf(n,"string");return typeof e=="symbol"?e:e+""}function jf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lt=U.module("Console"),pa={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function Lf(){return!0}function Af(n){return d.jsx(d.Fragment,{})}class Yt extends m.PureComponent{static isErrorLevel(e){return e===Ie.STDERR||e===Ie.ERROR||e===Ie.FATAL}static isOutputLevel(e){return e===Ie.STDOUT||Yt.isErrorLevel(e)}constructor(e){super(e),et(this,"cancelListener",void 0),et(this,"consolePane",void 0),et(this,"consoleInput",void 0),et(this,"consoleHistoryScrollPane",void 0),et(this,"consoleHistoryContent",void 0),et(this,"pending",void 0),et(this,"queuedLogMessages",void 0),et(this,"resizeObserver",void 0),et(this,"processLogMessageQueue",Hr(()=>{this.setState(i=>{lt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=i;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Yt.LOG_THROTTLE)),et(this,"getObjects",Qt(i=>Array.from(i.values()))),et(this,"getContextActions",Qt(i=>[...i,{action:this.handleClearShortcut,shortcut:Ve.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Ve.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=$.createRef(),this.consoleInput=$.createRef(),this.consoleHistoryScrollPane=$.createRef(),this.consoleHistoryContent=$.createRef(),this.pending=new nr,this.queuedLogMessages=[],this.resizeObserver=new window.ResizeObserver(this.handleHistoryResize);var{objectMap:t,settings:r}=this.props;this.state=mt(mt({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},pa),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:a,language:s,scope:l}=this.props,u=a.addItem(s,l,t,{command:t,startTime:new Date().toJSON()});u.catch(c=>{lt.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom()}),i.then(c=>{this.handleCommandResult(c,o,u)}).catch(c=>{this.handleCommandError(c,o,u)})}handleCommandResult(e,t,r){var i,o,a=e==null||(i=e.startTimestamp)===null||i===void 0?void 0:i.asNumber(),s=e==null||(o=e.endTimestamp)===null||o===void 0?void 0:o.asNumber(),l=mt(mt({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result,serverStartTime:a,serverEndTime:s});this.setState(u=>{var{consoleHistory:c}=u,h=c.lastIndexOf(t);if(h<0)return lt.error("historyItem not found in consoleHistory"),null;var v=c.concat();return v[h]=l,{consoleHistory:v}}),e&&(this.scrollConsoleHistoryToBottom(),this.updateHistory(e,l),this.updateKnownObjects(l),this.updateWorkspaceHistoryItem({error:e.error,serverStartTime:a,serverEndTime:s},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(_e.isCanceled(e)){lt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),a=o.lastIndexOf(t),s=mt({},t);return s.wrappedResult=void 0,s.cancelResult=void 0,s.endTime=Date.now(),s.result={error:e},o[a]=s,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&Yt.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};Yt.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){lt.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)){lt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,a,{consoleHistory:s}=r,l=s.lastIndexOf(e);if(l<0)return lt.error("historyItem not found in state.consoleHistory"),null;var u=new Map(r.objectHistoryMap),c=new Map(r.objectMap),h=function(f){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:g}=f;A(g);var b=u.get(g);if(b!=null&&b>=0){var w;s===r.consoleHistory&&(s=s.concat());var E=mt(mt({},s[b]),{},{disabledObjects:[...(w=s[b].disabledObjects)!==null&&w!==void 0?w:[],g]});s[b]=E}u.set(g,l),p?c.delete(g):c.set(g,f)};return(i=t)===null||i===void 0||i.updated.forEach(v=>h(v)),(o=t)===null||o===void 0||o.removed.forEach(v=>h(v,!0)),(a=t)===null||a===void 0||a.created.forEach(v=>{var{title:f}=v;A(f),u.set(f,l),c.set(f,v)}),{objectHistoryMap:u,objectMap:c,consoleHistory:s}})}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 a=mt(mt({},o),{},{data:mt(mt({},o.data),{},{endTime:i,result:e})}),{commandHistoryStorage:s,language:l}=this.props;s.updateItem(l,a).catch(u=>{lt.warn("Error updating command history storage",u)})}).catch(o=>{lt.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){lt.debug("handleScrollPaneScroll",e);var t=this.consoleHistoryScrollPane.current;A(t),this.setState({isScrollDecorationShown:t.scrollTop>0&&t.scrollHeight>t.clientHeight,isStuckToBottom:this.isAtBottom()})}handleHistoryResize(e){lt.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:Ke.MULTIPLE_FILE_ERROR});return}var r=t[0];Ke.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:Ke.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:a}=this.props,{consoleHistory:s,objectMap:l}=this.state,u={name:e,title:e,type:t.VariableType.TABLE},c=l.has(e),h={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[c?"updated":"created"]:[u]}}},v=s.concat(h);this.setState({consoleHistory:v}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(h),r({name:e,type:t.VariableType.TABLE}),i.addItem(o,a,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:ne.groups.high,icon:r?Mn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ne.groups.high,icon:e?Mn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ne.groups.high,icon:t?Mn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ne.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=>{lt.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(pa),o={},a=!1,s=0;s<i.length;s+=1){var l=i[s],{[l]:u}=t,{[l]:c}=e;u!==c&&(a=!0),o[l]=u}if(!(r&&!a)){var{onSettingsChange:h}=this.props;h(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:a,session:s,scope:l,commandHistoryStorage:u,timeZone:c,disabled:h,unzip:v,supportsType:f,iconForType:p,showObjectsMenu:g}=this.props,{consoleHeight:b,consoleHistory:w,isScrollDecorationShown:E,objectMap:P,showCsvOverlay:R,csvFile:Z,csvPaste:re,dragError:Y,csvUploadInProgress:k}=this.state,B=this.getObjects(P),Q=Math.round(b*.7),G=this.getContextActions(e);return d.jsxs("div",{role:"presentation",className:q("iris-console","h-100","w-100",{disabled:h}),children:[d.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[d.jsxs(Df,{dh:t,session:s,overflowActions:this.handleOverflowActions,children:[o,g===!0&&d.jsx(Nf,{openObject:a,objects:B})]}),d.jsxs("div",{className:"console-csv-container",onDragOver:Ke.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[R&&d.jsx(Ke,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:Y,onError:this.handleCsvError,uploadInProgress:k,allowZip:v!=null}),d.jsxs("div",{role:"presentation",className:q("scroll-pane no-scroll-x",{"scroll-decoration":E}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[d.jsx($m,{items:w,openObject:a,language:i,disabled:h,supportsType:f,iconForType:p,ref:this.consoleHistoryContent,onCommandSubmit:this.handleCommandSubmit}),r]})]}),!R&&d.jsx(jn,{ref:this.consoleInput,session:s,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:Q,commandHistoryStorage:u}),R&&d.jsx(Fl,{session:s,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:Z??void 0,paste:re??void 0,onInProgress:this.handleCsvInProgress,timeZone:c,unzip:v})]}),d.jsx(ne,{actions:G,ignoreClassNames:[jn.INPUT_CLASS_NAME]})]})}}et(Yt,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:Lf,iconForType:Af,showObjectsMenu:!0});et(Yt,"LOG_THROTTLE",500);var Rf={groovy:"Groovy",python:"Python",scala:"Scala"};class Ei{static normalizeScriptLanguage(e){return Rf[e]||null}static getDisabledRunTooltip(e,t,r,i){return e?t?null:"".concat(r," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
|
|
14
14
|
`),r=t.reduce((i,o)=>{var a=o.length-o.trimStart().length;return a===o.length?i:a<i?a:i},Number.MAX_SAFE_INTEGER);return t.map(i=>i.slice(r)).join(`
|
|
15
|
-
`)}}function Vn(n,e,t){return(e=
|
|
16
|
-
`).concat(e)):r.setValue("".concat(e));var o=r.getLineCount(),a=r.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:a}),t&&this.editor.focus()}updateDimensions(){Ze.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Ze.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var e,{error:t,isLoaded:r,isLoading:i,session:o,sessionLanguage:a,settings:s}=this.props,{model:l}=this.state,u=t?"Unable to open document. ".concat(t):null,c=s&&(e=s.language)!==null&&e!==void 0?e:null,h=l&&o&&c===a;return d.jsxs(d.Fragment,{children:[(t||i)&&d.jsx("div",{className:"h-100 w-100 position-relative",children:d.jsx(bn,{"data-testid":"script-editor-loading",errorMessage:u,isLoading:i,isLoaded:r})}),r&&d.jsx("div",{className:"h-100 w-100 script-editor",children:s&&d.jsxs(d.Fragment,{children:[d.jsx(
|
|
17
|
-
`,
|
|
18
|
-
`),{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:a}=this.state,{result:s,startTime:l,endTime:u}=o??{},c=(e=s==null?void 0:s.error)!==null&&e!==void 0?e:a,h=qe.formatConvertedDuration(l,u??i),v=this.getPreviewText(t),f=!!h;return d.jsxs("div",{className:"command-history-item-tooltip",children:[d.jsxs("div",{className:"scroll-container",children:[d.jsx(
|
|
19
|
-
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<
|
|
15
|
+
`)}}function Vn(n,e,t){return(e=Ff(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ff(n){var e=$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 Ze=U.module("ScriptEditor");class $l extends m.Component{constructor(e){super(e),Vn(this,"contextActionCleanups",void 0),Vn(this,"completionCleanup",void 0),Vn(this,"editor",void 0),Vn(this,"editorComponent",void 0),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=$.createRef(),this.state={model:null}}componentDidMount(){ce.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var t,r,{sessionLanguage:i,settings:o}=this.props,a=o==null?void 0:o.language,s=a!==((t=e.settings)===null||t===void 0?void 0:t.language);s&&(Ze.debug("Set language",a),this.setLanguage(a));var l=i==null&&e.sessionLanguage!=null,u=a===i,c=((r=e.settings)===null||r===void 0?void 0:r.language)===e.sessionLanguage;(l||i!==void 0&&c&&!u)&&(Ze.debug("De-init completion"),this.deInitCodeCompletion());var h=i!=null&&e.sessionLanguage==null;(h&&u||i!==void 0&&!c&&u)&&(Ze.debug("Init completion"),this.initCodeCompletion())}componentWillUnmount(){ce.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Ze.error("Editor not initialized"),null)}getSelectedCommand(){var e,t,r=(e=this.editor)===null||e===void 0?void 0:e.getSelection();A(r);var i=(t=this.editor)===null||t===void 0?void 0:t.getModel();A(i);var{startLineNumber:o,endColumn:a}=r,{endLineNumber:s}=r;a===1&&s>o&&(s-=1);var l=i.getLineMinColumn(o),u=i.getLineMaxColumn(s),c=r.setStartPosition(o,l).setEndPosition(s,u);return Ei.outdentCode(i.getValueInRange(c))}handleEditorInitialized(e){var{focusOnMount:t,onChange:r,onEditorInitialized:i,settings:o,session:a,sessionLanguage:s}=this.props;Ze.debug("handleEditorInitialized",s,a,o),this.editor=e,this.setState({model:this.editor.getModel()}),me.setEOL(e),me.registerPasteHandler(e),this.initContextActions(),a!=null&&o&&s===o.language&&this.initCodeCompletion(),e.onDidChangeModelContent(r),t!=null&&t&&e.focus(),i(this.editor)}handleEditorWillDestroy(e){Ze.debug("handleEditorWillDestroy");var{onEditorWillDestroy:t}=this.props;t(e),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){var{onRunCommand:e,session:t,sessionLanguage:r,settings:i}=this.props,o=this.getValue(),a=i==null?void 0:i.language,s=a===r;if(t==null||!s){Ze.info("Run disabled - ".concat(t==null?"session disconnected":"language mismatch"));return}o!=null&&e(o)}handleRunSelected(){var{onRunCommand:e,session:t,sessionLanguage:r,settings:i}=this.props,o=this.getSelectedCommand(),a=i==null?void 0:i.language,s=a===r;if(t==null||!s){Ze.info("Run selected disabled - ".concat(t==null?"session disconnected":"language mismatch"));return}e(o)}initContextActions(){if(this.contextActionCleanups.length>0){Ze.error("Context actions already initialized.");return}if(this.editor){var e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[me.getMonacoKeyCodeFromShortcut(Ve.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[me.getMonacoKeyCodeFromShortcut(Ve.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Ze.error("Code completion already initialized.");return}var{session:e}=this.props;Ze.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=me.openDocument(this.editor,e))}deInitCodeCompletion(){var{session:e}=this.props;Ze.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&me.closeDocument(this.editor,e))}append(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;A(this.editor);var r=this.editor.getModel();A(r);var i=r.getValue();i?r.setValue("".concat(i,`
|
|
16
|
+
`).concat(e)):r.setValue("".concat(e));var o=r.getLineCount(),a=r.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:a}),t&&this.editor.focus()}updateDimensions(){Ze.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Ze.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var e,{error:t,isLoaded:r,isLoading:i,session:o,sessionLanguage:a,settings:s}=this.props,{model:l}=this.state,u=t?"Unable to open document. ".concat(t):null,c=s&&(e=s.language)!==null&&e!==void 0?e:null,h=l&&o&&c===a;return d.jsxs(d.Fragment,{children:[(t||i)&&d.jsx("div",{className:"h-100 w-100 position-relative",children:d.jsx(bn,{"data-testid":"script-editor-loading",errorMessage:u,isLoading:i,isLoaded:r})}),r&&d.jsx("div",{className:"h-100 w-100 script-editor",children:s&&d.jsxs(d.Fragment,{children:[d.jsx(Il,{ref:this.editorComponent,settings:s,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),h!=null&&h&&d.jsx(H,{model:l,language:c,session:o})]})})]})}}Vn($l,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});function Kn(n,e,t){return(e=Hf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hf(n){var e=Bf(n,"string");return typeof e=="symbol"?e:e+""}function Bf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Uf=250,Wf=2500;class Hl extends m.Component{constructor(e){super(e),Kn(this,"timer",void 0),Kn(this,"cleanup",void 0),Kn(this,"loadData",gn(()=>{var{commandHistoryStorage:t,item:r,language:i}=this.props,{id:o}=r;this.cleanup=t.listenItem(i,o,this.handleUpdate,this.handleError)},Uf)),Kn(this,"getPreviewText",On(t=>t.split(`
|
|
17
|
+
`,Wf).join(`
|
|
18
|
+
`),{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:a}=this.state,{result:s,startTime:l,endTime:u}=o??{},c=(e=s==null?void 0:s.error)!==null&&e!==void 0?e:a,h=qe.formatConvertedDuration(l,u??i),v=this.getPreviewText(t),f=!!h;return d.jsxs("div",{className:"command-history-item-tooltip",children:[d.jsxs("div",{className:"scroll-container",children:[d.jsx(El,{language:r,children:v}),v.length<t.length&&d.jsx("p",{children:"Preview Truncated..."})]}),d.jsxs("div",{className:"result-info",children:[d.jsxs("div",{className:"d-flex justify-content-between",children:[!!c&&d.jsxs("div",{className:"text-danger mr-1",children:[d.jsx(ve,{icon:js})," Executed with errors"]}),d.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",f?d.jsx("span",{className:"time-string",children:h}):d.jsx(Ms,{className:"loading-spinner-vertical-align"})]})]}),!!c&&d.jsx("div",{className:"error-message",children:c})]})]})}}Kn(Hl,"defaultProps",{onUpdate:()=>{}});var Vf=512;function Kf(n){var{item:e,language:t,isSelected:r=!1,commandHistoryStorage:i}=n,o=e.name.substring(0,Vf),a=m.useRef(null),s=m.useCallback(()=>{var l;(l=a.current)===null||l===void 0||l.update()},[a]);return d.jsxs("div",{className:q("command-history-item",{selected:r}),children:[o,d.jsx(he,{ref:a,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:d.jsx(Hl,{item:e,language:t,onUpdate:s,commandHistoryStorage:i})})]})}class Lr extends m.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(ve,{icon:Pd,mask:e.icon,transform:"right-5 down-5 shrink-4"}),d.jsx(ve,{icon:xs,transform:"shrink-3 right-7 down-6"})]}):d.jsx(ve,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return d.jsx("div",{className:"command-history-actions",children:e.map((r,i)=>d.jsx(se,{kind:"inline",className:q(r.className),onClick:r.action,tooltip:r.description,disabled:r.selectionRequired!==void 0&&r.selectionRequired&&!t,icon:Lr.renderContent(r)},Lr.itemKey(i,r)))})}}var zf=150,ga=3,ba=U.module("CommandHistoryViewportUpdater");function Gf(n){var{table:e,columns:t,top:r=0,bottom:i=0,search:o,isReversed:a=!1,onUpdate:s}=n,l=m.useMemo(()=>Hr(u=>{var c=u.bottom-u.top,h=Math.max(0,u.top-c*ga),v=u.bottom+c*ga;e.setViewport({top:h,bottom:v,columns:u.columns})},zf),[e]);return m.useEffect(function(){var c=e.onUpdate(h=>{var v,f;s({items:(v=h.items)!==null&&v!==void 0?v:[],offset:(f=h.offset)!==null&&f!==void 0?f:0})});return()=>{ba.debug("onUpdate cleanup"),c()}},[e,s]),m.useEffect(function(){e.setSearch(o??"")},[e,o]),m.useEffect(function(){l({top:r,bottom:i,columns:t})},[l,r,i,t,o,a]),m.useEffect(()=>()=>{ba.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function ya(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ca(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ya(o,r,i,a,s,"next",l)}function s(l){ya(o,r,i,a,s,"throw",l)}a(void 0)})}}function Pt(n,e,t){return(e=qf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qf(n){var e=Xf(n,"string");return typeof e=="symbol"?e:e+""}function Xf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Bt=U.module("CommandHistory");class We extends m.Component{static getCommandsFromViewport(e,t,r){for(var i=[],o=0;o<r.length;o+=1)for(var a=r[o],s=a[0];s<=a[1];s+=1)if(s>=t&&s<t+e.length){var{name:l}=e[s-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return Ca(function*(){var r=yield e.getSnapshot(t);return[...r.values()].map(i=>i.name)})()}constructor(e){super(e),Pt(this,"itemActions",void 0),Pt(this,"historyActions",void 0),Pt(this,"pending",void 0),Pt(this,"searchInputRef",void 0),Pt(this,"itemListRef",void 0),Pt(this,"debouncedSearchChange",gn(()=>{this.setState(r=>{var{searchText:i}=r;return{debouncedSearchText:i,selectedRanges:[]}})},We.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:Td,shortcut:Xt.COPY,action:this.copySelectedCommands,group:ne.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:ao,shortcut:Ve.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:We.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:As,shortcut:Ve.COMMAND_HISTORY.RUN,action:this.runInConsole,group:We.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:so,shortcut:Ve.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:We.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Rs,action:this.createNotebook,group:We.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:ao,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:so,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new nr,this.searchInputRef=$.createRef(),this.itemListRef=$.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 Ca(function*(){var{items:t,offset:r,selectedRanges:i}=e.state,o=i.slice().sort((s,l)=>s[0]-l[0]);if(o.length===0)return[];if(o[0][0]>=r&&o[o.length-1][1]<r+t.length)return We.getCommandsFromViewport(t,r,o);var{table:a}=e.props;return e.pending.add(We.getCommandsFromSnapshot(a,o))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
19
|
+
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<We.MAX_SELECTION_COUNT?(Bt.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Bt.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Vs).catch(Bt.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t},!0)}).catch(Bt.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t})}).catch(Bt.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(Bt.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(Bt.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:r,offset:i}=this.state;if(e<i||e>=i+r.length){Bt.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:a}=this.props;return d.jsx(Kf,{isSelected:i,item:t,language:o,commandHistoryStorage:a})}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:a,debouncedSearchText:s,top:l,bottom:u,items:c,itemCount:h,offset:v,selectedRanges:f}=this.state,p=(e=Pl.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return d.jsxs("div",{className:"command-history",children:[d.jsxs("div",{className:"command-history-search-bar",children:[d.jsx(Wr,{ref:this.searchInputRef,value:a,placeholder:"".concat(p," Command History"),onChange:this.handleSearchChange}),d.jsx(Lr,{actions:o,hasSelection:f.length>0})]}),d.jsxs("div",{className:"command-history-list",children:[d.jsx(yt,{ref:this.itemListRef,itemCount:h,items:c,offset:v,selectedRanges:f,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:We.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),d.jsx(Gf,{table:r,top:l,bottom:u,search:s,onUpdate:this.handleViewportUpdate}),d.jsx(ne,{actions:i})]})]})}}Pt(We,"ITEM_HEIGHT",29);Pt(We,"MAX_SELECTION_COUNT",1e4);Pt(We,"SET_SEARCH_DEBOUNCE_MS",150);Pt(We,"menuGroups",{send:ne.groups.medium+100});class Zf extends m.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 d.jsxs("div",{className:q("log-level-menu-item",e),children:[d.jsx(Gh,{on:t,onClick:this.handleSwitchClick}),e]})}}function Sa(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 wa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(t),!0).forEach(function(r){ot(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Sa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ot(n,e,t){return(e=Yf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yf(n){var e=Qf(n,"string");return typeof e=="symbol"?e:e+""}function Qf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 we extends m.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),r=Nr.formatTimestamp(t);return"".concat(r," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),ot(this,"cancelListener",void 0),ot(this,"editor",void 0),ot(this,"editorContainer",void 0),ot(this,"logLevelMenuItems",void 0),ot(this,"flushTimer",void 0),ot(this,"bufferedMessages",void 0),ot(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:d.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var s=we.AllLogLevels[o],l=e[s]!=null?e[s]:!1;r.push({title:s,group:1,order:o+100,menuElement:d.jsx(Zf,{logLevel:s,on:l,onClick:t.handleMenuItemClick,ref:u=>{u!=null&&(t.logLevelMenuItems[s]=u)}})})},o=0;o<we.AllLogLevels.length;o+=1)i();return r.push({group:1,order:1e3,menuElement:d.jsxs("div",{className:"log-level-menu-controls",children:[d.jsx(se,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),d.jsx(se,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),r}resetLogLevels(){for(var e={},t=function(){var o=we.AllLogLevels[r],a=we.DefaultLogLevels.some(s=>s===o);e[o]=a},r=0;r<we.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(){A(this.editorContainer),this.editor=De.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"}),[[Jt.Escape],[rt.Shift|Jt.Escape]].forEach(e=>{A(this.editor),me.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[Jt.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,r,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();A(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<we.AllLogLevels.length;r+=1){var i=we.AllLogLevels[r];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var o={},a=0;a<we.AllLogLevels.length;a+=1){var s=we.AllLogLevels[a];o[s]=!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=wa(wa({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),r=t==null?void 0:t.getLineCount();A(r);var i=t==null?void 0:t.getLineLength(r);A(i);var o=this.isBottomVisible(),a=[];if(i>0&&(a.push({range:{startLineNumber:r,startColumn:i+1,endLineNumber:r,endColumn:i+1},text:`
|
|
20
20
|
`,forceMoveMarkers:!0}),r+=1,i=0),a.push({range:{startLineNumber:r,startColumn:i,endLineNumber:r,endColumn:i},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(a),o){var s=t==null?void 0:t.getLineCount();A(s),this.editor.revealLine(s,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 a=we.getLogText(o);a.length>0&&(r+=a,a.charAt(a.length-1)!==`
|
|
21
21
|
`&&(r+=`
|
|
22
22
|
`))}}if(r=r.trimRight(),this.editor.setValue(r),t){var s,l=(s=this.editor.getModel())===null||s===void 0?void 0:s.getLineCount();A(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>we.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-we.truncateSize))}scrollToBottom(){var e,t;if(this.editor){var r=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(t=t.call(e))===null||t===void 0?void 0:t.getLineCount();A(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 A(t),this.isLineVisible(t)}isLineVisible(e){var t,r=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(r==null||r.length===0)return!1;for(var i=0;i<r.length;i+=1){var o=r[i];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var r=this.bufferedMessages[t],i=we.getLogText(r);e+=i,i.charAt(i.length-1)!==`
|
|
23
23
|
`&&(e+=`
|
|
24
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,we.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return d.jsxs("div",{className:"log-pane h-100 w-100",children:[d.jsxs("div",{className:"log-pane-menu",children:[d.jsx(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Ed,tooltip:"Clear log"}),d.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Pd,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(or,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ot(we,"DefaultLogLevels",[Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN]);ot(we,"AllLogLevels",[Ie.INFO,Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN,Ie.DEBUG,Ie.TRACE]);ot(we,"bufferTimeout",16);ot(we,"maxLogSize",131072);ot(we,"truncateSize",65536);const Zf="var(--dh-color-chart-colorway)",Yf="var(--dh-color-chart-grid)",Qf="var(--dh-color-chart-axis-line)",Jf="var(--dh-color-chart-axis-line-zero)",Ca={"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:Zf,gridcolor:Yf,linecolor:Qf,zerolinecolor:Jf,"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 Sa=U.module("ChartTheme");function ep(){var n,e=Is(Ca);return e.colorway=Td((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return _d.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Sa.debug2("Chart theme:",Ca),Sa.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"],map_style:e["map-style"]})}function wa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function tp(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(r){np(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function np(n,e,t){return(e=rp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rp(n){var e=ip(n,"string");return typeof e=="symbol"?e:e+""}function ip(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var op=m.lazy(()=>As(()=>import("./Plot-B8AgOqqz.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function ap(n){return d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(op,tp({},n))})}var Ui=m.createContext(null);Ui.displayName="ChartThemeContext";function YC(n){var{children:e}=n,{activeThemes:t}=Xs(),r=m.useMemo(ep,[t]);return d.jsx(Ui.Provider,{value:r,children:e})}function sp(){return ir(Ui,"No ChartThemeContext value found.")}function Ea(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function lp(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ea(o,r,i,a,s,"next",l)}function s(l){Ea(o,r,i,a,s,"throw",l)}a(void 0)})}}var up=U.module("HeapUsage");function dp(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=sp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,h]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=Ks(),p=m.useCallback(lp(function*(){try{var F=yield t.getWorkerHeapInfo();if(!f.current)return;if(u(F),o||c){for(var V=(F.totalHeapSize-F.freeMemory)/F.maximumHeapSize,K=Date.now(),{timestamps:pe,usages:je}=v.current;pe.length!==0&&K-pe[0]>a*1.5;)pe.shift(),je.shift();pe.push(K),je.push(V)}else v.current={timestamps:[],usages:[]}}catch(j){up.warn("Unable to get heap usage",j)}}),[t,f,o,c,a]);Pc(p,c?i:r);var g=(F,V)=>Math.round(F*10**V)/10**V,b=2,w=1024**3,{freeMemory:E,totalHeapSize:P,maximumHeapSize:R}=l,Z=g(E/w,b),re=g(P/w,b),Y=g(R/w,b),k=re-Z,B=function(V,K){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:q("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:V}),d.jsx("div",{children:K})]})},{timestamps:Q,usages:G}=v.current,L=(e=Q[Q.length-1])!==null&&e!==void 0?e:0,W=P/R,X=(P-E)/R;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsx("div",{className:q("used-memory",{"heap-overflow":(P-E)/R>.95}),style:{width:"calc(".concat(X*100,"% - ").concat(X*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>h(!0),onExited:()=>h(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[B("In use:","".concat(k.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),B("Free:","".concat(Z.toFixed(b)," GB")),B("Total:","".concat(re.toFixed(b)," GB")),B("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(ap,{data:[{x:[...Q],y:[...G],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(a/6),gridcolor:s.linecolor,range:[L-a,L],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}var Fl=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 $l(n){return n.componentName!==void 0}function cp(n){return n.component!==void 0}var Hl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const hp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Fl,isGLComponentConfig:$l,isReactComponentConfig:cp,itemDefaultConfig:Hl},Symbol.toStringTag,{value:"Module"}));function Ir(n,e,t){return(e=mp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mp(n){var e=vp(n,"string");return typeof e=="symbol"?e:e+""}function vp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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{constructor(){Ir(this,"_mSubscriptions",void 0),Ir(this,"off",this.unbind),Ir(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Xe.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Xe.ALL_EVENT],u=0;u<l.length;u++){var c=l[u].ctx||{};try{l[u].fn.apply(c,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Ir(Xe,"ALL_EVENT","__all");function vt(n,e,t){return(e=fp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fp(n){var e=pp(n,"string");return typeof e=="symbol"?e:e+""}function pp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Pi extends Xe{constructor(e,t,r){super(),vt(this,"width",void 0),vt(this,"height",void 0),vt(this,"title",void 0),vt(this,"parent",void 0),vt(this,"layoutManager",void 0),vt(this,"tab",void 0),vt(this,"_config",void 0),vt(this,"isHidden",!1),vt(this,"beforeCloseHandler",void 0),vt(this,"_element",D(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),vt(this,"_contentElement",void 0),this.title=$l(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",c=u==="height"?t:e,h=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=c/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[u]=v;else{var g;a.contentItems[p].config[u]=((g=a.contentItems[p].config[u])!==null&&g!==void 0?g:0)+f}return a.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const gp=Object.freeze(Object.defineProperty({__proto__:null,Container:Pi,ItemContainer:Pi},Symbol.toStringTag,{value:"Module"}));function Bl(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Ul(n){if(window.location.hash)return Bl(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 Wi(n){return window.requestAnimationFrame(n)}function bp(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 Ar(){return _t()}function yp(n,e){var t=n.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Vi(n){return D.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ye(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=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)}class ar extends Xe{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Ye(this,"_eElement",void 0),Ye(this,"_oDocument",void 0),Ye(this,"_eBody",void 0),Ye(this,"_root",void 0),Ye(this,"_destroyAfterMouseUp",void 0),Ye(this,"_nDelay",400),Ye(this,"_timeout",void 0),Ye(this,"timeout",void 0),Ye(this,"_nDistance",10),Ye(this,"_nX",0),Ye(this,"_nY",0),Ye(this,"_nOriginalX",0),Ye(this,"_nOriginalY",0),Ye(this,"_bDragging",!1),this._eElement=e,this._oDocument=D(document),this._eBody=D(document.body),this._root=t,this._destroyAfterMouseUp=i,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(r=this._eElement)===null||r===void 0||r.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),(a=this._root)===null||a===void 0||a.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._root)===null||r===void 0||r.childElementContainer.addClass("lm_dragging"),(i=this._oDocument)===null||i===void 0||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}function Pn(n,e,t){return(e=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=Ep(n,"string");return typeof e=="symbol"?e:e+""}function Ep(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Wl{constructor(e,t){Pn(this,"_container",void 0),Pn(this,"_reactComponent",null),Pn(this,"_portalComponent",null),Pn(this,"_originalComponentWillUpdate",void 0),Pn(this,"_initialState",void 0),Pn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Br.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t,void 0)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=D.extend(e,this._container._config.props);return $.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"],Pp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ki(n){if(Rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return zi(n,e,"_min"),e}function Ti(n){if(Rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return zi(n,e,"_max"),e}function zi(n,e,t){var r=t==="_min"?Tp:_p;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=r(i,Rr);e[s]=a}zi(o,a,t)}else{var l=r(o,Pp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Rr);e[u]=l}}}}function Tp(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function _p(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function li(n,e,t){return(e=Op(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Op(n){var e=xp(n,"string");return typeof e=="symbol"?e:e+""}function xp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _i{constructor(e,t){li(this,"name",void 0),li(this,"origin",void 0),li(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function gr(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)}let Vl=class extends Xe{constructor(e){super(),gr(this,"_layoutManager",void 0),gr(this,"_dontPropagateToParent",void 0),gr(this,"_childEventSource",void 0),gr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Xe.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),D(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){D(window).off("gl_child_event",this._boundOnEventFromChild)}};function Kl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function zl(n){return(e,t)=>Kl(e,n,t)}function Gl(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 ql(n){return(e,t)=>{var r=m.useRef(null),i=m.useRef(()=>!1);if(r.current!=e||i.current!=t){var o;(o=r.current)===null||o===void 0||o.off(n,i.current),e==null||e.on(n,t)}r.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=r.current)===null||a===void 0?void 0:a.off(n,i.current)},[])}}function tn(n){return{listen:zl(n),emit:Gl(n),useListener:ql(n)}}const Mp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:_i,DragListener:ar,EventEmitter:Xe,EventHub:Vl,ReactComponentHandler:Wl,animFrame:Wi,filterXss:yp,getHashValue:Bl,getQueryStringParam:Ul,getUniqueId:Ar,listenForEvent:Kl,makeEmitFunction:Gl,makeEventFunctions:tn,makeListenFunction:zl,makeUseListenerFunction:ql,minifyConfig:Ki,removeFromArray:bp,stripTags:Vi,unminifyConfig:Ti},Symbol.toStringTag,{value:"Module"}));function Bt(n,e,t){return(e=Np(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Np(n){var e=kp(n,"string");return typeof e=="symbol"?e:e+""}function kp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xl extends Xe{constructor(e,t,r,i,o){super(),Bt(this,"isInitialised",!1),Bt(this,"_config",void 0),Bt(this,"_dimensions",void 0),Bt(this,"_parentId",void 0),Bt(this,"_indexInParent",void 0),Bt(this,"_layoutManager",void 0),Bt(this,"_popoutWindow",null),Bt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,u,c,h;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=D.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;D(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Ar();e=Ki(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function Oe(n,e,t){return(e=jp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jp(n){var e=Lp(n,"string");return typeof e=="symbol"?e:e+""}function Lp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wn extends Xe{constructor(e,t,r,i,o,a){var s,l,u,c,h,v,f,p;if(super(),Oe(this,"_dragListener",void 0),Oe(this,"_layoutManager",void 0),Oe(this,"_contentItem",void 0),Oe(this,"_originalParent",void 0),Oe(this,"_area",null),Oe(this,"_lastValidArea",null),Oe(this,"_minX",void 0),Oe(this,"_maxX",void 0),Oe(this,"_minY",void 0),Oe(this,"_maxY",void 0),Oe(this,"_width",void 0),Oe(this,"_height",void 0),Oe(this,"_sided",void 0),Oe(this,"element",void 0),Oe(this,"childElementContainer",void 0),Oe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=D(wn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Vi((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").text((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),D(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,E;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((E=this._proxyTab.outerHeight(!0))!==null&&E!==void 0?E:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(c=P==null?void 0:P.top)!==null&&c!==void 0?c:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(p=this.element.height())!==null&&p!==void 0?p:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Oe(wn,"_template",'<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>');function br(n,e,t){return(e=Ap(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ap(n){var e=Rp(n,"string");return typeof e=="symbol"?e:e+""}function Rp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Zl{constructor(e,t,r){br(this,"_element",void 0),br(this,"_itemConfig",void 0),br(this,"_layoutManager",void 0),br(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new ar(this._element,this._layoutManager.root,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}function yr(n,e,t){return(e=Fp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=$p(n,"string");return typeof e=="symbol"?e:e+""}function $p(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yl{constructor(e,t,r){yr(this,"_element",D(window)),yr(this,"_itemConfig",void 0),yr(this,"_layoutManager",void 0),yr(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 ar(this._element,this._layoutManager.root,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Ql(n,e,t){return(e=Hp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hp(n){var e=Bp(n,"string");return typeof e=="symbol"?e:e+""}function Bp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sr{constructor(){Ql(this,"element",D(sr._template)),D(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}Ql(sr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ui(n,e,t){return(e=Up(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Up(n){var e=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 zn{constructor(e,t,r,i){ui(this,"element",void 0),ui(this,"_header",void 0),ui(this,"_action",void 0),this._header=e,this.element=D('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function Vp(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=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)}class mn extends Error{constructor(e,t){super(),Vp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Gp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:mn},Symbol.toStringTag,{value:"Module"}));function Te(n,e,t){return(e=qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qp(n){var e=Xp(n,"string");return typeof e=="symbol"?e:e+""}function Xp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vn(n){return n.isStack}function Re(n){return n.isComponent}function Jl(n){return n.isRoot}class Me extends Xe{constructor(e,t,r,i){super(),Te(this,"config",void 0),Te(this,"type",void 0),Te(this,"contentItems",void 0),Te(this,"parent",void 0),Te(this,"layoutManager",void 0),Te(this,"element",void 0),Te(this,"childElementContainer",void 0),Te(this,"componentName",void 0),Te(this,"isInitialised",!1),Te(this,"isMaximised",!1),Te(this,"isRoot",!1),Te(this,"isRow",!1),Te(this,"isColumn",!1),Te(this,"isStack",!1),Te(this,"isComponent",!1),Te(this,"tab",void 0),Te(this,"_pendingEventPropagations",void 0),Te(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Xe.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(r!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,vn(this)&&this.header.tabs[i].setContentItem(t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),r(o.contentItems[a])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&Re(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new _i(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new mn("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(Hl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof _i&&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,Wi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Bn(n,e,t){return(e=Zp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zp(n){var e=Yp(n,"string");return typeof e=="symbol"?e:e+""}function Yp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eu extends Me{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,u]=s;t[l]===void 0&&(t[l]=u)}),super(e,t,r,D()),Bn(this,"config",void 0),Bn(this,"componentName",void 0),Bn(this,"container",void 0),Bn(this,"parent",void 0),Bn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=D.extend(!0,{},this.config.componentState||{});if(o==null)throw new mn('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Pi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Me.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Me.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),Me.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Me.prototype._$destroy.call(this)}_$getArea(){return null}}function ut(n,e,t){return(e=Qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qp(n){var e=Jp(n,"string");return typeof e=="symbol"?e:e+""}function Jp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class er extends Me{constructor(e,t,r,i){super(t,r,i,D('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ut(this,"isRow",void 0),ut(this,"isColumn",void 0),ut(this,"childElementContainer",void 0),ut(this,"parent",void 0),ut(this,"_splitter",[]),ut(this,"_splitterSize",void 0),ut(this,"_splitterGrabSize",void 0),ut(this,"_isColumn",void 0),ut(this,"_dimension",void 0),ut(this,"_splitterPosition",null),ut(this,"_splitterMinPosition",null),ut(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),Me.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}if(Me.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(Me.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,c,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));a+=h,s.push(h)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var h=u.itemSizes[c];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},r.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<r.length;f++){l=r[f];var p=Math.round((l.width-t)*v);a-=p,l.width-=p}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new tu(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,c=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),h=this._isColumn?c.vertical:c.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(h||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=c*h,s.after.config[this._dimension]=(1-c)*h,e.element.css({top:0,left:0}),Wi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Pa(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 Ta(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pa(Object(t),!0).forEach(function(r){Oi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Oi(n,e,t){return(e=eg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eg(n){var e=tg(n,"string");return typeof e=="symbol"?e:e+""}function tg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class xi extends Me{constructor(e,t,r){super(e,Ta(Ta({},t),{},{type:"root"}),null,D('<div class="lm_goldenlayout lm_item lm_root"></div>')),Oi(this,"childElementContainer",void 0),Oi(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(Re(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof er)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var c,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((c=h.config[a])!==null&&c!==void 0?c:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}function _a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(r){tt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function tt(n,e,t){return(e=ng(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ng(n){var e=rg(n,"string");return typeof e=="symbol"?e:e+""}function rg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ii extends Me{constructor(e,t,r){var i,o,a,s,l,u,c,h,v;super(e,t,r,D('<div class="lm_item lm_stack"></div>')),tt(this,"_activeContentItem",null),tt(this,"_header",void 0),tt(this,"childElementContainer",D('<div class="lm_items"></div>')),tt(this,"header",void 0),tt(this,"parent",void 0),tt(this,"isStack",!0),tt(this,"_dropSegment",null),tt(this,"_contentAreaDimensions",null),tt(this,"_dropIndex",void 0),tt(this,"_side",void 0),tt(this,"_sided",!1),tt(this,"config",void 0),this.parent=r,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(h=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=Tn(Tn({},this._header),f.header)),t.header&&(this._header=Tn(Tn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Tn(Tn({},this._header),t.content[0].header)),this.header=new At(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),Re(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(){Me.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 er&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Re(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var h,v=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,a,s,l,u,c,h,v,f,p,g,b,w,E=this.header.tabs.length;if(E===0){var P,R,Z,re,Y,k,B,Q,G=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(R=G==null?void 0:G.left)!==null&&R!==void 0?R:0,x2:((Z=G==null?void 0:G.left)!==null&&Z!==void 0?Z:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((k=(B=this.header.element.offset())===null||B===void 0?void 0:B.top)!==null&&k!==void 0?k:0)+((Q=this.header.element.innerHeight())!==null&&Q!==void 0?Q:0)});return}var L=this.header.tabsContainer,W=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),X=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!W||!X)){e<W.left?e=W.left+1:e>W.right&&(e=W.right-1);var F,V;if(!(X.left<e&&e<X.right)){for(var K=0;K<E;K++){var pe;if(F=this.header.tabs[K].element,V=(pe=F.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=K;break}}if(F&&V&&e<V.left+V.width*.5)F.before(this.layoutManager.tabDropPlaceholder);else if(F){var je;this._dropIndex=Math.min(((je=this._dropIndex)!==null&&je!==void 0?je:0)+1,E),F.after(this.layoutManager.tabDropPlaceholder)}}var j=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;j=Math.max(j,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var C=j+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);C=Math.min(C,((u=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:j,x2:C,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}this._dropSegment=e}}const ig=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Me,Component:eu,ContentItem:Me,Root:xi,RowOrColumn:er,Stack:Ii,isComponent:Re,isRoot:Jl,isStack:vn},Symbol.toStringTag,{value:"Module"}));function kt(n,e,t){return(e=og(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function og(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 lr{constructor(e,t){var r;kt(this,"header",void 0),kt(this,"contentItem",void 0),kt(this,"element",D(lr._template)),kt(this,"titleElement",void 0),kt(this,"closeElement",void 0),kt(this,"isActive",!1),kt(this,"_layoutManager",void 0),kt(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new ar(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),Re(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),Re(this.contentItem)&&this.contentItem.container._contentElement.off(),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new wn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){Re(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(D(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){Re(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&&Re(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Re(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),Re(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(),Re(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}_isInNestedLayout(e){var t=D(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!Re(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}kt(lr,"_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 le(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=lg(n,"string");return typeof e=="symbol"?e:e+""}function lg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 At extends Xe{constructor(e,t){var r,i;super(),le(this,"layoutManager",void 0),le(this,"element",D(At._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",D(At._nextButtonTemplate)),le(this,"tabPreviousButton",D(At._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(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 lr(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,c;l.scrollLeft=(u=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(c=>{var h,v,f=o||c,p=c-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(h=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),D(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new zn(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 zn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new zn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new zn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),D(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),D(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var c=(s+l+u.length)%u.length;c!==s;){if(u.eq(c).css("display")!=="none")return c;c=(c+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),D(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=D(window).height())!==null&&r!==void 0?r:0,l=(i=D(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<s-u.bottom,h=!c&&u.bottom>s*.6,v=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}le(At,"_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(""));le(At,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(At,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Un(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=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 tu{constructor(e,t,r){Un(this,"_isVertical",void 0),Un(this,"_size",void 0),Un(this,"_grabSize",void 0),Un(this,"_dragListener",void 0),Un(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new ar(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=D('<div class="lm_drag_handle"></div>'),t=D('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const cg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Xl,DragProxy:wn,DragSource:Zl,DragSourceFromEvent:Yl,DropTargetIndicator:sr,Header:At,HeaderButton:zn,Splitter:tu,Tab:lr},Symbol.toStringTag,{value:"Module"}));var hg={config:hp,container:gp,controls:cg,errors:Gp,items:ig,utils:Mp};function Oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Qe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(r){ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ue(n,e,t){return(e=mg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mg(n){var e=vg(n,"string");return typeof e=="symbol"?e:e+""}function vg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var xa=["column","row","stack","component"];class zr extends Xe{static isLayoutItemConfig(e){return xa.includes(e.type)}static minifyConfig(e){return Ki(e)}static unminifyConfig(e){return Ti(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":Wl}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",D('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"_initialHeaderHeight",void 0),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Vl(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",D('<div class="lm_drop_tab_placeholder"></div>')),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&D("body").css("visibility","hidden")}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof Me))throw new Error("Root must be a ContentItem");var t={settings:Qe({},this.config.settings),dimensions:Qe({},this.config.dimensions),labels:Qe({},this.config.labels),content:[]},r=function(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var u=0;u<s.contentItems.length;u++)a.content[u]={},r(a.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){D(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new sr,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),D(window).off("resize",this._onResize),D(window).off("unload beforeunload",this._onUnload),D(window).off("blur.lm").off("focus.lm"),D(window).off("keydown",this._windowKeydown),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i;if(typeof e.type!="string")throw new mn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!zr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+xa.join(","),new mn(i);return e.type==="component"&&!(t instanceof Ii)&&t&&!(this.isSubWindow===!0&&t instanceof xi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Ar(),e.type==="stack"?new Ii(this,e,t):e.type==="row"?new er(!1,this,e,t):e.type==="column"?new er(!0,this,e,t):new eu(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof Me,s=this;if(a){var l;o=this.toConfig(e).content,r=Ar();for(var u=e.parent,c=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;c=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(c)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,E=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+E.left,top:w+E.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var P=new Xl(o,t,r,i,this);return P.on("initialised",function(){s.emit("windowOpened",P)}),P.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Zl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Yl(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Qe({},this.root._$getArea()),r=[Qe(Qe({},t),{},{side:"left",x2:t.x1+e}),Qe(Qe({},t),{},{side:"right",x1:t.x2-e}),Qe(Qe({},t),{},{side:"top",y2:t.y1+e}),Qe(Qe({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var r=e[t];if(vn(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Qe(Qe({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof Me)return e;if(D.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&D(window).resize(this._onResize),D(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Ul("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Ti(e),localStorage.removeItem(r));var i=D.extend(!0,{},Fl,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=D('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Vi((e=this.config.content[0].title)!==null&&e!==void 0?e:""),D("head").append(D("body link, body style, template, .gl_keep")),this.container=D("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?D(this._originalContainer):D("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,D("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new mn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new mn(t,e);this.root=new xi(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var u=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{vn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ue(zr,"__lm",hg);const Ia={"tab-height":"28px","drag-border-width":"5px"},Da=Object.freeze({tabHeight:parseInt(Ia["tab-height"],10),dragBorderWidth:parseInt(Ia["drag-border-width"],10)});function Ma(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 Nt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ma(Object(t),!0).forEach(function(r){nu(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nu(n,e,t){return(e=fg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fg(n){var e=pg(n,"string");return typeof e=="symbol"?e:e+""}function pg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ut=U.module("LayoutUtils");function ru(n){return n.componentName!==void 0}function Gt(n){var e=n;return(ru(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Cr(n){return n.focus!==void 0}function Na(n){return n.type==="stack"}class x{static activateTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r){Ut.error("Could not find stack for config",t);return}var i=x.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return Ut.error("Could not find stack for config",t),!1;var i=x.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(Jl(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,c,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(c=s.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(s,h),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(r=>r.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=x.getAllStackContainers(e),r=x.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&vn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(vn(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var r;if(((r=e.config)===null||r===void 0?void 0:r.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&vn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&to(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&r&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,u=x.getStackForRoot(e,{component:s},r&&l,i,o);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&to(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i],{content:a}=o;if(Gt(o)){var s=t(o.component,o);s!=null?r.push(s):Ut.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=Nt(Nt({},o),{},{content:x.dehydrateLayoutConfig(a,t)});r.push(l)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(Na(r)&&delete r.activeItemIndex,x.dropLayoutMinorChange(i)):Gt(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=x.cloneLayout(e),o=x.cloneLayout(t);return r?(x.dropLayoutMinorChange(i),x.dropLayoutMinorChange(o),Yn(i,o)):Yn(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(Gt(o)){var a,{component:s,props:l={}}=o;r.push(Nt(Nt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:_t(),props:t(s,l)}))}else if(o.content!==void 0){var u=x.hydrateLayoutConfig(o.content,t);Na(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Ut.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(Nt(Nt({},o),{},{content:u}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,c=Nt({},t);if(c.id==null&&(c.id=_t()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var h=o||{id:c.id,component:c.component};A(e);var v=r??(a?x.addStack(e):x.getStackForRoot(e,h));A(v);var f=x.getContentItemInStack(v,h);if(s!=null){var p=b=>{Ut.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:w}=b.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(c,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(c);s==null&&u&&Cr(u)&&u.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=x.getContentItemInStack(e,o);if(r&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&Cr(i)&&i.focus()}static closeComponent(e,t,r){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){Ut.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(Re(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&Cr(a)&&a.focus()}static renameComponent(e,t,r){var i=x.getStackForRoot(e,t,!1);if(!i){Ut.error("Could not find stack for config",t);return}var o=x.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return Ut.error("Could not find stack for config",t),null;var{props:i={}}=t,o=x.getPanelComponentState(t),a={type:"react-component",component:t.component,props:Nt(Nt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:_t()};return x.openComponentInStack(r,a),a}static getPanelComponentState(e){if(ru(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Gt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Da.tabHeight,borderWidth:Da.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=x.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return x.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=x.getComponentConfigFromContainer(t);if(r&&Gt(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]:x.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Cr(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)})}}nu(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var gg=$.forwardRef((n,e)=>{var t=x.getComponentNameFromPanel({props:n});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});gg.displayName="PanelPlaceholder";var ae=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"}),{listen:JC,emit:bg,useListener:e0}=tn(ae.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:yg,emit:t0,useListener:n0}=tn(Gr.CYCLE_TO_NEXT_STACK),{listen:Cg,emit:r0,useListener:i0}=tn(Gr.CYCLE_TO_PREVIOUS_STACK),{listen:Sg,emit:o0,useListener:a0}=tn(Gr.CYCLE_TO_NEXT_TAB),{listen:wg,emit:s0,useListener:l0}=tn(Gr.CYCLE_TO_PREVIOUS_TAB);function Eg(n){return typeof n.id=="string"&&n.layout instanceof zr&&n.panelManager instanceof Gi&&typeof n.registerComponent=="function"}function Pg(n){if(!Eg(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function ka(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 ja(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ka(Object(t),!0).forEach(function(r){Lt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ka(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Lt(n,e,t){return(e=Tg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tg(n){var e=_g(n,"string");return typeof e=="symbol"?e:e+""}function _g(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 dt=U.module("PanelManager"),dn=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}(dn||{});class Gi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Lt(this,"layout",void 0),Lt(this,"hydrateComponent",void 0),Lt(this,"dehydrateComponent",void 0),Lt(this,"onPanelsUpdated",void 0),Lt(this,"closed",void 0),Lt(this,"openedMap",void 0),Lt(this,"navigationEventListenerRemovers",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ae.FOCUS,this.handleFocus),e.on(ae.MOUNT,this.handleMount),e.on(ae.UNMOUNT,this.handleUnmount),e.on(ae.REOPEN,this.handleReopen),e.on(ae.REOPEN_LAST,this.handleReopenLast),e.on(ae.DELETE,this.handleDeleted),e.on(ae.CLOSED,this.handleClosed),e.on(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(yg(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Cg(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(Sg(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(wg(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(ae.FOCUS,this.handleFocus),e.off(ae.MOUNT,this.handleMount),e.off(ae.UNMOUNT,this.handleUnmount),e.off(ae.REOPEN,this.handleReopen),e.off(ae.REOPEN_LAST,this.handleReopenLast),e.off(ae.DELETE,this.handleDeleted),e.off(ae.CLOSED,this.handleClosed),e.off(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return x.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Gt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=x.getStackForConfig(this.layout.root,{id:e});return(t=r&&x.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>Mr(r)&&t instanceof r.WrappedComponent||!Mr(r)&&t instanceof r))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){dt.error("updatePanel Panel did not have an ID",e);return}dt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=x.getIdFromPanel(e);if(t==null){dt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){dt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){dt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}dt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){dt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){dt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){dt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=x.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=x.getFocusedStackIndex(t);if(r===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===dn.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,c=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack(dn.Next)}handleCycleToPreviousStack(){this.cycleStack(dn.Previous)}cycleTab(e){var t,r=x.getFocusedStack(this.layout);if(r!==void 0){var{contentItems:i}=r;if(!(i.length<=1)){var o=(t=r.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===dn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];r.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(dn.Next)}handleCycleToPreviousTab(){this.cycleTab(dn.Previous)}handleReopen(e,t){dt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=ja(ja({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:x.getStackById(a,e.parentStackId);x.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=x.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){dt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){dt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;x.closeComponent(r,t)}addClosedPanel(e){var t=x.getComponentConfigFromContainer(e);if(t&&Gt(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)})}}Lt(Gi,"MAX_CLOSED_PANEL_COUNT",100);var Og=U.module("PanelErrorBoundary");class xg extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=x.getIdFromContainer(e);Og.debug("componentWillUnmount",r),t.emit(ae.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(bn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function La(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?La(Object(t),!0).forEach(function(r){Ig(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):La(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ig(n,e,t){return(e=Dg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dg(n){var e=Mg(n,"string");return typeof e=="symbol"?e:e+""}function Mg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function iu(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),Fr(Fr({},n),{},{componentState:null,props:o,type:"react-component"})}function ou(n,e){return Fr(Fr({},n),{},{localDashboardId:e})}const Ng={dehydrate:iu,hydrate:ou};var au=$.createContext(void 0);au.displayName="LayoutManagerContext";var kg=ye.shape({on:ye.func,off:ye.func,isHidden:ye.bool,tab:ye.shape({header:ye.shape({tabs:ye.arrayOf(ye.shape({contentItem:ye.shape({})}))})}),title:ye.string,setTitle:ye.func,close:ye.func}),su=ye.shape({on:ye.func,off:ye.func,emit:ye.func}),jg=ye.shape({registerComponent:ye.func,root:ye.shape({addChild:ye.func}),on:ye.func,off:ye.func,eventHub:su}),u0=Object.freeze({Container:kg,EventHub:su,Layout:jg});function Wn(n,e,t,r){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");$.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}function Ae(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var lu="SET_DASHBOARD_DATA";const Lg=Pm(lu,{},!1),Ag={dashboardData:Lg};var Rg=new Map,uu=Object.freeze({}),Fg=Object.freeze([]),d0=ji,$g=gs,c0=Uu,Hg=n=>n.dashboardData,He=(n,e)=>{var t;return(t=Hg(n)[e])!==null&&t!==void 0?t:uu},h0=(n,e)=>{var t;return(t=He(n,e).closed)!==null&&t!==void 0?t:Fg},m0=(n,e)=>{var t;return(t=He(n,e).openedMap)!==null&&t!==void 0?t:Rg},du=(n,e)=>{var t;return(t=He(n,e).pluginDataMap)!==null&&t!==void 0?t:uu},v0=(n,e,t)=>du(n,e)[t];function Aa(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 Dn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Aa(Object(t),!0).forEach(function(r){Bg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bg(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=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 cu=(n,e)=>({type:lu,id:n,payload:e}),nn=(n,e)=>(t,r)=>t(cu(n,Dn(Dn({},He(r(),n)),e))),f0=(n,e,t)=>(r,i)=>r(cu(n,Dn(Dn({},He(i(),n)),{},{pluginDataMap:Dn(Dn({},du(i(),n)),{},{[e]:t})})));Object.entries(Ag).map(n=>{var[e,t]=n;return Od.register(e,t)});var hu=m.createContext(null);hu.displayName="PersistentStateContext";function Sr(n,e){return"".concat(n,"::").concat(e)}function Vg(n){var{initialState:e,onChange:t,children:r}=n,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),[a]=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=m.useRef(new Map),l=m.useCallback((p,g,b)=>{var{type:w}=b,E=Sr(g,w),P=s.current.get(E);if(P!=null&&P!==p)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));s.current.set(E,p),i.current&&a.get(E)!==b&&(a.set(E,b),t([...a.entries()]))},[i,t,a]),u=m.useRef(e[Symbol.iterator]()),c=m.useCallback((p,g)=>{var b=Sr(p,g),w=a.get(b);if(w==null&&o.current){var{value:E}=u.current.next(),P=E;return a.set(b,P),P}return w},[a]),h=m.useCallback((p,g,b)=>{var w=Sr(g,b),E=s.current.get(w);E===p&&(a.delete(w),s.current.delete(w),i.current&&t([...a.entries()]))},[i,t,a]),v=m.useCallback((p,g,b)=>{var w=Sr(g,b),E=s.current.get(w);E===p&&s.current.delete(w)},[]),f=m.useMemo(()=>({addState:l,removeState:h,deregisterHook:v,getState:c}),[l,c,h,v]);return d.jsx(hu.Provider,{value:f,children:r})}var Kg=U.module("DashboardPanelWrapper");function zg(n){var{glContainer:e,children:t}=n,r=m.useCallback(a=>{e.setPersistedState(a)},[e]),{persistedState:i}=e.getConfig(),[o]=m.useState(()=>i!=null&&!Array.isArray(i)?(Kg.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return d.jsx(Vg,{initialState:o,onChange:r,children:t})}var qi=m.createContext(null);qi.displayName="PanelIdContext";function Gg(){return m.useContext(qi)}function Ra(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function an(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ra(Object(t),!0).forEach(function(r){qg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ra(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function qg(n,e,t){return(e=Xg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xg(n){var e=Zg(n,"string");return typeof e=="symbol"?e:e+""}function Zg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _n=U.module("DashboardLayout"),Yg=Object.freeze({}),Qg=[],Fa=()=>{},Jg=1e3,$a=n=>n;function p0(n){var e,t,{id:r,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=Qg,onLayoutChange:l=Fa,onLayoutInitialized:u=Fa,hydrate:c=ou,dehydrate:h=iu,panelWrapper:v}=n,f=ji(),p=(e=gs(j=>He(j,r)))!==null&&e!==void 0?e:Yg,[g,b]=m.useState(!1),[w,E]=m.useState(!1),P=m.useRef(),[R]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[Z,re]=m.useState(a.getReactChildren()),Y=m.useMemo(()=>new Map,[]),k=m.useMemo(()=>new Map,[]),B=m.useCallback(function(j,C){var S,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h;_n.debug2("registerComponent",j,C,N,z);function ie(O,J){var oe=C,fe=v,Be=nl(oe),St=Be?d.jsx(oe,an(an({},O),{},{ref:J})):d.jsx(oe,an({},O)),{glContainer:wt,glEventHub:ei}=O,Hn=x.getIdFromContainer(wt);return d.jsx(xg,{glContainer:wt,glEventHub:ei,children:d.jsx(qi.Provider,{value:Hn,children:d.jsx(zg,an(an({},O),{},{children:fe==null?St:d.jsx(fe,an(an({},O),{},{children:St}))}))})})}ie.displayName="DashboardWrapper(".concat((S=C.displayName)!==null&&S!==void 0?S:j,")");var ht=a.registerComponent(j,$.forwardRef(ie));return Y.set(j,N),k.set(j,z),ht},[c,h,Y,k,a,v]),Q=m.useCallback((j,C)=>{var S;return((S=Y.get(j))!==null&&S!==void 0?S:$a)(C,r)},[Y,r]),G=m.useCallback((j,C)=>{var S;return((S=k.get(j))!==null&&S!==void 0?S:$a)(C,r)},[k,r]),L=m.useMemo(()=>new Gi(a,Q,G,new Map,R,j=>{var{closed:C,openedMap:S}=j;f(nn(r,{closed:C,openedMap:S}))}),[G,f,Q,r,R,a]),W=Oc(j=>{var C=P.current,S=C==null||!x.isEqual(C,j);_n.debug("handleLayoutStateChanged",S,j),S&&(_n.debug("Layout config has changed","lastConfig",C,"dehydratedLayoutConfig",j),b(a.root.contentItems.length===0),P.current=j,l(j),re(a.getReactChildren()))},Jg,{flushOnUnmount:!0});m.useEffect(()=>()=>W.flush(),[W]);var X=m.useCallback(()=>{if(!w){var j=a.toConfig(),C=j.content,S=x.dehydrateLayoutConfig(C,G);W(S)}},[G,w,a,W]),F=m.useCallback(j=>{var C=x.getIdFromContainer(j);a.eventHub.emit(ae.DRAGGING,C),E(!0)},[a.eventHub]),V=m.useCallback(j=>{var C=x.getIdFromContainer(j);a.eventHub.emit(ae.DROPPED,C),E(!1)},[a.eventHub]),K=m.useCallback(j=>{if(_n.debug2("handleComponentCreated",j),!(j==null||j.config==null||!Gt(j.config)||j.config.component==null||j.element==null)){var C=j.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),S="".concat(C,"-component");j.element.addClass(S)}},[]),pe=m.useCallback(()=>{re(a.getReactChildren())},[a]);Ae(a,"stateChanged",X),Ae(a,"itemPickedUp",F),Ae(a,"itemDropped",V),Ae(a,"componentCreated",K),Ae(a.eventHub,ae.TITLE_CHANGED,X),Ae(a,"reactChildrenChanged",pe);var je=_c(s);return m.useEffect(function(){if(je!==s&&s!==P.current){_n.debug("loadNewConfig effect triggered. previousLayoutConfig",je,"layoutConfig",s,"lastConfig",P.current),_n.debug("Setting new layout content...");for(var C=x.hydrateLayoutConfig(s,Q);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var S=0;S<C.length;S+=1)a.root.addChild(C[S]);b(a.root.contentItems.length===0)}},[Q,a,s,L,je]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,Z,$.Children.map(i,j=>j!=null?d.jsx(Wh,{fallback:[],children:$.cloneElement(j,{id:r,layout:a,panelManager:L,registerComponent:B})}):null)]})}var mu=m.createContext(null);mu.displayName="DashboardIdContext";function g0(){var n=m.useContext(mu);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function eb(n,e,t){return(e=tb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tb(n){var e=nb(n,"string");return typeof e=="symbol"?e:e+""}function nb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vu(n,e,t){if(n){if(t(n)===!0)return n;for(var r=n.child;r;){var i=vu(r,e,t);if(i)return i;r=r.sibling}}}function rb(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var Xi=rb(m.createContext(null));Xi.displayName="FiberContext";class b0 extends m.Component{constructor(){super(...arguments),eb(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Xi.Provider,{value:this._reactInternals,children:e})}}function ib(){var n=m.useContext(Xi);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>_t()),t=m.useMemo(()=>{for(var r of[n,n==null?void 0:n.alternate].filter(o=>o!=null)){var i=vu(r,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[n,e]);return t}var y0="default",ob="CREATE_DASHBOARD",ab="CLOSE_DASHBOARD",{listen:C0,emit:S0,useListener:w0}=tn(ob),{listen:E0,emit:sb,useListener:P0}=tn(ab);function lb(n,e,t){return(e=ub(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ub(n){var e=db(n,"string");return typeof e=="symbol"?e:e+""}function db(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 fu extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,{glContainer:r}=this.props;return[...(e=r==null||(t=r.tab)===null||t===void 0||(t=t.header)===null||t===void 0?void 0:t.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t==null?void 0:t.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s;if(((i=t[r].contentItem)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.id)===((o=e.tab)===null||o===void 0||(o=o.contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id))break;(a=((s=t[r])===null||s===void 0?void 0:s.contentItem).container)===null||a===void 0||a.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(ae.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s;if(((o=t[i].contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(a=a.contentItem)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.id))break;var l=!!(!((s=t[i])===null||s===void 0||(s=s.contentItem)===null||s===void 0||(s=s.config)===null||s===void 0)&&s.isClosable);if(l){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o=!!(!((i=e[r])===null||i===void 0||(i=i.contentItem)===null||i===void 0||(i=i.config)===null||i===void 0)&&i.isClosable);if(o){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=x.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:r}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:ne.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var o=(e=r.tab)===null||e===void 0||(e=e.contentItem)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.isClosable;return i.push({title:"Close",order:10,group:ne.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:ne.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:ne.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(ne,{actions:i})}}lb(fu,"defaultProps",{additionalActions:[]});var cb=n=>({workspace:pl(n)}),hb=Fn(cb,{setWorkspace:bl})(fu);function pu(n,e,t){return(e=mb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mb(n){var e=vb(n,"string");return typeof e=="symbol"?e:e+""}function vb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 gu extends m.PureComponent{constructor(e){super(e),pu(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=$.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t==null?void 0:t.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return d.jsxs("form",{className:q("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[d.jsxs("div",{className:"form-group",children:[d.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),d.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),d.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Ur,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}pu(gu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var wr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Ha(n,e,t){return(e=fb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fb(n){var e=pb(n,"string");return typeof e=="symbol"?e:e+""}function pb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 gb=U.module("Panel");class bb extends m.PureComponent{constructor(e){super(e),Ha(this,"ref",void 0),Ha(this,"getAdditionalActions",Yt((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=$.createRef();var{glContainer:t}=this.props;this.state={title:x.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(wr.focus,this.handleTabFocus),i.on(wr.blur,this.handleTabBlur),i.emit(ae.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(wr.focus,this.handleTabFocus),r.off(wr.blur,this.handleTabBlur),r.emit(ae.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:x.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(ae.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=x.getRootFromContainer(t),i=x.getComponentConfigFromContainer(t);A(i),x.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=x.getRootFromContainer(e),i=x.getComponentConfigFromContainer(e);if(i==null){gb.error("Could not get component config from container",e);return}var o=x.cloneComponent(r,i);o!==null&&t.emit(ae.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ne.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ne.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a=Rs,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:c=!1,isRenamable:h=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:q("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(bn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Br.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(hb,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,c,h)}),h&&d.jsx(gu,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),v.element[0])]})}}var yb=ul(bb),Cb=U.module("useDhId"),di="__dhId";function T0(){var n,e,t=(n=(e=ib())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[di],i=Gg();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(di," to be a string, but got ").concat(typeof r));return r}return i??(Cb.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(di," prop. Defaulting to null.")),null)}function ur(n,e,t){return(e=Sb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sb(n){var e=wb(n,"string");return typeof e=="symbol"?e:e+""}function wb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ke{}ur(ke,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");ur(ke,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");ur(ke,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");ur(ke,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");ur(ke,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function rn(n,e,t){return(e=Eb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Eb(n){var e=Pb(n,"string");return typeof e=="symbol"?e:e+""}function Pb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 xt{}rn(xt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");rn(xt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");rn(xt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");rn(xt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");rn(xt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");rn(xt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");rn(xt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");rn(xt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const _0=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Ft(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=_b(n,"string");return typeof e=="symbol"?e:e+""}function _b(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class te{}Ft(te,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Ft(te,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Ft(te,"CLOSE_FILE","NotebookEvent.closeFile");Ft(te,"RENAME","NotebookEvent.rename");Ft(te,"RENAME_FILE","NotebookEvent.renameFile");Ft(te,"REGISTER_FILE","NotebookEvent.registerFile");Ft(te,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Ft(te,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Ft(te,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Ob=["children"];function Ba(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ua(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ba(Object(t),!0).forEach(function(r){xb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xb(n,e,t){return(e=Ib(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ib(n){var e=Db(n,"string");return typeof e=="symbol"?e:e+""}function Db(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Mb(n,e){if(n==null)return{};var t,r,i=Nb(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 Nb(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}class kb extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(ke.SESSION_CLOSED,this.handleSessionClosed),e.on(ke.SESSION_OPENED,this.handleSessionOpened),e.on(xt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(ke.SESSION_CLOSED,this.handleSessionClosed),e.off(ke.SESSION_OPENED,this.handleSessionOpened),e.off(xt.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,t){var{onSessionOpen:r}=this.props;r==null||r(e,t)}render(){var e=this.props,{children:t}=e,r=Mb(e,Ob);return d.jsx(yb,Ua(Ua({},r),{},{children:t}))}}var dr=ul(kb);const O0=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var jb=Object.freeze({}),Lb=new Map,qr=Object.freeze([]),x0=(n,e)=>{var t;return(t=He(n,e).columns)!==null&&t!==void 0?t:qr},I0=(n,e)=>{var t;return(t=He(n,e).filterSets)!==null&&t!==void 0?t:qr},D0=(n,e)=>{var t;return(t=He(n,e).filters)!==null&&t!==void 0?t:qr},M0=(n,e)=>{var t;return(t=He(n,e).tableMap)!==null&&t!==void 0?t:Lb},N0=(n,e)=>He(n,e).isolatedLinkerPanelId,bu=(n,e)=>{var t;return(t=He(n,e).links)!==null&&t!==void 0?t:qr},k0=(n,e)=>He(n,e).columnSelectionValidator,j0=(n,e)=>{var t;return(t=He(n,e).consoleSettings)!==null&&t!==void 0?t:jb},L0=(n,e)=>He(n,e).connection,cr=(n,e)=>He(n,e).sessionWrapper,A0=(n,e)=>t=>t(nn(n,{connection:e})),R0=(n,e)=>t=>t(nn(n,{sessionWrapper:e})),yu=(n,e)=>t=>t(nn(n,{links:e})),F0=(n,e)=>(t,r)=>{var i=bu(r(),n),o=e.filter(a=>i.findIndex(s=>Yn(s.start,a.start)&&Yn(s.end,a.end))<0);return t(yu(n,i.concat(o)))},$0=(n,e)=>(t,r)=>{var i=bu(r(),n),o=i.filter(a=>!e.includes(a.id));return t(yu(n,o))},H0=(n,e)=>t=>t(nn(n,{isolatedLinkerPanelId:e})),B0=(n,e)=>t=>t(nn(n,{columnSelectionValidator:e})),Ab=(n,e)=>t=>t(nn(n,{consoleSettings:e})),U0=(n,e)=>t=>t(nn(n,{filterSets:e}));function $r(n,e,t){return(e=Rb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rb(n){var e=Fb(n,"string");return typeof e=="symbol"?e:e+""}function Fb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Er=U.module("CommandHistoryPanel");class hr extends m.Component{static handleError(e){Er.error(e)}constructor(e){super(e),$r(this,"container",void 0),$r(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=$.createRef(),this.pending=new nr;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(ke.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(ke.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:r,sessionId:i}=t;this.setState({session:e,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(Er.debug("handleSendToNotebook",r,e),!r){Er.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?te.CREATE_NOTEBOOK:te.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Er.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(ke.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;A(t),A(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(hr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(dr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&d.jsxs(d.Fragment,{children:[d.jsx(Ve,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),d.jsx(ne,{actions:o})]})]})}}$r(hr,"COMPONENT","CommandHistoryPanel");$r(hr,"TITLE","Command History");var $b=(n,e)=>{var t=vl(n),r=cr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Hb=Fn($b,null,null,{forwardRef:!0})(hr),Cu=m.createContext(null);Cu.displayName="PluginsContext";var on=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",ELEMENT_PLUGIN:"ElementPlugin",MIDDLEWARE_PLUGIN:"MiddlewarePlugin",MULTI_PLUGIN:"MultiPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",WIDGET_PLUGIN:"WidgetPlugin"});function Bb(n){return"DashboardPlugin"in n}function Ub(n){return"AuthPlugin"in n}function Wb(n){return"TablePlugin"in n}function Vb(n){return Bb(n)||Ub(n)||Wb(n)}function Kb(n){return"type"in n&&n.type===on.DASHBOARD_PLUGIN}function Di(n){return"type"in n&&n.type===on.MIDDLEWARE_PLUGIN}function Xr(n){return"type"in n&&n.type===on.WIDGET_PLUGIN}function zb(n){return"type"in n&&n.type===on.TABLE_PLUGIN}function Gb(n){return"type"in n&&n.type===on.AUTH_PLUGIN}function Su(n){return"type"in n&&n.type===on.THEME_PLUGIN}function wu(n){return"type"in n&&n.type===on.ELEMENT_PLUGIN}function Eu(n){return"type"in n&&n.type===on.MULTI_PLUGIN}function Mi(n){return Kb(n)||Gb(n)||wu(n)||Eu(n)||zb(n)||Su(n)||Xr(n)||Di(n)}var qb=["metadata"],Xb=["metadata"];function Wa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wa(Object(t),!0).forEach(function(r){Zb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zb(n,e,t){return(e=Yb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yb(n){var e=Qb(n,"string");return typeof e=="symbol"?e:e+""}function Qb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Pu(n,e){if(n==null)return{};var t,r,i=Jb(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 Jb(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 at=U.module("@deephaven/plugin.PluginUtils");function Nn(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 Va(n,e){return n==null||!Xr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function ey(n){var e=d.jsx(ve,{icon:_s});if(!Xr(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function W0(n){var e=[...n.entries()].filter(t=>Su(t[1]));return at.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:u}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:xd(r,s),name:s,styleContent:u}})}).flat()}function V0(n){var e=[...n.entries()].filter(t=>wu(t[1])&&t[1].mapping!=null);return at.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,r]=t;return Object.entries(r.mapping)}))}function ty(n,e){return e.length===0?(at.debug("No middleware to chain for component",Nn(n)),n):(at.debug("Chaining component middleware",Nn(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function a(s){var{metadata:l}=s,u=Pu(s,qb);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?d.jsx(t,Tt(Tt({},u),{},{metadata:l})):d.jsx(i,Tt(Tt({},u),{},{metadata:l,Component:t}))}return a.displayName="".concat(r.name,"(").concat(Nn(t),")"),a},n))}function K0(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(at.debug("No panel middleware to chain for panel component",Nn(n)),n):(at.debug("Chaining panel middleware",Nn(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var{panelComponent:o}=i,a=[i.supportedTypes].flat();function s(l){var{metadata:u}=l,c=Pu(l,Xb);return(u==null?void 0:u.type)!=null&&!a.includes(u.type)?d.jsx(r,Tt(Tt({},c),{},{metadata:u})):d.jsx(o,Tt(Tt({},c),{},{metadata:u,Component:r}))}return s.displayName="".concat(i.name,"Panel(").concat(Nn(r,"Panel"),")"),s},n))}function ny(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function ry(n){return Mi(n)?n:ny(n)&&Mi(n.default)?n.default:Vb(n)?n:null}function Ka(n,e,t,r){if(n.has(e)){at.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,Tt(Tt({},t),{},{version:r}))}function z0(n,e,t,r,i,o){i!=null&&(e[i]=t,at.debug("Registered plugin '".concat(i,"' in module resolve map")));var a=ry(t);if(a==null){at.error("Plugin '".concat(r,"' is missing an exported value."));return}Eu(a)?(at.debug("MultiPlugin '".concat(r,"' contains ").concat(a.plugins.length," plugins")),a.plugins.forEach(s=>{if(!Mi(s)){at.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),s);return}var l=typeof s.name=="string"?s.name.trim():"";if(l.length===0){at.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),s);return}Ka(n,l,s,o)})):Ka(n,r,a,o)}function G0(n){var e=new Map;n.forEach((h,v)=>{h.package!=null&&e.set(h.package,v)});var t=new Map;if(n.forEach((h,v)=>{if(h.dependencies!=null&&h.dependencies.length>0){var f=[];h.dependencies.forEach(p=>{var g=e.get(p);g!=null?f.push(g):at.warn("Plugin '".concat(h.name,"' depends on '").concat(p,"' which is not in the manifest"))}),f.length>0&&t.set(v,f)}}),t.size===0)return[...n];var r=new Array(n.length).fill(0),i=new Map;t.forEach((h,v)=>{h.forEach(f=>{i.has(f)||i.set(f,[]);var p=i.get(f);p!=null&&p.push(v),r[v]+=1})});for(var o=[],a=0;a<n.length;a+=1)r[a]===0&&o.push(a);for(var s=[];o.length>0;){var l=o.shift();if(l==null)break;s.push(n[l]);var u=i.get(l);u!=null&&(u.sort((h,v)=>h-v),u.forEach(h=>{r[h]-=1,r[h]===0&&o.push(h)}))}if(s.length!==n.length){var c=n.filter((h,v)=>r[v]>0).map(h=>h.name);throw new Error("Circular plugin dependency detected among: ".concat(c.join(", ")))}return s}function iy(){return ir(Cu,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var za=U.module("@deephaven/plugin.WidgetView");function q0(n){var{fetch:e,type:t}=n,r=iy(),{basePlugin:i,middleware:o}=m.useMemo(()=>{var s,l=[];return r.forEach(u=>{if(!(!Xr(u)&&!Di(u))){var c=[u.supportedTypes].flat().includes(t);c&&(Di(u)?l.push(u):(s!=null&&za.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(s.name," with ").concat(u.name)),s=u))}}),{basePlugin:s,middleware:l}},[r,t]),a=m.useMemo(()=>i==null?(za.debug("No base plugin found for widget type ".concat(t)),null):ty(i.component,o),[i,o,t]);if(a!=null)return d.jsx(a,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}function Ga(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Pr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ga(Object(t),!0).forEach(function(r){fn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ga(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fn(n,e,t){return(e=oy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oy(n){var e=ay(n,"string");return typeof e=="symbol"?e:e+""}function ay(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Tr=U.module("ConsolePanel"),sy=500,ly=Object.freeze({consoleSettings:{},itemIds:[]});class Zr extends m.PureComponent{constructor(e){super(e),fn(this,"consoleRef",void 0),fn(this,"objectSubscriptionCleanup",void 0),fn(this,"savePanelState",gn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Tr.debug("Saving panel state",l),this.setState({panelState:l})},sy)),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=$.createRef();var{panelState:t}=e,r=Pr(Pr({},ly),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(ae.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(ae.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=>{Tr.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,u=[...a,...l],c=new Map(o);u.forEach(v=>{var{title:f}=v;f!==void 0&&c.delete(f)});var h=[...a,...s];return h.forEach(v=>{v.title!==void 0&&c.set(v.title,v)}),{objectMap:c}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=_t(),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,a=e==null||(r=e.props)===null||r===void 0||(r=r.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(ke.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;A(this.context);var{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.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(ae.CLOSE,r),sb(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Tr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(ke.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;A(r);var{config:i,session:o}=r,{title:a=e.name}=e;A(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:Pr(Pr({},um(e)),{},{sessionId:i.id})};Tr.debug("openWidget",l),bg(t,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(ae.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>Va(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Va(i,e));return r!=null?ey(r):d.jsx(yl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(bn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:c,session:h,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:w,type:E}=c;return d.jsx(dr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:h!=null&&d.jsx(Zt,{dh:p,ref:this.consoleRef,settings:s,session:h,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:E,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:Sl.LANGUAGE_MAP.get(E)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),b,d.jsx("div",{children:"•"})]}),d.jsx(dp,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:w,timeZone:o,objectMap:u,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}fn(Zr,"COMPONENT","ConsolePanel");fn(Zr,"TITLE","Console");fn(Zr,"contextType",au);var uy=(n,e)=>({commandHistoryStorage:vl(n),sessionWrapper:cr(n,e.localDashboardId),timeZone:hm(n),plugins:mm(n)}),ci=Fn(uy,null,null,{forwardRef:!0})(Zr);function X0(n){return n==="file"||n==="directory"}function bt(n){return n.type==="directory"}function dy(n,e,t){return(e=cy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cy(n){var e=hy(n,"string");return typeof e=="symbol"?e:e+""}function hy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zi extends Error{constructor(){super("No file exists at the path specified"),dy(this,"isFileNotFound",!0)}}function qa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Xa(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){qa(o,r,i,a,s,"next",l)}function s(l){qa(o,r,i,a,s,"throw",l)}a(void 0)})}}var cn=function(n){return n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN="",n}({});class M{static fileExists(e,t){return Xa(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Zi))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(!M.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 Xa(function*(){for(var r=M.getCopyFileName(t);yield M.fileExists(e,r);)r=M.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return cn.GROOVY;case"py":return cn.PYTHON;case"pyc":return cn.PYTHON_COMPILED;case"scala":return cn.SCALA;case"txt":return cn.PLAIN_TEXT;default:return cn.UNKNOWN}}static getParent(e){if(!M.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!M.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=M.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new qn("Name cannot be empty");if(t.includes(e))throw new qn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new qn('Invalid characters in name: "'.concat((o=(a=e.match(r))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>M.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 Yi=26;function Ni(n){return bt(n)?M.makePath(n.filename):M.getPath(n.filename)}function Za(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 M.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>bt(r)&&t.startsWith(M.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function my(n){if(bt(n))return n.isExpanded?Id:Dd;var e=M.getMimeType(n.basename);switch(e){case cn.PYTHON:return Nd;default:return Md}}function ki(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:c,onDragOver:h,onDragEnd:v,onDragExit:f,onDrop:p}=n,g=(e=r==null?void 0:r.some(k=>k.id===s.id))!==null&&e!==void 0?e:!1,b=Ni(s),w=i&&u?Ni(u):null,E=i&&o&&bt(s)&&w===b,P=i&&o&&w===b,R=i&&!o&&w===b,Z=my(s),re=M.getDepth(s.filename),Y=Array(re).fill(null).map((k,B)=>d.jsx("span",{className:"file-list-depth-line"},B));return d.jsxs("div",{className:q("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":E,"is-in-drop-target":P,"is-invalid-drop-target":R,"is-selected":a}),onDragStart:k=>c(l,k),onDragOver:k=>h(l,k),onDragEnd:k=>v(l,k),onDragExit:f,onDrop:k=>p(l,k),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:Z,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function Ya(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ya(Object(t),!0).forEach(function(r){vy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ya(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function vy(n,e,t){return(e=fy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fy(n){var e=py(n,"string");return typeof e=="symbol"?e:e+""}function py(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Ue=U.module("FileList"),gy=500,Qa="item-list-scroll-pane";function by(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=ki,rowHeight:l=Yi,overscanCount:u=yt.DEFAULT_OVERSCAN}=n,[c,h]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,w]=m.useState(),[E,P]=m.useState(),[R,Z]=m.useState([]),re=m.useRef(),Y=m.useRef(null),k=m.useRef(null),B=m.useCallback(O=>{if(O.length===0||c==null)return[];for(var J=[],oe=0;oe<O.length;oe+=1)for(var fe=O[oe],Be=fe[0];Be<=fe[1];Be+=1)Be>=c.offset&&Be<c.offset+c.items.length&&J.push(c.items[Be-c.offset]);return J},[c]),Q=m.useCallback(O=>{var J=B([[O,O]]);if(J.length>0)return J[0]},[B]),G=m.useCallback(()=>{var O=ft.count(R);if(O===0)return null;if(O===1){var J=R[0][0],oe=Q(J);if(oe!=null)return oe.filename}return"".concat(O," items")},[Q,R]),L=m.useCallback(O=>{if(!(!b||!p)){Ue.debug("dropItems",b,"to",O);try{var{files:J,targetPath:oe}=Za(b,p);if(i==null||i(J,oe),O!=null){var fe;Z([[O,O]]),(fe=Y.current)===null||fe===void 0||fe.focusItem(O)}}catch(Be){Ue.error("Unable to complete move",Be)}}},[b,p,i]),W=m.useCallback((O,J)=>{var oe=c.items[O-c.offset];oe!==void 0&&(Ue.debug("handleItemClick",oe),o(oe,J),bt(oe)&&(t==null||t.setExpanded(oe.filename,!oe.isExpanded)))},[c,o,t]),X=m.useCallback((O,J)=>{var oe,fe;Ue.debug2("handleItemDragStart",O,R);var Be=R;ft.isSelected(R,O)||(Be=[[O,O]],Z(Be)),w(B(Be)),(oe=Y.current)===null||oe===void 0||oe.resetMouseState();var St=document.createElement("div"),wt=document.createElement("div");wt.className="dnd-placeholder-content",wt.innerText=(fe=G())!==null&&fe!==void 0?fe:"",St.appendChild(wt),St.className="file-list-dnd-placeholder",document.body.appendChild(St),J.dataTransfer.setDragImage(St,0,0),J.dataTransfer.effectAllowed="move",P(St)},[G,B,R]),F=m.useCallback((O,J)=>{J.preventDefault(),Ue.debug2("handleItemDragOver",J),g(Q(O))},[Q]),V=m.useCallback((O,J)=>{Ue.debug("handleItemDragEnd",O),E==null||E.remove(),w(void 0),g(void 0),P(void 0)},[E]),K=m.useCallback((O,J)=>{L(O)},[L]),pe=m.useCallback(()=>{Ue.debug2("handleItemDragExit"),g(void 0)},[]),je=m.useCallback(O=>{O.target instanceof Element&&O.target.classList.contains(Qa)&&(O.preventDefault(),Ue.debug2("handleListDragOver",O),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),j=m.useCallback(O=>{O.target instanceof Element&&O.target.classList.contains(Qa)&&(Ue.debug("handleListDrop"),L())},[L]),C=m.useCallback(function(O){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ue.debug2("handleSelectionChange",O),J===!0||O!==R){Z(O);var oe=B(O);a(oe)}},[B,a,R]),S=m.useCallback(O=>{if(Ue.debug2("handleFocusChange",O),O!=null){var[J]=B([[O,O]]);r(J)}else r();re.current=O},[B,r]),N=m.useCallback((O,J)=>{Ue.debug("handleViewportChange",O,J),(O!==v.top||J!==v.bottom)&&f({top:O,bottom:J})},[v]),z=m.useMemo(()=>{if(!b||!p)return!1;try{return Za(b,p),Ue.debug("handleValidateDropTarget true"),!0}catch{return Ue.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:ie}=n;m.useEffect(()=>{ie!==void 0&&(ie==="/"?t.collapseAll():(t.setExpanded(ie,!1),t.setExpanded(ie,!0)))},[t,ie]),m.useEffect(function(){Ue.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-u),bottom:v.bottom+u})},[u,t,v]),m.useEffect(function(){var J=t.onUpdate(oe=>{h({items:oe.items.map(fe=>_r(_r({},fe),{},{itemName:fe.basename})),offset:oe.offset,itemCount:t.size})});return()=>{J()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),R.length>0&&C(R,!0)},[c,S,C,R]),m.useEffect(function(){if(p!=null&&bt(p)&&p.filename!=="/"){var J=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},gy);return()=>clearTimeout(J)}},[p,t]);var ht=m.useCallback(O=>s(_r(_r({},O),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:z,onDragStart:X,onDragEnd:V,onDragOver:F,onDragExit:pe,onDrop:K})),[V,pe,F,X,K,b,p,z,s]);return d.jsx("div",{ref:k,className:q("file-list",{"is-dragging":b!=null}),onDragOver:je,onDrop:j,children:d.jsx(yt,{ref:Y,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:S,onSelect:W,onSelectionChange:C,onViewportChange:N,selectedRanges:R,renderItem:ht,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var yy={DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[_.DELETE],macShortcut:[I.CMD,_.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[_.ENTER],macShortcut:[_.ENTER]})};const Ja={FILE_EXPLORER:yy};var es=U.module("FileListItemEditor"),Cy=()=>Promise.resolve();function Sy(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Cy}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[c,h]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var E;(E=o.current)===null||E===void 0||E.focus()},[o]),f=m.useCallback(E=>E.stopPropagation(),[]),p=m.useCallback(()=>{c.then(()=>{r(a)}).catch(E=>es.info("Unable to validate name",E))},[r,a,c]);m.useEffect(function(){var P=_e.makeCancelable(i(a));return P.then(()=>u(void 0)).catch(R=>{_e.isCanceled(R)||u(R)}),h(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{es.debug2("handleBlur"),p()},[p]),b=m.useCallback(E=>{var{value:P}=E.target;s(P)},[]),w=m.useCallback(E=>{E.stopPropagation();var{key:P}=E;switch(P){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:q("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function ts(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 hi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ts(Object(t),!0).forEach(function(r){wy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ts(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wy(n,e,t){return(e=Ey(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ey(n){var e=Py(n,"string");return typeof e=="symbol"?e:e+""}function Py(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:c,onSelectionChange:h,table:v,rowHeight:f=Yi,validateRename:p=()=>Promise.resolve()}=n,[g,b]=m.useState(),[w,E]=m.useState([]),[P,R]=m.useState(),Z=m.useCallback(K=>{E(K),h==null||h(K)},[h]),re=m.useCallback(K=>{R(K)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),k=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),B=m.useCallback(()=>{i==null||i()},[i]),Q=m.useCallback(()=>{P&&(o==null||o(M.getPath(P.filename)))},[P,o]),G=m.useCallback(()=>{P&&b(P)},[P]),L=m.useCallback(()=>{b(void 0)},[]),W=m.useCallback(K=>{g&&(u==null||u(g,K),b(void 0))},[u,g]),X=m.useMemo(()=>{if(g)return[];var K=[];return i&&K.push({title:"New File",description:"Create new file",action:B,group:ne.groups.medium}),o&&K.push({title:"New Folder",description:"Create new folder",action:Q,group:ne.groups.medium}),a&&K.push({title:"Copy File",description:"Copy the selected file",action:Y,group:ne.groups.low,disabled:P==null||bt(P)}),s&&w.length>0&&K.push({title:"Delete",description:"Delete",shortcut:Ja.FILE_EXPLORER.DELETE,action:k,group:ne.groups.low}),u&&K.push({title:"Rename",description:"Rename",shortcut:Ja.FILE_EXPLORER.RENAME,action:G,group:ne.groups.low,disabled:P==null}),K},[Y,k,B,Q,G,P,a,i,o,s,u,w,g]),F=m.useCallback(K=>(A(g),p(g,K)),[g,p]),V=m.useCallback(K=>{var{item:pe}=K;return g&&g.filename===pe.filename?d.jsx(ki,hi(hi({},K),{},{children:d.jsx(Sy,{item:pe,validate:F,onSubmit:W,onCancel:L})})):d.jsx(ki,hi({},K))},[L,W,g,F]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(by,{onMove:l,onSelect:c,onSelectionChange:Z,onFocusChange:re,renderItem:V,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),r&&d.jsx(ne,{actions:X})]})}Tu.displayName="FileListContainer";function ns(n,e,t){return(e=Ty(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ty(n){var e=_y(n,"string");return typeof e=="symbol"?e:e+""}function _y(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Dr extends qn{constructor(e){super("Name already exists"),ns(this,"isExistingFile",!0),ns(this,"info",void 0),this.info=e}}function rs(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function is(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){rs(o,r,i,a,s,"next",l)}function s(l){rs(o,r,i,a,s,"throw",l)}a(void 0)})}}var Et=U.module("FileExplorer");function Qi(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:c,rowHeight:h=Yi}=n,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var W;function X(){return F.apply(this,arguments)}function F(){return F=is(function*(){Et.debug("initTable"),W=_e.makeCancelable(e.getTable(),V=>V.close());try{g(yield W)}catch(V){_e.isCanceled(V)||Et.error("Unable to initialize table",V)}}),F.apply(this,arguments)}return X(),()=>{W.cancel()}},[e]);var b=m.useCallback(L=>{_e.isCanceled(L)||Et.error(L)},[]),w=m.useCallback(()=>{Et.debug("handleCreateFile"),s()},[s]),E=m.useCallback(()=>{Et.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(L=>{Et.debug("handleCopyFile",L.filename),i(L)},[i]),R=m.useCallback(L=>{Et.debug("handleDelete, pending confirmation",L),f(L)},[]),Z=m.useCallback(()=>{Et.debug("handleDeleteConfirm",v),v.forEach(L=>e.deleteFile(bt(L)?M.makePath(L.filename):L.filename)),o(v),f([])},[v,o,e]),re=m.useCallback(()=>{Et.debug("handleDeleteCancel"),f([])},[]),Y=m.useCallback((L,W)=>{var X=M.reducePaths(L.map(F=>bt(F)?M.makePath(F.filename):F.filename));X.forEach(F=>{var V=M.isPath(F)?"".concat(W).concat(M.getBaseName(F.substring(0,F.length-1)),"/"):"".concat(W).concat(M.getBaseName(F));e.moveFile(F,V).then(()=>{a(F,V)}).catch(b)})},[b,a,e]),k=m.useCallback((L,W)=>{var X=L.filename,F=bt(L);F&&!X.endsWith("/")&&(X="".concat(X,"/"));var V="".concat(M.getParent(X)).concat(W);F&&!V.endsWith("/")&&(V="".concat(V,"/")),Et.debug2("handleRename",X,V),e.moveFile(X,V).catch(b),a(X,V)},[b,a,e]),B=m.useCallback(function(){var L=is(function*(W,X){if(X!==W.basename){M.validateName(X);var F="".concat(M.getPath(W.filename)).concat(X);try{var V=yield e.info(F);throw new Dr(V)}catch(K){if(!(K instanceof Zi))throw K}}});return function(W,X){return L.apply(this,arguments)}}(),[e]),Q=v.length>0,G=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return d.jsxs("div",{className:"file-explorer",children:[p&&d.jsx(Tu,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:P,onCreateFolder:E,onCreateFile:w,onMove:Y,onDelete:R,onRename:k,onSelect:u,onSelectionChange:c,rowHeight:h,table:p,validateRename:B}),d.jsx(Qn,{isOpen:Q,headerText:G,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:Z,confirmButtonText:"Delete"})]})}Qi.displayName="FileExplorer";function os(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Oy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){os(o,r,i,a,s,"next",l)}function s(l){os(o,r,i,a,s,"throw",l)}a(void 0)})}}function hn(n,e,t){return(e=xy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xy(n){var e=Iy(n,"string");return typeof e=="symbol"?e:e+""}function Iy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var sn=U.module("NewItemModal");class pn extends m.PureComponent{static getValidationMessage(e){return e instanceof Dr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){_e.isCanceled(e)||sn.error(e)}constructor(e){super(e),hn(this,"inputRef",$.createRef()),hn(this,"cancelableValidatePromise",void 0),hn(this,"cancelableExistingItemPromise",void 0),hn(this,"pending",new nr),hn(this,"pathMap",new Map),hn(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=_e.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return Oy(function*(){M.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Dr(l)}catch(u){if(!(u instanceof Zi))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(pn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(sn.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,r=M.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 qn))throw e;sn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;sn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){sn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=M.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){sn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;sn.debug("submitModal",r,i);var l=M.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(u=>{if(u instanceof Dr&&s!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw _e.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).catch(this.handleValidationError).catch(pn.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((r,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),d.jsxs($.Fragment,{children:[d.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:kd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:c,validationError:h,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=M.fileExtensionToString(f),w=M.fileExtensionToString(p),E=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(Ss,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(ws,{toggle:r,children:o}),d.jsx(Es,{children:d.jsx("form",{children:d.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[d.jsxs("div",{className:"flex-grow-0 mb-4",children:[d.jsx("label",{htmlFor:"file-name-input",children:P}),d.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:q("form-control",{"is-invalid":h}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d.jsx("div",{className:"invalid-feedback",children:pn.getValidationMessage(h)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(Qi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Ys,{children:[d.jsx(se,{kind:"secondary",onClick:r,children:"Cancel"}),d.jsx(se,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:E})]})]}),d.jsx(Qn,{isOpen:c,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(Qn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}hn(pn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function Dy(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(se,{kind:"ghost",icon:js,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(se,{kind:"ghost",icon:jd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(al,{value:i,onChange:r,placeholder:"Search by name"})})]})}function as(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function My(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){as(o,r,i,a,s,"next",l)}function s(l){as(o,r,i,a,s,"throw",l)}a(void 0)})}}function _u(n,e,t){return(e=Ny(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ny(n){var e=ky(n,"string");return typeof e=="symbol"?e:e+""}function ky(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ln=U.module("FileExplorerPanel"),jy=(n,e)=>{var t=fl(n),r=cr(n,e.localDashboardId),{session:i,config:o}=r??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},Ly=Fn(jy,null,null,{forwardRef:!0});function Ay(n){var e=n;return e!=null&&typeof e.button=="number"}class Rn extends $.Component{static handleError(e){ln.error(e)}static isFocusEvent(e){return Ay(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};ln.debug("handleCreateFile",t,r,i),e.emit(te.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){ln.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){ln.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Rn.handleError)}handleCopyFile(e){var t=this;return My(function*(){var{fileStorage:r}=t.props;if(bt(e)){ln.error("Invalid item in handleCopyItem",e);return}var i=yield M.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(te.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(ln.debug("fileSelect",e),e.type!=="directory"){var r=Rn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(te.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;ln.debug("handleRename",e,t),r.emit(te.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return d.jsxs(dr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(Dy,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(Qi,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),d.jsx(pn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}_u(Rn,"COMPONENT","FileExplorerPanel");_u(Rn,"TITLE","File Explorer");var Ry=Ly(Rn);function tr(n,e,t){return(e=Fy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fy(n){var e=$y(n,"string");return typeof e=="symbol"?e:e+""}function $y(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ss=U.module("LogPanel");class Yr extends m.PureComponent{constructor(e){super(e),tr(this,"isBottomVisible",void 0),tr(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){ss.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ss.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return d.jsxs(dr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&d.jsx(we,{session:r,ref:i=>{this.logView=i}})]})}}tr(Yr,"defaultProps",{session:null});tr(Yr,"COMPONENT","LogPanel");tr(Yr,"TITLE","Log");var Hy=(n,e)=>{var t;return{session:(t=cr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},By=Fn(Hy,null,null,{forwardRef:!0})(Yr);function ls(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Or(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ls(o,r,i,a,s,"next",l)}function s(l){ls(o,r,i,a,s,"throw",l)}a(void 0)})}}function us(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Je(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?us(Object(t),!0).forEach(function(r){Fe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):us(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Fe(n,e,t){return(e=Uy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uy(n){var e=Wy(n,"string");return typeof e=="symbol"?e:e+""}function Wy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Vy=m.lazy(()=>As(()=>import("./MarkdownNotebook-Dri21Gmn.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),de=U.module("NotebookPanel"),ds=400;class xe extends m.Component{static handleError(e){_e.isCanceled(e)||de.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(xe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(xe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Fe(this,"pending",void 0),Fe(this,"debouncedSavePanelState",void 0),Fe(this,"debouncedLoad",void 0),Fe(this,"notebook",void 0),Fe(this,"tabTitleElement",void 0),Fe(this,"tabInitOnce",void 0),Fe(this,"editor",void 0),Fe(this,"getSettings",Yt((v,f)=>Je(Je({},v),{},{minimap:{enabled:f}}))),Fe(this,"getOverflowActions",Yt((v,f,p)=>{var g=[{title:"Find",icon:Rd,action:this.handleFind,group:ne.groups.high,shortcut:Ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Ps,action:this.handleCopy,group:ne.groups.medium,order:20},{title:"Rename File",icon:Fd,action:this.handleShowRename,group:ne.groups.medium,order:30},{title:"Delete File",icon:Ds,action:this.handleDelete,group:ne.groups.medium,order:40},{title:"Show Minimap",icon:v?Mn:void 0,action:this.handleMinimapChange,group:ne.groups.low,shortcut:Ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?Mn:void 0,action:this.handleWordWrapChange,group:ne.groups.low,shortcut:Ke.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:ne.groups.low,order:10}),g.push({title:"Format on Save",icon:p?Mn:void 0,action:this.handleFormatOnSaveChange,group:ne.groups.low,order:15})),g})),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFormatOnSaveChange=this.handleFormatOnSaveChange.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.handleFormat=this.handleFormat.bind(this),this.canFormat=this.canFormat.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new nr,this.debouncedSavePanelState=gn(this.savePanelState.bind(this),ds),this.debouncedLoad=gn(this.load.bind(this),ds),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var u=s!=null&&M.hasPath(s.itemName),c=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,h=c?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},de.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(te.RENAME_FILE,this.handleRenameFile),t.on(ae.DROPPED,this.handlePanelDropped),e.on(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;r!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.notebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(te.RENAME_FILE,this.handleRenameFile),e.off(ae.DROPPED,this.handlePanelDropped),t.off(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(te.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);A(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r==null||r.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){de.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){de.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(te.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(te.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(te.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;A(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;de.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:c}=u;this.renameTab(c,M.getBaseName(s))}var h=Je(Je({},t),{},{language:(a=xe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(h.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:h}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){de.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;de.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,u=Je(Je({},a),{},{value:s}),c=Je(Je({},a),{},{value:l}),h={settings:c,fileMetadata:i,isPreview:o};return de.debug("Saving panel state",h),{settings:u,panelState:h}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(te.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return Or(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;A(o);var{language:s}=a,{itemName:l}=o,u=yield M.getUniqueCopyFileName(t,l);de.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var c={id:u,itemName:u},h={value:null,language:s};r.emit(te.SELECT_NOTEBOOK,i,s,h,c,!0)})()}handleDelete(){de.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Or(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;de.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(M.hasPath(o.itemName)&&(yield M.fileExists(t,o.itemName))?(i.emit(te.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){de.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:r}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:Je(Je({},t),{},{wordWrap:r})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:r}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};r(i)}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){de.debug("Ignoring invalid notebook link",a);return}de.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},u={id:a,itemName:a};s.emit(te.SELECT_NOTEBOOK,r,i,l,u)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;_e.isCanceled(t)||(_e.isTimedOut(t)&&(t=new Error("File not found.")),de.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return Or(function*(){de.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:r=!1}=t;r&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=xe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=Je(Je({},a.settings),{},{language:o});return de.debug("handleSaveSuccess",i,s,l),s&&M.hasPath(s.itemName)&&s.itemName!==i.itemName&&(de.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(xe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){_e.isCanceled(e)||(this.setState({savedChangeCount:0}),de.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),de.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(o)!==M.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?me.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return Or(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield me.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){a.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){de.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){de.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;de.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){de.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];de.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){de.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){de.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r==null?void 0:r.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var o=new URL(i,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=Je(Je({},s),{},{language:t,value:r}),u={id:null,itemName:e};de.debug("handleCreateNotebook",o,a,l,u),i.emit(te.CREATE_NOTEBOOK,o,a,l,u)}runCommand(e){if(e===void 0||e===""){de.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(ke.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:r}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",r??!1)}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:c,error:h,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:w,sessionLanguage:E,settings:P,showCloseModal:R,showDeleteModal:Z,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,k=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:xe.DEFAULT_NAME,B=k.endsWith(".md"),Q=(b==null?void 0:b.id)!=null,G=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=w!=null,W=E===G.language,X=!f||!L||!W,F=!f,V=[{action:this.handleSave,shortcut:qt.SAVE},{action:this.handleMinimapChange,shortcut:Ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ke.NOTEBOOK.WORDWRAP}],K=Ei.getDisabledRunTooltip(L,W,"Notebook extension","Run"),pe=Ei.getDisabledRunTooltip(L,W,"Notebook extension","Run Selected"),je=[{title:Q?"Rename":"Save As…",order:10,group:ne.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ne.groups.high,order:20}],j=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[j!=null&&Br.createPortal(d.jsx("span",{className:q(xe.UNSAVED_INDICATOR_CLASS_NAME,{[xe.UNSAVED_STATUS_CLASS_NAME]:u!==c})}),j),d.jsxs(dr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:je,renderTabTooltip:()=>k,children:[!B&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:X,icon:d.jsx(ve,{icon:ks,transform:"grow-4"}),tooltip:"Run ".concat(Ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),K!=null&&d.jsx(he,{children:K})]}),d.jsxs("span",{children:[d.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:X,icon:d.jsx(ve,{icon:Ld,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(se,{kind:"ghost",className:"mr-auto",disabled:F,onClick:this.handleSave,icon:Ad,tooltip:"Save ".concat(qt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(se,{kind:"ghost",className:"btn-overflow",disabled:F,icon:Ns,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(or,{actions:this.getDropdownOverflowActions,popperOptions:xe.POPPER_OPTIONS})})]}),d.jsx(Al,{isLoaded:f,isLoading:p,error:h,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:E,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:G,focusOnMount:Y,ref:C=>{this.notebook=C}})]}),B&&d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(Vy,{content:(r=G.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(pn,{isOpen:re,type:"file",defaultValue:k,title:Q?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(Qn,{isOpen:Z,headerText:'Are you sure you want to delete "'.concat(k,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(Qn,{isOpen:R,headerText:"Do you want to save the changes you made to ".concat(k,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),d.jsx(ne,{actions:V})]})]})}}Fe(xe,"COMPONENT","NotebookPanel");Fe(xe,"POPPER_OPTIONS",{placement:"bottom-end"});Fe(xe,"DEFAULT_NAME","Untitled");Fe(xe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Fe(xe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Fe(xe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var Ky=(n,e)=>{var t=fl(n),r=gl(n),i=cr(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:r,session:o,sessionLanguage:s}},un=Fn(Ky,{updateNotebookSettings:ym},null,{forwardRef:!0})(xe);function zy(){var{python:{linter:n={}}={}}=$g(gl),{isEnabled:e=!1,config:t}=n;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}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 hs(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){Gy(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 Gy(n,e,t){return(e=qy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qy(n){var e=Xy(n,"string");return typeof e=="symbol"?e:e+""}function Xy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=U.module("ConsolePlugin");function ms(n){return n.notebook!==void 0}function Zy(n){Pg(n)}function Z0(n){Zy(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,u]=m.useState(new Map),[c,h]=m.useState(new Map);zy();var v=ji(),f=m.useCallback(()=>i.getLastUsedPanelOfType(ci),[i]),p=m.useCallback((C,S)=>{u(N=>new Map(N.set(C,S)))},[u]),g=m.useCallback(C=>{u(S=>(S.delete(C),new Map(S)))},[u]),b=m.useCallback((C,S)=>{h(N=>new Map(N.set(C,S)))},[h]),w=m.useCallback(C=>{h(S=>(S.delete(C),new Map(S)))},[h]),E=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,z=C&&C.trim();if(!z)be.info("Ignoring empty code");else{var ie=f();if(!ie||!(ie instanceof ci.WrappedComponent)){be.error("Console panel not found");return}be.debug("Send command: ",C,S,N),ie.addCommand(C,S,N)}},[f]),P=m.useCallback(C=>{v(Ab(e,C))},[v,e]),R=m.useCallback(C=>{var{language:S}=C,N=S==="python"?"py":S,z=null;return N==null?(be.debug("No extension for language",S),z="Untitled-".concat(s.current)):z="Untitled-".concat(s.current,".").concat(N),s.current+=1,z},[]),Z=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:N}=C;if(N!=null&&l.has(N))return l.get(N);if(N!=null&&c.has(N))return c.get(N);if(S)return _t()},[l,c]),re=m.useCallback((C,S)=>{x.renameComponent(r.root,{id:C},S)},[r.root]),Y=m.useCallback((C,S)=>{be.debug("Rename file panel",C,S);var N;if(l.has(C)&&(N=l.get(C),g(C),N!=null&&p(S,N)),c.has(C)&&(N=c.get(C),w(C),N!=null&&b(S,N)),N===void 0){be.debug2("File ".concat(C," isn't open, no need to rename the tab"));return}re(N,M.getBaseName(S))},[l,c,re,p,b,g,w]),k=m.useCallback(C=>{var S=Z(C,!1);if(S==null){be.error("Could not find panel id for file metadata",C);return}x.activateTab(r.root,{id:S})},[Z,r.root]),B=m.useCallback((C,S,N)=>{if(be.debug("registerFilePanel",C,S,N),S==null||S.id==null){be.debug("Ignore empty file id",S);return}var{id:z}=S;if(N){b(z,C);return}if(l.has(z)){var ie=l.get(z);if(C===ie){be.debug("Update tab title for file ".concat(z));var{itemName:ht}=S;Y(z,ht)}else be.error("File ".concat(z," already associated with a different tab ").concat(ie));return}p(z,C),c.has(z)&&w(z)},[l,c,Y,p,b,w]),Q=m.useCallback((C,S)=>{if(be.debug("unregisterFileTab",C,S),C==null||C.id==null){be.debug("Ignore empty file id",C);return}var{id:N}=C;if(S){w(N);return}g(N)},[g,w]),G=m.useCallback((C,S)=>{be.debug("closeFilePanel",C);var{id:N}=C;if(N==null){be.warn("File ID is null, ignore close event");return}var z=null,ie=!1;if(l.has(N))z=l.get(N);else if(c.has(N))z=c.get(N),ie=!0;else{be.debug("File ".concat(N," isn't open, ignore close event"));return}Q(C,ie),x.closeComponent(r.root,{id:z},S)},[r.root,l,c,Q]),L=m.useCallback(C=>{var{itemName:S}=C;return M.getBaseName(S)},[]),W=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpen",C,S,l),S!=null&&l.has(S)},[l]),X=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpenAsPreview",C,S,c),S!=null&&c.has(S)},[c]),F=m.useCallback(C=>{if(C!=null){var S=i.getOpenedPanelById(C);S&&ms(S)&&S.focus()}},[i]),V=m.useCallback(C=>{var{id:S,settings:N,fileMetadata:z,session:ie,sessionLanguage:ht,isPreview:O=!1}=C,J={settings:N,fileMetadata:z},oe=L(z);return{type:"react-component",component:un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ie,sessionLanguage:ht,panelState:J,isPreview:O,notebooksUrl:a},title:oe,id:S}},[L,e,a]),K=m.useCallback(function(C,S,N){var z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:R(N)},ie=Z(z);if(W(z)&&ie!=null){be.debug("File is already open, focus panel"),k(z),F(ie);return}if(ie==null){be.error("Panel ID for file metadata is null");return}var ht=x.getStackForComponentTypes(r.root,[un.COMPONENT]),O=V({id:ie,settings:N,fileMetadata:z,session:C,sessionLanguage:S});be.debug("createNotebook",O,l),x.openComponentInStack(ht,O)},[W,F,R,Z,r.root,V,l,k]),pe=m.useCallback(function(C,S,N,z){var ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;be.debug("selectNotebook",z,ie);var ht=W(z),O=X(z),[J]=[...c.values()],oe=!ie,fe=oe&&J?J:Z(z);if(fe==null||fe==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(z)));if(ht||O)k(z);else{var Be=x.getStackForComponentTypes(r.root,[un.COMPONENT]),St=V({id:fe,settings:N,fileMetadata:z,session:C,sessionLanguage:S,isPreview:oe});x.openComponentInStack(Be,St)}if(O&&ie){var wt=z.id,ei=x.getStackForConfig(r.root,{component:un.COMPONENT,id:fe}),Hn=x.getContentItemInStack(ei,{component:un.COMPONENT,id:fe});wt!=null&&Hn&&Re(Hn)&&(Hn.container.emit(te.PROMOTE_FROM_PREVIEW),w(wt),p(wt,fe))}ie&&F(fe)},[k,W,X,F,Z,r.root,V,c,w,p]),je=m.useCallback(function(C,S){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,ie=i.getLastUsedPanelOfType(un);ie&&ms(ie)?N!=null&&N.value!=null&&ie.notebook!=null&&ie.notebook.append(N.value):z&&K(C,S,N)},[K,i]),j=m.useCallback((C,S)=>Ng.hydrate(hs(hs({},C),{},{notebooksUrl:a}),S),[a]);return Wn(o,ci,t),Wn(o,Hb),Wn(o,Ry),Wn(o,By),Wn(o,un,j),Ae(r.eventHub,ke.SEND_COMMAND,E),Ae(r.eventHub,ke.SETTINGS_CHANGED,P),Ae(r.eventHub,te.CLOSE_FILE,G),Ae(r.eventHub,te.CREATE_NOTEBOOK,K),Ae(r.eventHub,te.SELECT_NOTEBOOK,pe),Ae(r.eventHub,te.RENAME,re),Ae(r.eventHub,te.RENAME_FILE,Y),Ae(r.eventHub,te.SEND_TO_NOTEBOOK,je),Ae(r.eventHub,te.REGISTER_FILE,B),Ae(r.eventHub,te.UNREGISTER_FILE,Q),null}function Qr(n,e,t){return(e=Yy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yy(n){var e=Qy(n,"string");return typeof e=="symbol"?e:e+""}function Qy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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{}Qr(Jr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Qr(Jr,"INPUT_FILTER","ControlType.INPUT_FILTER");Qr(Jr,"MARKDOWN","ControlType.MARKDOWN");Qr(Jr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{bm as $,xC as A,se as B,el as C,Ge as D,IC as E,Ml as F,qs as G,Zs as H,Ot as I,Xs as J,_ as K,$e as L,gl as M,ym as N,Jn as O,_e as P,H as Q,gv as R,ll as S,T,qt as U,rl as V,Jr as W,O0 as X,or as Y,yl as Z,Wr as _,pt as a,I as a$,nn as a0,f0 as a1,cu as a2,RC as a3,pl as a4,fC as a5,cr as a6,L0 as a7,mm as a8,He as a9,NC as aA,$C as aB,LC as aC,AC as aD,A0 as aE,R0 as aF,MC as aG,jC as aH,bl as aI,kC as aJ,me as aK,aC as aL,Pc as aM,ir as aN,Dc as aO,Tc as aP,zs as aQ,Ks as aR,_c as aS,Oc as aT,ft as aU,yt as aV,Mc as aW,Js as aX,al as aY,Wh as aZ,Vr as a_,y0 as aa,Hg as ab,DC as ac,Ng as ad,Vd as ae,Bs as af,te as ag,xt as ah,t0 as ai,r0 as aj,o0 as ak,s0 as al,ae as am,_0 as an,C0 as ao,E0 as ap,un as aq,bg as ar,um as as,Rs as at,Ur as au,Z0 as av,ne as aw,Qn as ax,iy as ay,FC as az,It as b,Nr as b$,Ys as b0,Jc as b1,Li as b2,lC as b3,Vh as b4,Ai as b5,dC as b6,nl as b7,Gs as b8,ul as b9,VC as bA,Qv as bB,GC as bC,qC as bD,of as bE,af as bF,ZC as bG,XC as bH,Ui as bI,YC as bJ,ap as bK,ep as bL,sp as bM,Zt as bN,Cl as bO,Ve as bP,Lr as bQ,Uf as bR,Rl as bS,Sl as bT,Am as bU,Tl as bV,_m as bW,kn as bX,wl as bY,jn as bZ,Of as b_,tl as ba,Nc as bb,fh as bc,Mr as bd,im as be,hl as bf,cl as bg,dl as bh,cC as bi,hC as bj,mC as bk,Rv as bl,Fv as bm,Ee as bn,Vv as bo,rf as bp,ee as bq,qv as br,Ne as bs,HC as bt,Il as bu,Dl as bv,WC as bw,zC as bx,BC as by,UC as bz,y as c,Gb as c$,_l as c0,dp as c1,we as c2,Si as c3,Ke as c4,Al as c5,Ei as c6,Fs as c7,x as c8,Wn as c9,yg as cA,Sg as cB,Cg as cC,wg as cD,JC as cE,Ag as cF,d0 as cG,c0 as cH,P0 as cI,w0 as cJ,n0 as cK,a0 as cL,i0 as cM,l0 as cN,g0 as cO,T0 as cP,Ae as cQ,Gg as cR,W0 as cS,V0 as cT,on as cU,Cu as cV,q0 as cW,ty as cX,K0 as cY,ey as cZ,ry as c_,e0 as ca,v0 as cb,yb as cc,ab as cd,ob as ce,di as cf,mu as cg,p0 as ch,u0 as ci,au as cj,xg as ck,qi as cl,Gi as cm,hu as cn,Vg as co,lu as cp,wr as cq,Pg as cr,iu as cs,sb as ct,S0 as cu,h0 as cv,m0 as cw,du as cx,ou as cy,Eg as cz,qe as d,Kb as d0,wu as d1,Ub as d2,Bb as d3,Vb as d4,Wb as d5,Eu as d6,Mi as d7,zb as d8,Su as d9,N0 as dA,bu as dB,D0 as dC,k0 as dD,nr as dE,x0 as dF,U0 as dG,I0 as dH,bt as dI,B0 as dJ,$0 as dK,F0 as dL,yu as dM,ke as dN,j0 as dO,Ab as dP,zy as dQ,rC as dR,sC as dS,iC as dT,ni as dU,Xd as dV,ti as dW,KC as dX,qn as dY,Di as da,Xr as db,Va as dc,z0 as dd,Ka as de,G0 as df,oC as dg,so as dh,gg as di,zr as dj,b0 as dk,M as dl,Zi as dm,X0 as dn,ci as dp,By as dq,Hb as dr,Ry as ds,Ws as dt,nC as du,dr as dv,Vs as dw,tn as dx,H0 as dy,M0 as dz,Cm as e,hm as f,pC as g,_C as h,TC as i,PC as j,EC as k,wC as l,SC as m,vC as n,yC as o,bC as p,gC as q,Se as r,ce as s,he as t,lm as u,Pe as v,OC as w,CC as x,uC as y,$g as z};
|
|
25
|
-
//# sourceMappingURL=ControlType-
|
|
24
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,we.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return d.jsxs("div",{className:"log-pane h-100 w-100",children:[d.jsxs("div",{className:"log-pane-menu",children:[d.jsx(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:_d,tooltip:"Clear log"}),d.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Od,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(or,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ot(we,"DefaultLogLevels",[Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN]);ot(we,"AllLogLevels",[Ie.INFO,Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN,Ie.DEBUG,Ie.TRACE]);ot(we,"bufferTimeout",16);ot(we,"maxLogSize",131072);ot(we,"truncateSize",65536);const Jf="var(--dh-color-chart-colorway)",ep="var(--dh-color-chart-grid)",tp="var(--dh-color-chart-axis-line)",np="var(--dh-color-chart-axis-line-zero)",Ea={"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:Jf,gridcolor:ep,linecolor:tp,zerolinecolor:np,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)","map-style":"var(--dh-color-chart-map-style)"};var Pa=U.module("ChartTheme");function rp(){var n,e=Ns(Ea);return e.colorway=xd((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Id.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Pa.debug2("Chart theme:",Ea),Pa.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"],map_style:e["map-style"]})}function Ta(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 ip(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(r){op(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function op(n,e,t){return(e=ap(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ap(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 lp=m.lazy(()=>$s(()=>import("./Plot-B8AgOqqz.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function up(n){return d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"lazy-plot-loading"}),children:d.jsx(lp,ip({},n))})}var Wi=m.createContext(null);Wi.displayName="ChartThemeContext";function t0(n){var{children:e}=n,{activeThemes:t}=Qs(),r=m.useMemo(rp,[t]);return d.jsx(Wi.Provider,{value:r,children:e})}function dp(){return ir(Wi,"No ChartThemeContext value found.")}function _a(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function cp(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){_a(o,r,i,a,s,"next",l)}function s(l){_a(o,r,i,a,s,"throw",l)}a(void 0)})}}var hp=U.module("HeapUsage");function mp(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=dp(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[c,h]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=qs(),p=m.useCallback(cp(function*(){try{var F=yield t.getWorkerHeapInfo();if(!f.current)return;if(u(F),o||c){for(var V=(F.totalHeapSize-F.freeMemory)/F.maximumHeapSize,K=Date.now(),{timestamps:pe,usages:ke}=v.current;pe.length!==0&&K-pe[0]>a*1.5;)pe.shift(),ke.shift();pe.push(K),ke.push(V)}else v.current={timestamps:[],usages:[]}}catch(j){hp.warn("Unable to get heap usage",j)}}),[t,f,o,c,a]);Oc(p,c?i:r);var g=(F,V)=>Math.round(F*10**V)/10**V,b=2,w=1024**3,{freeMemory:E,totalHeapSize:P,maximumHeapSize:R}=l,Z=g(E/w,b),re=g(P/w,b),Y=g(R/w,b),k=re-Z,B=function(V,K){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:q("heap-usage-info-row",{"heading-bottom-border":pe}),children:[d.jsx("div",{className:"font-weight-bold",children:V}),d.jsx("div",{children:K})]})},{timestamps:Q,usages:G}=v.current,L=(e=Q[Q.length-1])!==null&&e!==void 0?e:0,W=P/R,X=(P-E)/R;return d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(W*100,"% - ").concat(W*2,"px")}}),d.jsx("div",{className:q("used-memory",{"heap-overflow":(P-E)/R>.95}),style:{width:"calc(".concat(X*100,"% - ").concat(X*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[Y.toFixed(1)," GB"]}),d.jsx(he,{onEntered:()=>h(!0),onExited:()=>h(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[B("In use:","".concat(k.toFixed(b)," of ").concat(Y.toFixed(b)," GB"),!0),B("Free:","".concat(Z.toFixed(b)," GB")),B("Total:","".concat(re.toFixed(b)," GB")),B("Max:","".concat(Y.toFixed(b)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(up,{data:[{x:[...Q],y:[...G],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(a/6),gridcolor:s.linecolor,range:[L-a,L],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}var Bl=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 Ul(n){return n.componentName!==void 0}function vp(n){return n.component!==void 0}var Wl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const fp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Bl,isGLComponentConfig:Ul,isReactComponentConfig:vp,itemDefaultConfig:Wl},Symbol.toStringTag,{value:"Module"}));function Ir(n,e,t){return(e=pp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pp(n){var e=gp(n,"string");return typeof e=="symbol"?e:e+""}function gp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xe{constructor(){Ir(this,"_mSubscriptions",void 0),Ir(this,"off",this.unbind),Ir(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Xe.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Xe.ALL_EVENT],u=0;u<l.length;u++){var c=l[u].ctx||{};try{l[u].fn.apply(c,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Ir(Xe,"ALL_EVENT","__all");function vt(n,e,t){return(e=bp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bp(n){var e=yp(n,"string");return typeof e=="symbol"?e:e+""}function yp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Pi extends Xe{constructor(e,t,r){super(),vt(this,"width",void 0),vt(this,"height",void 0),vt(this,"title",void 0),vt(this,"parent",void 0),vt(this,"layoutManager",void 0),vt(this,"tab",void 0),vt(this,"_config",void 0),vt(this,"isHidden",!1),vt(this,"beforeCloseHandler",void 0),vt(this,"_element",D(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),vt(this,"_contentElement",void 0),this.title=Ul(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",c=u==="height"?t:e,h=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),v=c/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[u]=v;else{var g;a.contentItems[p].config[u]=((g=a.contentItems[p].config[u])!==null&&g!==void 0?g:0)+f}return a.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Cp=Object.freeze(Object.defineProperty({__proto__:null,Container:Pi,ItemContainer:Pi},Symbol.toStringTag,{value:"Module"}));function Vl(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Kl(n){if(window.location.hash)return Vl(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 Vi(n){return window.requestAnimationFrame(n)}function Sp(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 Ar(){return _t()}function wp(n,e){var t=n.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Ki(n){return D.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ye(n,e,t){return(e=Ep(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ep(n){var e=Pp(n,"string");return typeof e=="symbol"?e:e+""}function Pp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ar extends Xe{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Ye(this,"_eElement",void 0),Ye(this,"_oDocument",void 0),Ye(this,"_eBody",void 0),Ye(this,"_root",void 0),Ye(this,"_destroyAfterMouseUp",void 0),Ye(this,"_nDelay",400),Ye(this,"_timeout",void 0),Ye(this,"timeout",void 0),Ye(this,"_nDistance",10),Ye(this,"_nX",0),Ye(this,"_nY",0),Ye(this,"_nOriginalX",0),Ye(this,"_nOriginalY",0),Ye(this,"_bDragging",!1),this._eElement=e,this._oDocument=D(document),this._eBody=D(document.body),this._root=t,this._destroyAfterMouseUp=i,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(r=this._eElement)===null||r===void 0||r.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),(a=this._root)===null||a===void 0||a.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._root)===null||r===void 0||r.childElementContainer.addClass("lm_dragging"),(i=this._oDocument)===null||i===void 0||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}function Pn(n,e,t){return(e=Tp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tp(n){var e=_p(n,"string");return typeof e=="symbol"?e:e+""}function _p(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zl{constructor(e,t){Pn(this,"_container",void 0),Pn(this,"_reactComponent",null),Pn(this,"_portalComponent",null),Pn(this,"_originalComponentWillUpdate",void 0),Pn(this,"_initialState",void 0),Pn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Br.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t,void 0)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=D.extend(e,this._container._config.props);return $.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"],Op=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function zi(n){if(Rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Gi(n,e,"_min"),e}function Ti(n){if(Rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Gi(n,e,"_max"),e}function Gi(n,e,t){var r=t==="_min"?xp:Ip;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=r(i,Rr);e[s]=a}Gi(o,a,t)}else{var l=r(o,Op);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Rr);e[u]=l}}}}function xp(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Ip(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function li(n,e,t){return(e=Dp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dp(n){var e=Mp(n,"string");return typeof e=="symbol"?e:e+""}function Mp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 _i{constructor(e,t){li(this,"name",void 0),li(this,"origin",void 0),li(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function gr(n,e,t){return(e=Np(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Np(n){var e=kp(n,"string");return typeof e=="symbol"?e:e+""}function kp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Gl=class extends Xe{constructor(e){super(),gr(this,"_layoutManager",void 0),gr(this,"_dontPropagateToParent",void 0),gr(this,"_childEventSource",void 0),gr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Xe.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),D(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){D(window).off("gl_child_event",this._boundOnEventFromChild)}};function ql(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function Xl(n){return(e,t)=>ql(e,n,t)}function Zl(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 Yl(n){return(e,t)=>{var r=m.useRef(null),i=m.useRef(()=>!1);if(r.current!=e||i.current!=t){var o;(o=r.current)===null||o===void 0||o.off(n,i.current),e==null||e.on(n,t)}r.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=r.current)===null||a===void 0?void 0:a.off(n,i.current)},[])}}function Dt(n){return{listen:Xl(n),emit:Zl(n),useListener:Yl(n)}}const jp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:_i,DragListener:ar,EventEmitter:Xe,EventHub:Gl,ReactComponentHandler:zl,animFrame:Vi,filterXss:wp,getHashValue:Vl,getQueryStringParam:Kl,getUniqueId:Ar,listenForEvent:ql,makeEmitFunction:Zl,makeEventFunctions:Dt,makeListenFunction:Xl,makeUseListenerFunction:Yl,minifyConfig:zi,removeFromArray:Sp,stripTags:Ki,unminifyConfig:Ti},Symbol.toStringTag,{value:"Module"}));function Ut(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)}class Ql extends Xe{constructor(e,t,r,i,o){super(),Ut(this,"isInitialised",!1),Ut(this,"_config",void 0),Ut(this,"_dimensions",void 0),Ut(this,"_parentId",void 0),Ut(this,"_indexInParent",void 0),Ut(this,"_layoutManager",void 0),Ut(this,"_popoutWindow",null),Ut(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,u,c,h;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(c=this._popoutWindow)===null||c===void 0?void 0:c.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=D.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;D(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Ar();e=zi(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function Oe(n,e,t){return(e=Rp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rp(n){var e=Fp(n,"string");return typeof e=="symbol"?e:e+""}function Fp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wn extends Xe{constructor(e,t,r,i,o,a){var s,l,u,c,h,v,f,p;if(super(),Oe(this,"_dragListener",void 0),Oe(this,"_layoutManager",void 0),Oe(this,"_contentItem",void 0),Oe(this,"_originalParent",void 0),Oe(this,"_area",null),Oe(this,"_lastValidArea",null),Oe(this,"_minX",void 0),Oe(this,"_maxX",void 0),Oe(this,"_minY",void 0),Oe(this,"_maxY",void 0),Oe(this,"_width",void 0),Oe(this,"_height",void 0),Oe(this,"_sided",void 0),Oe(this,"element",void 0),Oe(this,"childElementContainer",void 0),Oe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=D(wn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Ki((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").text((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),D(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,E;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((E=this._proxyTab.outerHeight(!0))!==null&&E!==void 0?E:0)}var P=this._layoutManager.container.offset();this._minX=(u=P==null?void 0:P.left)!==null&&u!==void 0?u:0,this._minY=(c=P==null?void 0:P.top)!==null&&c!==void 0?c:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(p=this.element.height())!==null&&p!==void 0?p:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Oe(wn,"_template",'<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>');function br(n,e,t){return(e=$p(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $p(n){var e=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)}class Jl{constructor(e,t,r){br(this,"_element",void 0),br(this,"_itemConfig",void 0),br(this,"_layoutManager",void 0),br(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new ar(this._element,this._layoutManager.root,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}function yr(n,e,t){return(e=Bp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bp(n){var e=Up(n,"string");return typeof e=="symbol"?e:e+""}function Up(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eu{constructor(e,t,r){yr(this,"_element",D(window)),yr(this,"_itemConfig",void 0),yr(this,"_layoutManager",void 0),yr(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 ar(this._element,this._layoutManager.root,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(D.extend(!0,{},r));new wn(e,t,this._dragListener,this._layoutManager,i,null)}}}function tu(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=Vp(n,"string");return typeof e=="symbol"?e:e+""}function Vp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sr{constructor(){tu(this,"element",D(sr._template)),D(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}tu(sr,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ui(n,e,t){return(e=Kp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kp(n){var e=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)}class zn{constructor(e,t,r,i){ui(this,"element",void 0),ui(this,"_header",void 0),ui(this,"_action",void 0),this._header=e,this.element=D('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function Gp(n,e,t){return(e=qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qp(n){var e=Xp(n,"string");return typeof e=="symbol"?e:e+""}function Xp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mn extends Error{constructor(e,t){super(),Gp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Zp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:mn},Symbol.toStringTag,{value:"Module"}));function Te(n,e,t){return(e=Yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yp(n){var e=Qp(n,"string");return typeof e=="symbol"?e:e+""}function Qp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vn(n){return n.isStack}function Ae(n){return n.isComponent}function nu(n){return n.isRoot}class Me extends Xe{constructor(e,t,r,i){super(),Te(this,"config",void 0),Te(this,"type",void 0),Te(this,"contentItems",void 0),Te(this,"parent",void 0),Te(this,"layoutManager",void 0),Te(this,"element",void 0),Te(this,"childElementContainer",void 0),Te(this,"componentName",void 0),Te(this,"isInitialised",!1),Te(this,"isMaximised",!1),Te(this,"isRoot",!1),Te(this,"isRow",!1),Te(this,"isColumn",!1),Te(this,"isStack",!1),Te(this,"isComponent",!1),Te(this,"tab",void 0),Te(this,"_pendingEventPropagations",void 0),Te(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Xe.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(r!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,vn(this)&&this.header.tabs[i].setContentItem(t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),r(o.contentItems[a])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&Ae(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new _i(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new mn("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(Wl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof _i&&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,Vi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Bn(n,e,t){return(e=Jp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jp(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 ru extends Me{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,u]=s;t[l]===void 0&&(t[l]=u)}),super(e,t,r,D()),Bn(this,"config",void 0),Bn(this,"componentName",void 0),Bn(this,"container",void 0),Bn(this,"parent",void 0),Bn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=D.extend(!0,{},this.config.componentState||{});if(o==null)throw new mn('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Pi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Me.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Me.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),Me.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Me.prototype._$destroy.call(this)}_$getArea(){return null}}function ut(n,e,t){return(e=tg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tg(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)}class er extends Me{constructor(e,t,r,i){super(t,r,i,D('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ut(this,"isRow",void 0),ut(this,"isColumn",void 0),ut(this,"childElementContainer",void 0),ut(this,"parent",void 0),ut(this,"_splitter",[]),ut(this,"_splitterSize",void 0),ut(this,"_splitterGrabSize",void 0),ut(this,"_isColumn",void 0),ut(this,"_dimension",void 0),ut(this,"_splitterPosition",null),ut(this,"_splitterMinPosition",null),ut(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),Me.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}if(Me.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(Me.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,c,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((c=this.contentItems[l].config.width)!==null&&c!==void 0?c:0)/100));a+=h,s.push(h)}var v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),c=0;c<this.contentItems.length;c++){this.contentItems[c];var h=u.itemSizes[c];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},r.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<r.length;f++){l=r[f];var p=Math.round((l.width-t)*v);a-=p,l.width-=p}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new iu(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,c=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),h=this._isColumn?c.vertical:c.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(h||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,c=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=c*h,s.after.config[this._dimension]=(1-c)*h,e.element.css({top:0,left:0}),Vi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(t),!0).forEach(function(r){Oi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Oi(n,e,t){return(e=rg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rg(n){var e=ig(n,"string");return typeof e=="symbol"?e:e+""}function ig(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 xi extends Me{constructor(e,t,r){super(e,xa(xa({},t),{},{type:"root"}),null,D('<div class="lm_goldenlayout lm_item lm_root"></div>')),Oi(this,"childElementContainer",void 0),Oi(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(Ae(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof er)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var c,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((c=h.config[a])!==null&&c!==void 0?c:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}function Ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(r){tt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function tt(n,e,t){return(e=og(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function og(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 Ii extends Me{constructor(e,t,r){var i,o,a,s,l,u,c,h,v;super(e,t,r,D('<div class="lm_item lm_stack"></div>')),tt(this,"_activeContentItem",null),tt(this,"_header",void 0),tt(this,"childElementContainer",D('<div class="lm_items"></div>')),tt(this,"header",void 0),tt(this,"parent",void 0),tt(this,"isStack",!0),tt(this,"_dropSegment",null),tt(this,"_contentAreaDimensions",null),tt(this,"_dropIndex",void 0),tt(this,"_side",void 0),tt(this,"_sided",!1),tt(this,"config",void 0),this.parent=r,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(c=f.labels)===null||c===void 0?void 0:c.close:void 0,minimise:(h=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=Tn(Tn({},this._header),f.header)),t.header&&(this._header=Tn(Tn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Tn(Tn({},this._header),t.content[0].header)),this.header=new Rt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),Ae(e)?e._$show(t):e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Me.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 er&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Ae(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,c=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?c:c+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var h,v=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,a,s,l,u,c,h,v,f,p,g,b,w,E=this.header.tabs.length;if(E===0){var P,R,Z,re,Y,k,B,Q,G=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(R=G==null?void 0:G.left)!==null&&R!==void 0?R:0,x2:((Z=G==null?void 0:G.left)!==null&&Z!==void 0?Z:0)+100,y1:(re=(Y=this.header.element.offset())===null||Y===void 0?void 0:Y.top)!==null&&re!==void 0?re:0,y2:((k=(B=this.header.element.offset())===null||B===void 0?void 0:B.top)!==null&&k!==void 0?k:0)+((Q=this.header.element.innerHeight())!==null&&Q!==void 0?Q:0)});return}var L=this.header.tabsContainer,W=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),X=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!W||!X)){e<W.left?e=W.left+1:e>W.right&&(e=W.right-1);var F,V;if(!(X.left<e&&e<X.right)){for(var K=0;K<E;K++){var pe;if(F=this.header.tabs[K].element,V=(pe=F.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=K;break}}if(F&&V&&e<V.left+V.width*.5)F.before(this.layoutManager.tabDropPlaceholder);else if(F){var ke;this._dropIndex=Math.min(((ke=this._dropIndex)!==null&&ke!==void 0?ke:0)+1,E),F.after(this.layoutManager.tabDropPlaceholder)}}var j=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;j=Math.max(j,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var C=j+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);C=Math.min(C,((u=(c=this.header.tabsContainer.offset())===null||c===void 0?void 0:c.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:j,x2:C,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}this._dropSegment=e}}const sg=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Me,Component:ru,ContentItem:Me,Root:xi,RowOrColumn:er,Stack:Ii,isComponent:Ae,isRoot:nu,isStack:vn},Symbol.toStringTag,{value:"Module"}));function jt(n,e,t){return(e=lg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lg(n){var e=ug(n,"string");return typeof e=="symbol"?e:e+""}function ug(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class lr{constructor(e,t){var r;jt(this,"header",void 0),jt(this,"contentItem",void 0),jt(this,"element",D(lr._template)),jt(this,"titleElement",void 0),jt(this,"closeElement",void 0),jt(this,"isActive",!1),jt(this,"_layoutManager",void 0),jt(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new ar(this.element,this._layoutManager.root),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.element.on("mouseup",this._onMouseUp),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Ae(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.text(e)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Ae(this.contentItem)&&this.contentItem.container._contentElement.off(),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new wn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){Ae(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(D(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){Ae(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&Ae(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ae(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),Ae(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),Ae(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}_isInNestedLayout(e){var t=D(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!Ae(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}jt(lr,"_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 le(n,e,t){return(e=dg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dg(n){var e=cg(n,"string");return typeof e=="symbol"?e:e+""}function cg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rt extends Xe{constructor(e,t){var r,i;super(),le(this,"layoutManager",void 0),le(this,"element",D(Rt._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",D(Rt._nextButtonTemplate)),le(this,"tabPreviousButton",D(Rt._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(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 lr(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,c;l.scrollLeft=(u=(c=this.tabsContainer.get(0))===null||c===void 0?void 0:c.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(c=>{var h,v,f=o||c,p=c-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(h=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),D(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new zn(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 zn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new zn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new zn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),D(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),D(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var c=(s+l+u.length)%u.length;c!==s;){if(u.eq(c).css("display")!=="none")return c;c=(c+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),D(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=D(window).height())!==null&&r!==void 0?r:0,l=(i=D(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),c=o<s-u.bottom,h=!c&&u.bottom>s*.6,v=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}le(Rt,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));le(Rt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(Rt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Un(n,e,t){return(e=hg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hg(n){var e=mg(n,"string");return typeof e=="symbol"?e:e+""}function mg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class iu{constructor(e,t,r){Un(this,"_isVertical",void 0),Un(this,"_size",void 0),Un(this,"_grabSize",void 0),Un(this,"_dragListener",void 0),Un(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new ar(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=D('<div class="lm_drag_handle"></div>'),t=D('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const vg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Ql,DragProxy:wn,DragSource:Jl,DragSourceFromEvent:eu,DropTargetIndicator:sr,Header:Rt,HeaderButton:zn,Splitter:iu,Tab:lr},Symbol.toStringTag,{value:"Module"}));var fg={config:fp,container:Cp,controls:vg,errors:Zp,items:sg,utils:jp};function Da(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Qe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Da(Object(t),!0).forEach(function(r){ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Da(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ue(n,e,t){return(e=pg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pg(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 Ma=["column","row","stack","component"];class zr extends Xe{static isLayoutItemConfig(e){return Ma.includes(e.type)}static minifyConfig(e){return zi(e)}static unminifyConfig(e){return Ti(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":zl}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",D('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"_initialHeaderHeight",void 0),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Gl(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",D('<div class="lm_drop_tab_placeholder"></div>')),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&D("body").css("visibility","hidden")}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof Me))throw new Error("Root must be a ContentItem");var t={settings:Qe({},this.config.settings),dimensions:Qe({},this.config.dimensions),labels:Qe({},this.config.labels),content:[]},r=function(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var u=0;u<s.contentItems.length;u++)a.content[u]={},r(a.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){D(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new sr,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),D(window).off("resize",this._onResize),D(window).off("unload beforeunload",this._onUnload),D(window).off("blur.lm").off("focus.lm"),D(window).off("keydown",this._windowKeydown),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i;if(typeof e.type!="string")throw new mn("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!zr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Ma.join(","),new mn(i);return e.type==="component"&&!(t instanceof Ii)&&t&&!(this.isSubWindow===!0&&t instanceof xi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Ar(),e.type==="stack"?new Ii(this,e,t):e.type==="row"?new er(!1,this,e,t):e.type==="column"?new er(!0,this,e,t):new ru(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof Me,s=this;if(a){var l;o=this.toConfig(e).content,r=Ar();for(var u=e.parent,c=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;c=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var v;i=(v=u)===null||v===void 0?void 0:v.contentItems.indexOf(c)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,E=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+E.left,top:w+E.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var P=new Ql(o,t,r,i,this);return P.on("initialised",function(){s.emit("windowOpened",P)}),P.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Jl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new eu(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Qe({},this.root._$getArea()),r=[Qe(Qe({},t),{},{side:"left",x2:t.x1+e}),Qe(Qe({},t),{},{side:"right",x1:t.x2-e}),Qe(Qe({},t),{},{side:"top",y2:t.y1+e}),Qe(Qe({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var r=e[t];if(vn(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Qe(Qe({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof Me)return e;if(D.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&D(window).resize(this._onResize),D(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Kl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Ti(e),localStorage.removeItem(r));var i=D.extend(!0,{},Bl,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=D('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Ki((e=this.config.content[0].title)!==null&&e!==void 0?e:""),D("head").append(D("body link, body style, template, .gl_keep")),this.container=D("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?D(this._originalContainer):D("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,D("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new mn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new mn(t,e);this.root=new xi(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var u=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{vn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ue(zr,"__lm",fg);const Na={"tab-height":"28px","drag-border-width":"5px"},ka=Object.freeze({tabHeight:parseInt(Na["tab-height"],10),dragBorderWidth:parseInt(Na["drag-border-width"],10)});function ja(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(r){ou(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ou(n,e,t){return(e=bg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bg(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 Wt=U.module("LayoutUtils");function au(n){return n.componentName!==void 0}function qt(n){var e=n;return(au(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Cr(n){return n.focus!==void 0}function La(n){return n.type==="stack"}class x{static activateTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r){Wt.error("Could not find stack for config",t);return}var i=x.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return Wt.error("Could not find stack for config",t),!1;var i=x.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(nu(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,c,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(c=s.config)===null||c===void 0?void 0:c.width},e);e.replaceChild(s,h),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(r=>r.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=x.getAllStackContainers(e),r=x.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&vn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(vn(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var r;if(((r=e.config)===null||r===void 0?void 0:r.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&vn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&io(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&r&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,u=x.getStackForRoot(e,{component:s},r&&l,i,o);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&io(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i],{content:a}=o;if(qt(o)){var s=t(o.component,o);s!=null?r.push(s):Wt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=kt(kt({},o),{},{content:x.dehydrateLayoutConfig(a,t)});r.push(l)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(La(r)&&delete r.activeItemIndex,x.dropLayoutMinorChange(i)):qt(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=x.cloneLayout(e),o=x.cloneLayout(t);return r?(x.dropLayoutMinorChange(i),x.dropLayoutMinorChange(o),Yn(i,o)):Yn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i];if(qt(o)){var a,{component:s,props:l={}}=o;r.push(kt(kt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:_t(),props:t(s,l)}))}else if(o.content!==void 0){var u=x.hydrateLayoutConfig(o.content,t);La(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(Wt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(kt(kt({},o),{},{content:u}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,c=kt({},t);if(c.id==null&&(c.id=_t()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(c,l);return}var h=o||{id:c.id,component:c.component};A(e);var v=r??(a?x.addStack(e):x.getStackForRoot(e,h));A(v);var f=x.getContentItemInStack(v,h);if(s!=null){var p=b=>{Wt.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:w}=b.origin;requestAnimationFrame(()=>{x.focusElement(w[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(c,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(c);s==null&&u&&Cr(u)&&u.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=x.getContentItemInStack(e,o);if(r&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&Cr(i)&&i.focus()}static closeComponent(e,t,r){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){Wt.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(Ae(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&Cr(a)&&a.focus()}static renameComponent(e,t,r){var i=x.getStackForRoot(e,t,!1);if(!i){Wt.error("Could not find stack for config",t);return}var o=x.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return Wt.error("Could not find stack for config",t),null;var{props:i={}}=t,o=x.getPanelComponentState(t),a={type:"react-component",component:t.component,props:kt(kt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:_t()};return x.openComponentInStack(r,a),a}static getPanelComponentState(e){if(au(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(qt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ka.tabHeight,borderWidth:ka.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=x.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return x.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=x.getComponentConfigFromContainer(t);if(r&&qt(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Cr(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)})}}ou(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Cg=$.forwardRef((n,e)=>{var t=x.getComponentNameFromPanel({props:n});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Cg.displayName="PanelPlaceholder";var ae=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:r0,emit:Sg,useListener:i0}=Dt(ae.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:wg,emit:o0,useListener:a0}=Dt(Gr.CYCLE_TO_NEXT_STACK),{listen:Eg,emit:s0,useListener:l0}=Dt(Gr.CYCLE_TO_PREVIOUS_STACK),{listen:Pg,emit:u0,useListener:d0}=Dt(Gr.CYCLE_TO_NEXT_TAB),{listen:Tg,emit:c0,useListener:h0}=Dt(Gr.CYCLE_TO_PREVIOUS_TAB);function _g(n){return typeof n.id=="string"&&n.layout instanceof zr&&n.panelManager instanceof qi&&typeof n.registerComponent=="function"}function Og(n){if(!_g(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function Aa(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 Ra(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Aa(Object(t),!0).forEach(function(r){At(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function At(n,e,t){return(e=xg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xg(n){var e=Ig(n,"string");return typeof e=="symbol"?e:e+""}function Ig(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 dt=U.module("PanelManager"),dn=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}(dn||{});class qi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};At(this,"layout",void 0),At(this,"hydrateComponent",void 0),At(this,"dehydrateComponent",void 0),At(this,"onPanelsUpdated",void 0),At(this,"closed",void 0),At(this,"openedMap",void 0),At(this,"navigationEventListenerRemovers",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ae.FOCUS,this.handleFocus),e.on(ae.MOUNT,this.handleMount),e.on(ae.UNMOUNT,this.handleUnmount),e.on(ae.REOPEN,this.handleReopen),e.on(ae.REOPEN_LAST,this.handleReopenLast),e.on(ae.DELETE,this.handleDeleted),e.on(ae.CLOSED,this.handleClosed),e.on(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(wg(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Eg(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(Pg(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Tg(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(ae.FOCUS,this.handleFocus),e.off(ae.MOUNT,this.handleMount),e.off(ae.UNMOUNT,this.handleUnmount),e.off(ae.REOPEN,this.handleReopen),e.off(ae.REOPEN_LAST,this.handleReopenLast),e.off(ae.DELETE,this.handleDeleted),e.off(ae.CLOSED,this.handleClosed),e.off(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return x.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&qt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=x.getStackForConfig(this.layout.root,{id:e});return(t=r&&x.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>Mr(r)&&t instanceof r.WrappedComponent||!Mr(r)&&t instanceof r))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){dt.error("updatePanel Panel did not have an ID",e);return}dt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=x.getIdFromPanel(e);if(t==null){dt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){dt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){dt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}dt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){dt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){dt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){dt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=x.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=x.getFocusedStackIndex(t);if(r===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===dn.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,c=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(c,!0)}}handleCycleToNextStack(){this.cycleStack(dn.Next)}handleCycleToPreviousStack(){this.cycleStack(dn.Previous)}cycleTab(e){var t,r=x.getFocusedStack(this.layout);if(r!==void 0){var{contentItems:i}=r;if(!(i.length<=1)){var o=(t=r.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===dn.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];r.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(dn.Next)}handleCycleToPreviousTab(){this.cycleTab(dn.Previous)}handleReopen(e,t){dt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=Ra(Ra({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:x.getStackById(a,e.parentStackId);x.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=x.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){dt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){dt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;x.closeComponent(r,t)}addClosedPanel(e){var t=x.getComponentConfigFromContainer(e);if(t&&qt(t)){var r=this.dehydrateComponent(t.component,t);if(r!=null){var i;r.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(r)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}At(qi,"MAX_CLOSED_PANEL_COUNT",100);var Dg=U.module("PanelErrorBoundary");class Mg extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=x.getIdFromContainer(e);Dg.debug("componentWillUnmount",r),t.emit(ae.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(bn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function Fa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fa(Object(t),!0).forEach(function(r){Ng(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ng(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=jg(n,"string");return typeof e=="symbol"?e:e+""}function jg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 su(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),Fr(Fr({},n),{},{componentState:null,props:o,type:"react-component"})}function lu(n,e){return Fr(Fr({},n),{},{localDashboardId:e})}const Lg={dehydrate:su,hydrate:lu};var uu=$.createContext(void 0);uu.displayName="LayoutManagerContext";var Ag=ye.shape({on:ye.func,off:ye.func,isHidden:ye.bool,tab:ye.shape({header:ye.shape({tabs:ye.arrayOf(ye.shape({contentItem:ye.shape({})}))})}),title:ye.string,setTitle:ye.func,close:ye.func}),du=ye.shape({on:ye.func,off:ye.func,emit:ye.func}),Rg=ye.shape({registerComponent:ye.func,root:ye.shape({addChild:ye.func}),on:ye.func,off:ye.func,eventHub:du}),m0=Object.freeze({Container:Ag,EventHub:du,Layout:Rg});function Wn(n,e,t,r){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");$.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}function Le(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var cu="SET_DASHBOARD_DATA";const Fg=Om(cu,{},!1),$g={dashboardData:Fg};var Hg=new Map,hu=Object.freeze({}),Bg=Object.freeze([]),v0=Li,Ug=Cs,f0=Ku,Wg=n=>n.dashboardData,$e=(n,e)=>{var t;return(t=Wg(n)[e])!==null&&t!==void 0?t:hu},p0=(n,e)=>{var t;return(t=$e(n,e).closed)!==null&&t!==void 0?t:Bg},g0=(n,e)=>{var t;return(t=$e(n,e).openedMap)!==null&&t!==void 0?t:Hg},mu=(n,e)=>{var t;return(t=$e(n,e).pluginDataMap)!==null&&t!==void 0?t:hu},b0=(n,e,t)=>mu(n,e)[t];function $a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Dn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$a(Object(t),!0).forEach(function(r){Vg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Vg(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=zg(n,"string");return typeof e=="symbol"?e:e+""}function zg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 vu=(n,e)=>({type:cu,id:n,payload:e}),nn=(n,e)=>(t,r)=>t(vu(n,Dn(Dn({},$e(r(),n)),e))),y0=(n,e,t)=>(r,i)=>r(vu(n,Dn(Dn({},$e(i(),n)),{},{pluginDataMap:Dn(Dn({},mu(i(),n)),{},{[e]:t})})));Object.entries($g).map(n=>{var[e,t]=n;return Dd.register(e,t)});var fu=m.createContext(null);fu.displayName="PersistentStateContext";function Sr(n,e){return"".concat(n,"::").concat(e)}function Gg(n){var{initialState:e,onChange:t,children:r}=n,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),[a]=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=m.useRef(new Map),l=m.useCallback((p,g,b)=>{var{type:w}=b,E=Sr(g,w),P=s.current.get(E);if(P!=null&&P!==p)throw new Error("Detected multiple persistent states of type ".concat(w," for dhId ").concat(g,". Only one state per (dhId, type) pair is allowed."));s.current.set(E,p),i.current&&a.get(E)!==b&&(a.set(E,b),t([...a.entries()]))},[i,t,a]),u=m.useRef(e[Symbol.iterator]()),c=m.useCallback((p,g)=>{var b=Sr(p,g),w=a.get(b);if(w==null&&o.current){var{value:E}=u.current.next(),P=E;return a.set(b,P),P}return w},[a]),h=m.useCallback((p,g,b)=>{var w=Sr(g,b),E=s.current.get(w);E===p&&(a.delete(w),s.current.delete(w),i.current&&t([...a.entries()]))},[i,t,a]),v=m.useCallback((p,g,b)=>{var w=Sr(g,b),E=s.current.get(w);E===p&&s.current.delete(w)},[]),f=m.useMemo(()=>({addState:l,removeState:h,deregisterHook:v,getState:c}),[l,c,h,v]);return d.jsx(fu.Provider,{value:f,children:r})}var qg=U.module("DashboardPanelWrapper");function Xg(n){var{glContainer:e,children:t}=n,r=m.useCallback(a=>{e.setPersistedState(a)},[e]),{persistedState:i}=e.getConfig(),[o]=m.useState(()=>i!=null&&!Array.isArray(i)?(qg.warn("Persisted state is type ".concat(typeof i,". Expected array. Setting to empty array.")),[]):i??[]);return d.jsx(Gg,{initialState:o,onChange:r,children:t})}var Xi=m.createContext(null);Xi.displayName="PanelIdContext";function Zg(){return m.useContext(Xi)}function Ha(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function an(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ha(Object(t),!0).forEach(function(r){Yg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yg(n,e,t){return(e=Qg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qg(n){var e=Jg(n,"string");return typeof e=="symbol"?e:e+""}function Jg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _n=U.module("DashboardLayout"),eb=Object.freeze({}),tb=[],Ba=()=>{},nb=1e3,Ua=n=>n;function C0(n){var e,t,{id:r,children:i,emptyDashboard:o=d.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}),layout:a,layoutConfig:s=tb,onLayoutChange:l=Ba,onLayoutInitialized:u=Ba,hydrate:c=lu,dehydrate:h=su,panelWrapper:v}=n,f=Li(),p=(e=Cs(j=>$e(j,r)))!==null&&e!==void 0?e:eb,[g,b]=m.useState(!1),[w,E]=m.useState(!1),P=m.useRef(),[R]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[Z,re]=m.useState(a.getReactChildren()),Y=m.useMemo(()=>new Map,[]),k=m.useMemo(()=>new Map,[]),B=m.useCallback(function(j,C){var S,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:c,z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:h;_n.debug2("registerComponent",j,C,N,z);function ie(O,J){var oe=C,fe=v,He=ol(oe),St=He?d.jsx(oe,an(an({},O),{},{ref:J})):d.jsx(oe,an({},O)),{glContainer:wt,glEventHub:ei}=O,Hn=x.getIdFromContainer(wt);return d.jsx(Mg,{glContainer:wt,glEventHub:ei,children:d.jsx(Xi.Provider,{value:Hn,children:d.jsx(Xg,an(an({},O),{},{children:fe==null?St:d.jsx(fe,an(an({},O),{},{children:St}))}))})})}ie.displayName="DashboardWrapper(".concat((S=C.displayName)!==null&&S!==void 0?S:j,")");var ht=a.registerComponent(j,$.forwardRef(ie));return Y.set(j,N),k.set(j,z),ht},[c,h,Y,k,a,v]),Q=m.useCallback((j,C)=>{var S;return((S=Y.get(j))!==null&&S!==void 0?S:Ua)(C,r)},[Y,r]),G=m.useCallback((j,C)=>{var S;return((S=k.get(j))!==null&&S!==void 0?S:Ua)(C,r)},[k,r]),L=m.useMemo(()=>new qi(a,Q,G,new Map,R,j=>{var{closed:C,openedMap:S}=j;f(nn(r,{closed:C,openedMap:S}))}),[G,f,Q,r,R,a]),W=Dc(j=>{var C=P.current,S=C==null||!x.isEqual(C,j);_n.debug("handleLayoutStateChanged",S,j),S&&(_n.debug("Layout config has changed","lastConfig",C,"dehydratedLayoutConfig",j),b(a.root.contentItems.length===0),P.current=j,l(j),re(a.getReactChildren()))},nb,{flushOnUnmount:!0});m.useEffect(()=>()=>W.flush(),[W]);var X=m.useCallback(()=>{if(!w){var j=a.toConfig(),C=j.content,S=x.dehydrateLayoutConfig(C,G);W(S)}},[G,w,a,W]),F=m.useCallback(j=>{var C=x.getIdFromContainer(j);a.eventHub.emit(ae.DRAGGING,C),E(!0)},[a.eventHub]),V=m.useCallback(j=>{var C=x.getIdFromContainer(j);a.eventHub.emit(ae.DROPPED,C),E(!1)},[a.eventHub]),K=m.useCallback(j=>{if(_n.debug2("handleComponentCreated",j),!(j==null||j.config==null||!qt(j.config)||j.config.component==null||j.element==null)){var C=j.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),S="".concat(C,"-component");j.element.addClass(S)}},[]),pe=m.useCallback(()=>{re(a.getReactChildren())},[a]);Le(a,"stateChanged",X),Le(a,"itemPickedUp",F),Le(a,"itemDropped",V),Le(a,"componentCreated",K),Le(a.eventHub,ae.TITLE_CHANGED,X),Le(a,"reactChildrenChanged",pe);var ke=Ic(s);return m.useEffect(function(){if(ke!==s&&s!==P.current){_n.debug("loadNewConfig effect triggered. previousLayoutConfig",ke,"layoutConfig",s,"lastConfig",P.current),_n.debug("Setting new layout content...");for(var C=x.hydrateLayoutConfig(s,Q);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var S=0;S<C.length;S+=1)a.root.addChild(C[S]);b(a.root.contentItems.length===0)}},[Q,a,s,L,ke]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,Z,$.Children.map(i,j=>j!=null?d.jsx(zh,{fallback:[],children:$.cloneElement(j,{id:r,layout:a,panelManager:L,registerComponent:B})}):null)]})}var pu=m.createContext(null);pu.displayName="DashboardIdContext";function S0(){var n=m.useContext(pu);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function rb(n,e,t){return(e=ib(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ib(n){var e=ob(n,"string");return typeof e=="symbol"?e:e+""}function ob(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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,t){if(n){if(t(n)===!0)return n;for(var r=n.child;r;){var i=gu(r,e,t);if(i)return i;r=r.sibling}}}function ab(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var Zi=ab(m.createContext(null));Zi.displayName="FiberContext";class w0 extends m.Component{constructor(){super(...arguments),rb(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return d.jsx(Zi.Provider,{value:this._reactInternals,children:e})}}function sb(){var n=m.useContext(Zi);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>_t()),t=m.useMemo(()=>{for(var r of[n,n==null?void 0:n.alternate].filter(o=>o!=null)){var i=gu(r,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[n,e]);return t}var E0="default",lb="CREATE_DASHBOARD",ub="CLOSE_DASHBOARD",{listen:P0,emit:T0,useListener:_0}=Dt(lb),{listen:O0,emit:db,useListener:x0}=Dt(ub);function cb(n,e,t){return(e=hb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hb(n){var e=mb(n,"string");return typeof e=="symbol"?e:e+""}function mb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 bu extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,{glContainer:r}=this.props;return[...(e=r==null||(t=r.tab)===null||t===void 0||(t=t.header)===null||t===void 0?void 0:t.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t==null?void 0:t.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s;if(((i=t[r].contentItem)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.id)===((o=e.tab)===null||o===void 0||(o=o.contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id))break;(a=((s=t[r])===null||s===void 0?void 0:s.contentItem).container)===null||a===void 0||a.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(ae.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s;if(((o=t[i].contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(a=a.contentItem)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.id))break;var l=!!(!((s=t[i])===null||s===void 0||(s=s.contentItem)===null||s===void 0||(s=s.config)===null||s===void 0)&&s.isClosable);if(l){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o=!!(!((i=e[r])===null||i===void 0||(i=i.contentItem)===null||i===void 0||(i=i.config)===null||i===void 0)&&i.isClosable);if(o){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=x.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,{additionalActions:t,glContainer:r}=this.props,i=[...t];i.push(()=>({title:"Re-open closed panel",group:ne.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var o=(e=r.tab)===null||e===void 0||(e=e.contentItem)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.isClosable;return i.push({title:"Close",order:10,group:ne.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),i.push(()=>({title:"Close Tabs to Right",order:20,group:ne.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),i.push(()=>({title:"Close All",order:30,group:ne.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(ne,{actions:i})}}cb(bu,"defaultProps",{additionalActions:[]});var vb=n=>({workspace:yl(n)}),fb=Fn(vb,{setWorkspace:Sl})(bu);function yu(n,e,t){return(e=pb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pb(n){var e=gb(n,"string");return typeof e=="symbol"?e:e+""}function gb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cu extends m.PureComponent{constructor(e){super(e),yu(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=$.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t==null?void 0:t.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return d.jsxs("form",{className:q("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[d.jsxs("div",{className:"form-group",children:[d.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),d.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),d.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Ur,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}yu(Cu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var wr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Wa(n,e,t){return(e=bb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bb(n){var e=yb(n,"string");return typeof e=="symbol"?e:e+""}function yb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Cb=U.module("Panel");class Sb extends m.PureComponent{constructor(e){super(e),Wa(this,"ref",void 0),Wa(this,"getAdditionalActions",Qt((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=$.createRef();var{glContainer:t}=this.props;this.state={title:x.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(wr.focus,this.handleTabFocus),i.on(wr.blur,this.handleTabBlur),i.emit(ae.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(wr.focus,this.handleTabFocus),r.off(wr.blur,this.handleTabBlur),r.emit(ae.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:x.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(ae.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=x.getRootFromContainer(t),i=x.getComponentConfigFromContainer(t);A(i),x.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=x.getRootFromContainer(e),i=x.getComponentConfigFromContainer(e);if(i==null){Cb.error("Could not get component config from container",e);return}var o=x.cloneComponent(r,i);o!==null&&t.emit(ae.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ne.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ne.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a=Hs,errorMessage:s,isLoaded:l=!0,isLoading:u=!1,isClonable:c=!1,isRenamable:h=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:q("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(bn,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:u}),!g&&v!=null&&Br.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(fb,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,c,h)}),h&&d.jsx(Cu,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&d.jsx(he,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),v.element[0])]})}}var wb=hl(Sb),Eb=U.module("useDhId"),di="__dhId";function I0(){var n,e,t=(n=(e=sb())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[di],i=Zg();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(di," to be a string, but got ").concat(typeof r));return r}return i??(Eb.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(di," prop. Defaulting to null.")),null)}function ur(n,e,t){return(e=Pb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pb(n){var e=Tb(n,"string");return typeof e=="symbol"?e:e+""}function Tb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Ge{}ur(Ge,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");ur(Ge,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");ur(Ge,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");ur(Ge,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");ur(Ge,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function rn(n,e,t){return(e=_b(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _b(n){var e=Ob(n,"string");return typeof e=="symbol"?e:e+""}function Ob(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 xt{}rn(xt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");rn(xt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");rn(xt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");rn(xt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");rn(xt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");rn(xt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");rn(xt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");rn(xt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const D0=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function $t(n,e,t){return(e=xb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xb(n){var e=Ib(n,"string");return typeof e=="symbol"?e:e+""}function Ib(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class te{}$t(te,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");$t(te,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");$t(te,"CLOSE_FILE","NotebookEvent.closeFile");$t(te,"RENAME","NotebookEvent.rename");$t(te,"RENAME_FILE","NotebookEvent.renameFile");$t(te,"REGISTER_FILE","NotebookEvent.registerFile");$t(te,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");$t(te,"UNREGISTER_FILE","NotebookEvent.unregisterFile");$t(te,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Yi=Dt(Ge.SESSION_OPENED),Db=Yi.listen,M0=Yi.emit,N0=Yi.useListener,Qi=Dt(Ge.SESSION_CLOSED),Mb=Qi.listen,k0=Qi.emit,j0=Qi.useListener,Nb=["children"];function Va(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 Ka(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Va(Object(t),!0).forEach(function(r){Di(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Va(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function kb(n,e){if(n==null)return{};var t,r,i=jb(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 jb(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 Di(n,e,t){return(e=Lb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lb(n){var e=Ab(n,"string");return typeof e=="symbol"?e:e+""}function Ab(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Rb extends m.PureComponent{constructor(e){super(e),Di(this,"stopListenForSessionClosed",void 0),Di(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=Mb(e,this.handleSessionClosed),this.stopListenForSessionOpened=Db(e,this.handleSessionOpened),e.on(xt.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(xt.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=kb(e,Nb);return d.jsx(wb,Ka(Ka({},r),{},{children:t}))}}var dr=hl(Rb);const L0=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Fb=Object.freeze({}),$b=new Map,qr=Object.freeze([]),A0=(n,e)=>{var t;return(t=$e(n,e).columns)!==null&&t!==void 0?t:qr},R0=(n,e)=>{var t;return(t=$e(n,e).filterSets)!==null&&t!==void 0?t:qr},F0=(n,e)=>{var t;return(t=$e(n,e).filters)!==null&&t!==void 0?t:qr},$0=(n,e)=>{var t;return(t=$e(n,e).tableMap)!==null&&t!==void 0?t:$b},H0=(n,e)=>$e(n,e).isolatedLinkerPanelId,Su=(n,e)=>{var t;return(t=$e(n,e).links)!==null&&t!==void 0?t:qr},B0=(n,e)=>$e(n,e).columnSelectionValidator,U0=(n,e)=>{var t;return(t=$e(n,e).consoleSettings)!==null&&t!==void 0?t:Fb},W0=(n,e)=>$e(n,e).connection,cr=(n,e)=>$e(n,e).sessionWrapper,V0=(n,e)=>t=>t(nn(n,{connection:e})),K0=(n,e)=>t=>t(nn(n,{sessionWrapper:e})),wu=(n,e)=>t=>t(nn(n,{links:e})),z0=(n,e)=>(t,r)=>{var i=Su(r(),n),o=e.filter(a=>i.findIndex(s=>Yn(s.start,a.start)&&Yn(s.end,a.end))<0);return t(wu(n,i.concat(o)))},G0=(n,e)=>(t,r)=>{var i=Su(r(),n),o=i.filter(a=>!e.includes(a.id));return t(wu(n,o))},q0=(n,e)=>t=>t(nn(n,{isolatedLinkerPanelId:e})),X0=(n,e)=>t=>t(nn(n,{columnSelectionValidator:e})),Hb=(n,e)=>t=>t(nn(n,{consoleSettings:e})),Z0=(n,e)=>t=>t(nn(n,{filterSets:e}));function $r(n,e,t){return(e=Bb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bb(n){var e=Ub(n,"string");return typeof e=="symbol"?e:e+""}function Ub(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Er=U.module("CommandHistoryPanel");class hr extends m.Component{static handleError(e){Er.error(e)}constructor(e){super(e),$r(this,"container",void 0),$r(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=$.createRef(),this.pending=new nr;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Ve.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Ge.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ge.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(Er.debug("handleSendToNotebook",r,e),!r){Er.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?te.CREATE_NOTEBOOK:te.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Er.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Ge.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;A(t),A(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(hr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return d.jsxs(dr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&d.jsxs(d.Fragment,{children:[d.jsx(We,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),d.jsx(ne,{actions:o})]})]})}}$r(hr,"COMPONENT","CommandHistoryPanel");$r(hr,"TITLE","Command History");var Wb=(n,e)=>{var t=gl(n),r=cr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Vb=Fn(Wb,null,null,{forwardRef:!0})(hr),Eu=m.createContext(null);Eu.displayName="PluginsContext";var on=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",ELEMENT_PLUGIN:"ElementPlugin",MIDDLEWARE_PLUGIN:"MiddlewarePlugin",MULTI_PLUGIN:"MultiPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",WIDGET_PLUGIN:"WidgetPlugin"});function Kb(n){return"DashboardPlugin"in n}function zb(n){return"AuthPlugin"in n}function Gb(n){return"TablePlugin"in n}function qb(n){return Kb(n)||zb(n)||Gb(n)}function Xb(n){return"type"in n&&n.type===on.DASHBOARD_PLUGIN}function Mi(n){return"type"in n&&n.type===on.MIDDLEWARE_PLUGIN}function Xr(n){return"type"in n&&n.type===on.WIDGET_PLUGIN}function Zb(n){return"type"in n&&n.type===on.TABLE_PLUGIN}function Yb(n){return"type"in n&&n.type===on.AUTH_PLUGIN}function Pu(n){return"type"in n&&n.type===on.THEME_PLUGIN}function Tu(n){return"type"in n&&n.type===on.ELEMENT_PLUGIN}function _u(n){return"type"in n&&n.type===on.MULTI_PLUGIN}function Ni(n){return Xb(n)||Yb(n)||Tu(n)||_u(n)||Zb(n)||Pu(n)||Xr(n)||Mi(n)}var Qb=["metadata"],Jb=["metadata"];function za(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?za(Object(t),!0).forEach(function(r){ey(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):za(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ey(n,e,t){return(e=ty(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ty(n){var e=ny(n,"string");return typeof e=="symbol"?e:e+""}function ny(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Ou(n,e){if(n==null)return{};var t,r,i=ry(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 ry(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 at=U.module("@deephaven/plugin.PluginUtils");function Nn(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 Ga(n,e){return n==null||!Xr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function iy(n){var e=d.jsx(ve,{icon:Is});if(!Xr(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:d.jsx(ve,{icon:t})}function Y0(n){var e=[...n.entries()].filter(t=>Pu(t[1]));return at.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:u}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Md(r,s),name:s,styleContent:u}})}).flat()}function Q0(n){var e=[...n.entries()].filter(t=>Tu(t[1])&&t[1].mapping!=null);return at.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,r]=t;return Object.entries(r.mapping)}))}function oy(n,e){return e.length===0?(at.debug("No middleware to chain for component",Nn(n)),n):(at.debug("Chaining component middleware",Nn(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function a(s){var{metadata:l}=s,u=Ou(s,Qb);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?d.jsx(t,Tt(Tt({},u),{},{metadata:l})):d.jsx(i,Tt(Tt({},u),{},{metadata:l,Component:t}))}return a.displayName="".concat(r.name,"(").concat(Nn(t),")"),a},n))}function J0(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(at.debug("No panel middleware to chain for panel component",Nn(n)),n):(at.debug("Chaining panel middleware",Nn(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var{panelComponent:o}=i,a=[i.supportedTypes].flat();function s(l){var{metadata:u}=l,c=Ou(l,Jb);return(u==null?void 0:u.type)!=null&&!a.includes(u.type)?d.jsx(r,Tt(Tt({},c),{},{metadata:u})):d.jsx(o,Tt(Tt({},c),{},{metadata:u,Component:r}))}return s.displayName="".concat(i.name,"Panel(").concat(Nn(r,"Panel"),")"),s},n))}function ay(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function sy(n){return Ni(n)?n:ay(n)&&Ni(n.default)?n.default:qb(n)?n:null}function qa(n,e,t,r){if(n.has(e)){at.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,Tt(Tt({},t),{},{version:r}))}function eS(n,e,t,r,i,o){i!=null&&(e[i]=t,at.debug("Registered plugin '".concat(i,"' in module resolve map")));var a=sy(t);if(a==null){at.error("Plugin '".concat(r,"' is missing an exported value."));return}_u(a)?(at.debug("MultiPlugin '".concat(r,"' contains ").concat(a.plugins.length," plugins")),a.plugins.forEach(s=>{if(!Ni(s)){at.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),s);return}var l=typeof s.name=="string"?s.name.trim():"";if(l.length===0){at.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),s);return}qa(n,l,s,o)})):qa(n,r,a,o)}function tS(n){var e=new Map;n.forEach((h,v)=>{h.package!=null&&e.set(h.package,v)});var t=new Map;if(n.forEach((h,v)=>{if(h.dependencies!=null&&h.dependencies.length>0){var f=[];h.dependencies.forEach(p=>{var g=e.get(p);g!=null?f.push(g):at.warn("Plugin '".concat(h.name,"' depends on '").concat(p,"' which is not in the manifest"))}),f.length>0&&t.set(v,f)}}),t.size===0)return[...n];var r=new Array(n.length).fill(0),i=new Map;t.forEach((h,v)=>{h.forEach(f=>{i.has(f)||i.set(f,[]);var p=i.get(f);p!=null&&p.push(v),r[v]+=1})});for(var o=[],a=0;a<n.length;a+=1)r[a]===0&&o.push(a);for(var s=[];o.length>0;){var l=o.shift();if(l==null)break;s.push(n[l]);var u=i.get(l);u!=null&&(u.sort((h,v)=>h-v),u.forEach(h=>{r[h]-=1,r[h]===0&&o.push(h)}))}if(s.length!==n.length){var c=n.filter((h,v)=>r[v]>0).map(h=>h.name);throw new Error("Circular plugin dependency detected among: ".concat(c.join(", ")))}return s}function ly(){return ir(Eu,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Xa=U.module("@deephaven/plugin.WidgetView");function nS(n){var{fetch:e,type:t}=n,r=ly(),{basePlugin:i,middleware:o}=m.useMemo(()=>{var s,l=[];return r.forEach(u=>{if(!(!Xr(u)&&!Mi(u))){var c=[u.supportedTypes].flat().includes(t);c&&(Mi(u)?l.push(u):(s!=null&&Xa.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(s.name," with ").concat(u.name)),s=u))}}),{basePlugin:s,middleware:l}},[r,t]),a=m.useMemo(()=>i==null?(Xa.debug("No base plugin found for widget type ".concat(t)),null):oy(i.component,o),[i,o,t]);if(a!=null)return d.jsx(a,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}function Za(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Pr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Za(Object(t),!0).forEach(function(r){fn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Za(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fn(n,e,t){return(e=uy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uy(n){var e=dy(n,"string");return typeof e=="symbol"?e:e+""}function dy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Tr=U.module("ConsolePanel"),cy=500,hy=Object.freeze({consoleSettings:{},itemIds:[]});class Zr extends m.PureComponent{constructor(e){super(e),fn(this,"consoleRef",void 0),fn(this,"objectSubscriptionCleanup",void 0),fn(this,"savePanelState",gn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Tr.debug("Saving panel state",l),this.setState({panelState:l})},cy)),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=$.createRef();var{panelState:t}=e,r=Pr(Pr({},hy),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(ae.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(ae.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=>{Tr.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,u=[...a,...l],c=new Map(o);u.forEach(v=>{var{title:f}=v;f!==void 0&&c.delete(f)});var h=[...a,...s];return h.forEach(v=>{v.title!==void 0&&c.set(v.title,v)}),{objectMap:c}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=_t(),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,a=e==null||(r=e.props)===null||r===void 0||(r=r.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Ge.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;A(this.context);var{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.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(ae.CLOSE,r),db(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Tr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ge.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;A(r);var{config:i,session:o}=r,{title:a=e.name}=e;A(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:Pr(Pr({},hm(e)),{},{sessionId:i.id})};Tr.debug("openWidget",l),Sg(t,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(ae.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>Ga(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Ga(i,e));return r!=null?iy(r):d.jsx(wl,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return d.jsx(bn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:u}=this.state,{config:c,session:h,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:w,type:E}=c;return d.jsx(dr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:h!=null&&d.jsx(Yt,{dh:p,ref:this.consoleRef,settings:s,session:h,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:E,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:Pl.LANGUAGE_MAP.get(E)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),b,d.jsx("div",{children:"•"})]}),d.jsx(mp,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:w,timeZone:o,objectMap:u,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}fn(Zr,"COMPONENT","ConsolePanel");fn(Zr,"TITLE","Console");fn(Zr,"contextType",uu);var my=(n,e)=>({commandHistoryStorage:gl(n),sessionWrapper:cr(n,e.localDashboardId),timeZone:fm(n),plugins:pm(n)}),ci=Fn(my,null,null,{forwardRef:!0})(Zr);function rS(n){return n==="file"||n==="directory"}function bt(n){return n.type==="directory"}function vy(n,e,t){return(e=fy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fy(n){var e=py(n,"string");return typeof e=="symbol"?e:e+""}function py(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Ji extends Error{constructor(){super("No file exists at the path specified"),vy(this,"isFileNotFound",!0)}}function Ya(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Qa(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ya(o,r,i,a,s,"next",l)}function s(l){Ya(o,r,i,a,s,"throw",l)}a(void 0)})}}var cn=function(n){return n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN="",n}({});class M{static fileExists(e,t){return Qa(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Ji))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(!M.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 Qa(function*(){for(var r=M.getCopyFileName(t);yield M.fileExists(e,r);)r=M.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return cn.GROOVY;case"py":return cn.PYTHON;case"pyc":return cn.PYTHON_COMPILED;case"scala":return cn.SCALA;case"txt":return cn.PLAIN_TEXT;default:return cn.UNKNOWN}}static getParent(e){if(!M.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!M.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=M.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new qn("Name cannot be empty");if(t.includes(e))throw new qn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new qn('Invalid characters in name: "'.concat((o=(a=e.match(r))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>M.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 eo=26;function ki(n){return bt(n)?M.makePath(n.filename):M.getPath(n.filename)}function Ja(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=ki(e);if(n.some(r=>{var{filename:i}=r;return M.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>bt(r)&&t.startsWith(M.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function gy(n){if(bt(n))return n.isExpanded?Nd:kd;var e=M.getMimeType(n.basename);switch(e){case cn.PYTHON:return Ld;default:return jd}}function ji(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:u,onDragStart:c,onDragOver:h,onDragEnd:v,onDragExit:f,onDrop:p}=n,g=(e=r==null?void 0:r.some(k=>k.id===s.id))!==null&&e!==void 0?e:!1,b=ki(s),w=i&&u?ki(u):null,E=i&&o&&bt(s)&&w===b,P=i&&o&&w===b,R=i&&!o&&w===b,Z=gy(s),re=M.getDepth(s.filename),Y=Array(re).fill(null).map((k,B)=>d.jsx("span",{className:"file-list-depth-line"},B));return d.jsxs("div",{className:q("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":E,"is-in-drop-target":P,"is-invalid-drop-target":R,"is-selected":a}),onDragStart:k=>c(l,k),onDragOver:k=>h(l,k),onDragEnd:k=>v(l,k),onDragExit:f,onDrop:k=>p(l,k),draggable:!0,role:"presentation","aria-label":s.basename,children:[Y," ",d.jsx(ve,{icon:Z,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[s.basename,d.jsx(he,{children:s.basename})]})})]})}function 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 _r(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){by(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 by(n,e,t){return(e=yy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yy(n){var e=Cy(n,"string");return typeof e=="symbol"?e:e+""}function Cy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Be=U.module("FileList"),Sy=500,ts="item-list-scroll-pane";function wy(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=ji,rowHeight:l=eo,overscanCount:u=yt.DEFAULT_OVERSCAN}=n,[c,h]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,w]=m.useState(),[E,P]=m.useState(),[R,Z]=m.useState([]),re=m.useRef(),Y=m.useRef(null),k=m.useRef(null),B=m.useCallback(O=>{if(O.length===0||c==null)return[];for(var J=[],oe=0;oe<O.length;oe+=1)for(var fe=O[oe],He=fe[0];He<=fe[1];He+=1)He>=c.offset&&He<c.offset+c.items.length&&J.push(c.items[He-c.offset]);return J},[c]),Q=m.useCallback(O=>{var J=B([[O,O]]);if(J.length>0)return J[0]},[B]),G=m.useCallback(()=>{var O=ft.count(R);if(O===0)return null;if(O===1){var J=R[0][0],oe=Q(J);if(oe!=null)return oe.filename}return"".concat(O," items")},[Q,R]),L=m.useCallback(O=>{if(!(!b||!p)){Be.debug("dropItems",b,"to",O);try{var{files:J,targetPath:oe}=Ja(b,p);if(i==null||i(J,oe),O!=null){var fe;Z([[O,O]]),(fe=Y.current)===null||fe===void 0||fe.focusItem(O)}}catch(He){Be.error("Unable to complete move",He)}}},[b,p,i]),W=m.useCallback((O,J)=>{var oe=c.items[O-c.offset];oe!==void 0&&(Be.debug("handleItemClick",oe),o(oe,J),bt(oe)&&(t==null||t.setExpanded(oe.filename,!oe.isExpanded)))},[c,o,t]),X=m.useCallback((O,J)=>{var oe,fe;Be.debug2("handleItemDragStart",O,R);var He=R;ft.isSelected(R,O)||(He=[[O,O]],Z(He)),w(B(He)),(oe=Y.current)===null||oe===void 0||oe.resetMouseState();var St=document.createElement("div"),wt=document.createElement("div");wt.className="dnd-placeholder-content",wt.innerText=(fe=G())!==null&&fe!==void 0?fe:"",St.appendChild(wt),St.className="file-list-dnd-placeholder",document.body.appendChild(St),J.dataTransfer.setDragImage(St,0,0),J.dataTransfer.effectAllowed="move",P(St)},[G,B,R]),F=m.useCallback((O,J)=>{J.preventDefault(),Be.debug2("handleItemDragOver",J),g(Q(O))},[Q]),V=m.useCallback((O,J)=>{Be.debug("handleItemDragEnd",O),E==null||E.remove(),w(void 0),g(void 0),P(void 0)},[E]),K=m.useCallback((O,J)=>{L(O)},[L]),pe=m.useCallback(()=>{Be.debug2("handleItemDragExit"),g(void 0)},[]),ke=m.useCallback(O=>{O.target instanceof Element&&O.target.classList.contains(ts)&&(O.preventDefault(),Be.debug2("handleListDragOver",O),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),j=m.useCallback(O=>{O.target instanceof Element&&O.target.classList.contains(ts)&&(Be.debug("handleListDrop"),L())},[L]),C=m.useCallback(function(O){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Be.debug2("handleSelectionChange",O),J===!0||O!==R){Z(O);var oe=B(O);a(oe)}},[B,a,R]),S=m.useCallback(O=>{if(Be.debug2("handleFocusChange",O),O!=null){var[J]=B([[O,O]]);r(J)}else r();re.current=O},[B,r]),N=m.useCallback((O,J)=>{Be.debug("handleViewportChange",O,J),(O!==v.top||J!==v.bottom)&&f({top:O,bottom:J})},[v]),z=m.useMemo(()=>{if(!b||!p)return!1;try{return Ja(b,p),Be.debug("handleValidateDropTarget true"),!0}catch{return Be.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:ie}=n;m.useEffect(()=>{ie!==void 0&&(ie==="/"?t.collapseAll():(t.setExpanded(ie,!1),t.setExpanded(ie,!0)))},[t,ie]),m.useEffect(function(){Be.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-u),bottom:v.bottom+u})},[u,t,v]),m.useEffect(function(){var J=t.onUpdate(oe=>{h({items:oe.items.map(fe=>_r(_r({},fe),{},{itemName:fe.basename})),offset:oe.offset,itemCount:t.size})});return()=>{J()}},[t]),m.useEffect(function(){re.current!=null&&S(re.current),R.length>0&&C(R,!0)},[c,S,C,R]),m.useEffect(function(){if(p!=null&&bt(p)&&p.filename!=="/"){var J=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},Sy);return()=>clearTimeout(J)}},[p,t]);var ht=m.useCallback(O=>s(_r(_r({},O),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:z,onDragStart:X,onDragEnd:V,onDragOver:F,onDragExit:pe,onDrop:K})),[V,pe,F,X,K,b,p,z,s]);return d.jsx("div",{ref:k,className:q("file-list",{"is-dragging":b!=null}),onDragOver:ke,onDrop:j,children:d.jsx(yt,{ref:Y,items:c.items,itemCount:c.itemCount,offset:c.offset,onFocusChange:S,onSelect:W,onSelectionChange:C,onViewportChange:N,selectedRanges:R,renderItem:ht,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Ey={DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[_.DELETE],macShortcut:[I.CMD,_.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[_.ENTER],macShortcut:[_.ENTER]})};const ns={FILE_EXPLORER:Ey};var rs=U.module("FileListItemEditor"),Py=()=>Promise.resolve();function Ty(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Py}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,u]=m.useState(),[c,h]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var E;(E=o.current)===null||E===void 0||E.focus()},[o]),f=m.useCallback(E=>E.stopPropagation(),[]),p=m.useCallback(()=>{c.then(()=>{r(a)}).catch(E=>rs.info("Unable to validate name",E))},[r,a,c]);m.useEffect(function(){var P=_e.makeCancelable(i(a));return P.then(()=>u(void 0)).catch(R=>{_e.isCanceled(R)||u(R)}),h(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{rs.debug2("handleBlur"),p()},[p]),b=m.useCallback(E=>{var{value:P}=E.target;s(P)},[]),w=m.useCallback(E=>{E.stopPropagation();var{key:P}=E;switch(P){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:q("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:w,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function is(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 hi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?is(Object(t),!0).forEach(function(r){_y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):is(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _y(n,e,t){return(e=Oy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Oy(n){var e=xy(n,"string");return typeof e=="symbol"?e:e+""}function xy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 xu(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:u,onSelect:c,onSelectionChange:h,table:v,rowHeight:f=eo,validateRename:p=()=>Promise.resolve()}=n,[g,b]=m.useState(),[w,E]=m.useState([]),[P,R]=m.useState(),Z=m.useCallback(K=>{E(K),h==null||h(K)},[h]),re=m.useCallback(K=>{R(K)},[]),Y=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),k=m.useCallback(()=>{w.length>0&&(s==null||s(w))},[s,w]),B=m.useCallback(()=>{i==null||i()},[i]),Q=m.useCallback(()=>{P&&(o==null||o(M.getPath(P.filename)))},[P,o]),G=m.useCallback(()=>{P&&b(P)},[P]),L=m.useCallback(()=>{b(void 0)},[]),W=m.useCallback(K=>{g&&(u==null||u(g,K),b(void 0))},[u,g]),X=m.useMemo(()=>{if(g)return[];var K=[];return i&&K.push({title:"New File",description:"Create new file",action:B,group:ne.groups.medium}),o&&K.push({title:"New Folder",description:"Create new folder",action:Q,group:ne.groups.medium}),a&&K.push({title:"Copy File",description:"Copy the selected file",action:Y,group:ne.groups.low,disabled:P==null||bt(P)}),s&&w.length>0&&K.push({title:"Delete",description:"Delete",shortcut:ns.FILE_EXPLORER.DELETE,action:k,group:ne.groups.low}),u&&K.push({title:"Rename",description:"Rename",shortcut:ns.FILE_EXPLORER.RENAME,action:G,group:ne.groups.low,disabled:P==null}),K},[Y,k,B,Q,G,P,a,i,o,s,u,w,g]),F=m.useCallback(K=>(A(g),p(g,K)),[g,p]),V=m.useCallback(K=>{var{item:pe}=K;return g&&g.filename===pe.filename?d.jsx(ji,hi(hi({},K),{},{children:d.jsx(Ty,{item:pe,validate:F,onSubmit:W,onCancel:L})})):d.jsx(ji,hi({},K))},[L,W,g,F]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(wy,{onMove:l,onSelect:c,onSelectionChange:Z,onFocusChange:re,renderItem:V,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),r&&d.jsx(ne,{actions:X})]})}xu.displayName="FileListContainer";function os(n,e,t){return(e=Iy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iy(n){var e=Dy(n,"string");return typeof e=="symbol"?e:e+""}function Dy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 Dr extends qn{constructor(e){super("Name already exists"),os(this,"isExistingFile",!0),os(this,"info",void 0),this.info=e}}function as(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function ss(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){as(o,r,i,a,s,"next",l)}function s(l){as(o,r,i,a,s,"throw",l)}a(void 0)})}}var Et=U.module("FileExplorer");function to(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:c,rowHeight:h=eo}=n,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var W;function X(){return F.apply(this,arguments)}function F(){return F=ss(function*(){Et.debug("initTable"),W=_e.makeCancelable(e.getTable(),V=>V.close());try{g(yield W)}catch(V){_e.isCanceled(V)||Et.error("Unable to initialize table",V)}}),F.apply(this,arguments)}return X(),()=>{W.cancel()}},[e]);var b=m.useCallback(L=>{_e.isCanceled(L)||Et.error(L)},[]),w=m.useCallback(()=>{Et.debug("handleCreateFile"),s()},[s]),E=m.useCallback(()=>{Et.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(L=>{Et.debug("handleCopyFile",L.filename),i(L)},[i]),R=m.useCallback(L=>{Et.debug("handleDelete, pending confirmation",L),f(L)},[]),Z=m.useCallback(()=>{Et.debug("handleDeleteConfirm",v),v.forEach(L=>e.deleteFile(bt(L)?M.makePath(L.filename):L.filename)),o(v),f([])},[v,o,e]),re=m.useCallback(()=>{Et.debug("handleDeleteCancel"),f([])},[]),Y=m.useCallback((L,W)=>{var X=M.reducePaths(L.map(F=>bt(F)?M.makePath(F.filename):F.filename));X.forEach(F=>{var V=M.isPath(F)?"".concat(W).concat(M.getBaseName(F.substring(0,F.length-1)),"/"):"".concat(W).concat(M.getBaseName(F));e.moveFile(F,V).then(()=>{a(F,V)}).catch(b)})},[b,a,e]),k=m.useCallback((L,W)=>{var X=L.filename,F=bt(L);F&&!X.endsWith("/")&&(X="".concat(X,"/"));var V="".concat(M.getParent(X)).concat(W);F&&!V.endsWith("/")&&(V="".concat(V,"/")),Et.debug2("handleRename",X,V),e.moveFile(X,V).catch(b),a(X,V)},[b,a,e]),B=m.useCallback(function(){var L=ss(function*(W,X){if(X!==W.basename){M.validateName(X);var F="".concat(M.getPath(W.filename)).concat(X);try{var V=yield e.info(F);throw new Dr(V)}catch(K){if(!(K instanceof Ji))throw K}}});return function(W,X){return L.apply(this,arguments)}}(),[e]),Q=v.length>0,G=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return d.jsxs("div",{className:"file-explorer",children:[p&&d.jsx(xu,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:P,onCreateFolder:E,onCreateFile:w,onMove:Y,onDelete:R,onRename:k,onSelect:u,onSelectionChange:c,rowHeight:h,table:p,validateRename:B}),d.jsx(Qn,{isOpen:Q,headerText:G,bodyText:"You cannot undo this action.",onCancel:re,onConfirm:Z,confirmButtonText:"Delete"})]})}to.displayName="FileExplorer";function ls(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function My(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ls(o,r,i,a,s,"next",l)}function s(l){ls(o,r,i,a,s,"throw",l)}a(void 0)})}}function hn(n,e,t){return(e=Ny(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ny(n){var e=ky(n,"string");return typeof e=="symbol"?e:e+""}function ky(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var sn=U.module("NewItemModal");class pn extends m.PureComponent{static getValidationMessage(e){return e instanceof Dr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){_e.isCanceled(e)||sn.error(e)}constructor(e){super(e),hn(this,"inputRef",$.createRef()),hn(this,"cancelableValidatePromise",void 0),hn(this,"cancelableExistingItemPromise",void 0),hn(this,"pending",new nr),hn(this,"pathMap",new Map),hn(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=_e.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return My(function*(){M.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Dr(l)}catch(u){if(!(u instanceof Ji))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(pn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(sn.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,r=M.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 qn))throw e;sn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;sn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){sn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=M.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){sn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;sn.debug("submitModal",r,i);var l=M.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:c}=this.props;c("".concat(o).concat(i))}).catch(u=>{if(u instanceof Dr&&s!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw _e.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).catch(this.handleValidationError).catch(pn.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((r,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),d.jsxs($.Fragment,{children:[d.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(ve,{icon:Ad,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:u,showOverwriteModal:c,validationError:h,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=M.fileExtensionToString(f),w=M.fileExtensionToString(p),E=g?"Create":"Save",P=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(Ps,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(Ts,{toggle:r,children:o}),d.jsx(_s,{children:d.jsx("form",{children:d.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[d.jsxs("div",{className:"flex-grow-0 mb-4",children:[d.jsx("label",{htmlFor:"file-name-input",children:P}),d.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:q("form-control",{"is-invalid":h}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&d.jsx("div",{className:"invalid-feedback",children:pn.getValidationMessage(h)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(to,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(el,{children:[d.jsx(se,{kind:"secondary",onClick:r,children:"Cancel"}),d.jsx(se,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:E})]})]}),d.jsx(Qn,{isOpen:c,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(Qn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(w,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(w,'"')})]})}}hn(pn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function jy(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(se,{kind:"ghost",icon:Rs,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(se,{kind:"ghost",icon:Rd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(ul,{value:i,onChange:r,placeholder:"Search by name"})})]})}function us(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ly(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){us(o,r,i,a,s,"next",l)}function s(l){us(o,r,i,a,s,"throw",l)}a(void 0)})}}function Iu(n,e,t){return(e=Ay(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ay(n){var e=Ry(n,"string");return typeof e=="symbol"?e:e+""}function Ry(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ln=U.module("FileExplorerPanel"),Fy=(n,e)=>{var t=bl(n),r=cr(n,e.localDashboardId),{session:i,config:o}=r??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},$y=Fn(Fy,null,null,{forwardRef:!0});function Hy(n){var e=n;return e!=null&&typeof e.button=="number"}class Rn extends $.Component{static handleError(e){ln.error(e)}static isFocusEvent(e){return Hy(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};ln.debug("handleCreateFile",t,r,i),e.emit(te.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){ln.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){ln.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Rn.handleError)}handleCopyFile(e){var t=this;return Ly(function*(){var{fileStorage:r}=t.props;if(bt(e)){ln.error("Invalid item in handleCopyItem",e);return}var i=yield M.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(te.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(ln.debug("fileSelect",e),e.type!=="directory"){var r=Rn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(te.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;ln.debug("handleRename",e,t),r.emit(te.RENAME_FILE,e,t)}handleSessionOpened(e){var{session:t,language:r}=e;this.setState({session:t,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return d.jsxs(dr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(jy,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(to,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),d.jsx(pn,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}Iu(Rn,"COMPONENT","FileExplorerPanel");Iu(Rn,"TITLE","File Explorer");var By=$y(Rn);function tr(n,e,t){return(e=Uy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uy(n){var e=Wy(n,"string");return typeof e=="symbol"?e:e+""}function Wy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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 ds=U.module("LogPanel");class Yr extends m.PureComponent{constructor(e){super(e),tr(this,"isBottomVisible",void 0),tr(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;ds.debug("Session opened",[t]),this.setState({session:t})}handleSessionClosed(e){ds.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return d.jsxs(dr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&d.jsx(we,{session:r,ref:i=>{this.logView=i}})]})}}tr(Yr,"defaultProps",{session:null});tr(Yr,"COMPONENT","LogPanel");tr(Yr,"TITLE","Log");var Vy=(n,e)=>{var t;return{session:(t=cr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},Ky=Fn(Vy,null,null,{forwardRef:!0})(Yr);function cs(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Or(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){cs(o,r,i,a,s,"next",l)}function s(l){cs(o,r,i,a,s,"throw",l)}a(void 0)})}}function hs(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Je(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hs(Object(t),!0).forEach(function(r){Re(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):hs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Re(n,e,t){return(e=zy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zy(n){var e=Gy(n,"string");return typeof e=="symbol"?e:e+""}function Gy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qy=m.lazy(()=>$s(()=>import("./MarkdownNotebook-D-Qhu6GW.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),de=U.module("NotebookPanel"),ms=400;class xe extends m.Component{static handleError(e){_e.isCanceled(e)||de.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(xe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(xe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",Qt((v,f)=>Je(Je({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",Qt((v,f,p)=>{var g=[{title:"Find",icon:Hd,action:this.handleFind,group:ne.groups.high,shortcut:Ve.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Os,action:this.handleCopy,group:ne.groups.medium,order:20},{title:"Rename File",icon:Bd,action:this.handleShowRename,group:ne.groups.medium,order:30},{title:"Delete File",icon:ks,action:this.handleDelete,group:ne.groups.medium,order:40},{title:"Show Minimap",icon:v?Mn:void 0,action:this.handleMinimapChange,group:ne.groups.low,shortcut:Ve.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?Mn:void 0,action:this.handleWordWrapChange,group:ne.groups.low,shortcut:Ve.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:ne.groups.low,order:10}),g.push({title:"Format on Save",icon:p?Mn:void 0,action:this.handleFormatOnSaveChange,group:ne.groups.low,order:15})),g})),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFormatOnSaveChange=this.handleFormatOnSaveChange.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.handleFormat=this.handleFormat.bind(this),this.canFormat=this.canFormat.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new nr,this.debouncedSavePanelState=gn(this.savePanelState.bind(this),ms),this.debouncedLoad=gn(this.load.bind(this),ms),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var u=s!=null&&M.hasPath(s.itemName),c=u===!0&&a.value!=null||!u&&a.value!=null&&a.value.length>0,h=c?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:h,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},de.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(te.RENAME_FILE,this.handleRenameFile),t.on(ae.DROPPED,this.handlePanelDropped),e.on(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;r!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.notebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(te.RENAME_FILE,this.handleRenameFile),e.off(ae.DROPPED,this.handlePanelDropped),t.off(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(te.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);A(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r==null||r.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){de.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){de.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(te.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(te.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(te.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;A(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;de.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:u}=this.props,{id:c}=u;this.renameTab(c,M.getBaseName(s))}var h=Je(Je({},t),{},{language:(a=xe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(h.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:h}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){de.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;de.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,u=Je(Je({},a),{},{value:s}),c=Je(Je({},a),{},{value:l}),h={settings:c,fileMetadata:i,isPreview:o};return de.debug("Saving panel state",h),{settings:u,panelState:h}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(te.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return Or(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;A(o);var{language:s}=a,{itemName:l}=o,u=yield M.getUniqueCopyFileName(t,l);de.debug("handleCopy",o,l,u),yield t.copyFile(l,u);var c={id:u,itemName:u},h={value:null,language:s};r.emit(te.SELECT_NOTEBOOK,i,s,h,c,!0)})()}handleDelete(){de.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Or(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;de.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(M.hasPath(o.itemName)&&(yield M.fileExists(t,o.itemName))?(i.emit(te.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){de.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:r}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:Je(Je({},t),{},{wordWrap:r})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:r}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};r(i)}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){de.debug("Ignoring invalid notebook link",a);return}de.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},u={id:a,itemName:a};s.emit(te.SELECT_NOTEBOOK,r,i,l,u)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;_e.isCanceled(t)||(_e.isTimedOut(t)&&(t=new Error("File not found.")),de.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return Or(function*(){de.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:r=!1}=t;r&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=xe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=Je(Je({},a.settings),{},{language:o});return de.debug("handleSaveSuccess",i,s,l),s&&M.hasPath(s.itemName)&&s.itemName!==i.itemName&&(de.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(xe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){_e.isCanceled(e)||(this.setState({savedChangeCount:0}),de.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),de.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(o)!==M.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?me.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return Or(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield me.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){a.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){de.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){de.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e){var{session:t,language:r}=e;this.setState({session:t,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;de.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){de.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];de.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){de.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){de.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r==null?void 0:r.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var o=new URL(i,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=Je(Je({},s),{},{language:t,value:r}),u={id:null,itemName:e};de.debug("handleCreateNotebook",o,a,l,u),i.emit(te.CREATE_NOTEBOOK,o,a,l,u)}runCommand(e){if(e===void 0||e===""){de.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Ge.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:r}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",r??!1)}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:u,savedChangeCount:c,error:h,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:w,sessionLanguage:E,settings:P,showCloseModal:R,showDeleteModal:Z,showSaveAsModal:re}=this.state,Y=v&&!o.isHidden&&!g,k=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:xe.DEFAULT_NAME,B=k.endsWith(".md"),Q=(b==null?void 0:b.id)!=null,G=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=w!=null,W=E===G.language,X=!f||!L||!W,F=!f,V=[{action:this.handleSave,shortcut:Xt.SAVE},{action:this.handleMinimapChange,shortcut:Ve.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ve.NOTEBOOK.WORDWRAP}],K=Ei.getDisabledRunTooltip(L,W,"Notebook extension","Run"),pe=Ei.getDisabledRunTooltip(L,W,"Notebook extension","Run Selected"),ke=[{title:Q?"Rename":"Save As…",order:10,group:ne.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ne.groups.high,order:20}],j=a==null?void 0:a.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[j!=null&&Br.createPortal(d.jsx("span",{className:q(xe.UNSAVED_INDICATOR_CLASS_NAME,{[xe.UNSAVED_STATUS_CLASS_NAME]:u!==c})}),j),d.jsxs(dr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:ke,renderTabTooltip:()=>k,children:[!B&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:X,icon:d.jsx(ve,{icon:As,transform:"grow-4"}),tooltip:"Run ".concat(Ve.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),K!=null&&d.jsx(he,{children:K})]}),d.jsxs("span",{children:[d.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:X,icon:d.jsx(ve,{icon:Fd,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ve.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&d.jsx(he,{children:pe})]}),d.jsx(se,{kind:"ghost",className:"mr-auto",disabled:F,onClick:this.handleSave,icon:$d,tooltip:"Save ".concat(Xt.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(se,{kind:"ghost",className:"btn-overflow",disabled:F,icon:Ls,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(or,{actions:this.getDropdownOverflowActions,popperOptions:xe.POPPER_OPTIONS})})]}),d.jsx($l,{isLoaded:f,isLoading:p,error:h,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:w,sessionLanguage:E,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:G,focusOnMount:Y,ref:C=>{this.notebook=C}})]}),B&&d.jsx(m.Suspense,{fallback:d.jsx(bn,{"data-testid":"notebook-panel-loading"}),children:d.jsx(qy,{content:(r=G.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),d.jsx(pn,{isOpen:re,type:"file",defaultValue:k,title:Q?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),d.jsx(Qn,{isOpen:Z,headerText:'Are you sure you want to delete "'.concat(k,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(Qn,{isOpen:R,headerText:"Do you want to save the changes you made to ".concat(k,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),d.jsx(ne,{actions:V})]})]})}}Re(xe,"COMPONENT","NotebookPanel");Re(xe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(xe,"DEFAULT_NAME","Untitled");Re(xe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(xe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(xe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var Xy=(n,e)=>{var t=bl(n),r=Cl(n),i=cr(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:r,session:o,sessionLanguage:s}},un=Fn(Xy,{updateNotebookSettings:wm},null,{forwardRef:!0})(xe);function Zy(){var{python:{linter:n={}}={}}=Ug(Cl),{isEnabled:e=!1,config:t}=n;m.useEffect(function(){H.isRuffEnabled=e,H.setRuffSettings(t)},[e,t])}function vs(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fs(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vs(Object(t),!0).forEach(function(r){Yy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yy(n,e,t){return(e=Qy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qy(n){var e=Jy(n,"string");return typeof e=="symbol"?e:e+""}function Jy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=U.module("ConsolePlugin");function ps(n){return n.notebook!==void 0}function eC(n){Og(n)}function iS(n){eC(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,u]=m.useState(new Map),[c,h]=m.useState(new Map);Zy();var v=Li(),f=m.useCallback(()=>i.getLastUsedPanelOfType(ci),[i]),p=m.useCallback((C,S)=>{u(N=>new Map(N.set(C,S)))},[u]),g=m.useCallback(C=>{u(S=>(S.delete(C),new Map(S)))},[u]),b=m.useCallback((C,S)=>{h(N=>new Map(N.set(C,S)))},[h]),w=m.useCallback(C=>{h(S=>(S.delete(C),new Map(S)))},[h]),E=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,z=C&&C.trim();if(!z)be.info("Ignoring empty code");else{var ie=f();if(!ie||!(ie instanceof ci.WrappedComponent)){be.error("Console panel not found");return}be.debug("Send command: ",C,S,N),ie.addCommand(C,S,N)}},[f]),P=m.useCallback(C=>{v(Hb(e,C))},[v,e]),R=m.useCallback(C=>{var{language:S}=C,N=S==="python"?"py":S,z=null;return N==null?(be.debug("No extension for language",S),z="Untitled-".concat(s.current)):z="Untitled-".concat(s.current,".").concat(N),s.current+=1,z},[]),Z=m.useCallback(function(C){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:N}=C;if(N!=null&&l.has(N))return l.get(N);if(N!=null&&c.has(N))return c.get(N);if(S)return _t()},[l,c]),re=m.useCallback((C,S)=>{x.renameComponent(r.root,{id:C},S)},[r.root]),Y=m.useCallback((C,S)=>{be.debug("Rename file panel",C,S);var N;if(l.has(C)&&(N=l.get(C),g(C),N!=null&&p(S,N)),c.has(C)&&(N=c.get(C),w(C),N!=null&&b(S,N)),N===void 0){be.debug2("File ".concat(C," isn't open, no need to rename the tab"));return}re(N,M.getBaseName(S))},[l,c,re,p,b,g,w]),k=m.useCallback(C=>{var S=Z(C,!1);if(S==null){be.error("Could not find panel id for file metadata",C);return}x.activateTab(r.root,{id:S})},[Z,r.root]),B=m.useCallback((C,S,N)=>{if(be.debug("registerFilePanel",C,S,N),S==null||S.id==null){be.debug("Ignore empty file id",S);return}var{id:z}=S;if(N){b(z,C);return}if(l.has(z)){var ie=l.get(z);if(C===ie){be.debug("Update tab title for file ".concat(z));var{itemName:ht}=S;Y(z,ht)}else be.error("File ".concat(z," already associated with a different tab ").concat(ie));return}p(z,C),c.has(z)&&w(z)},[l,c,Y,p,b,w]),Q=m.useCallback((C,S)=>{if(be.debug("unregisterFileTab",C,S),C==null||C.id==null){be.debug("Ignore empty file id",C);return}var{id:N}=C;if(S){w(N);return}g(N)},[g,w]),G=m.useCallback((C,S)=>{be.debug("closeFilePanel",C);var{id:N}=C;if(N==null){be.warn("File ID is null, ignore close event");return}var z=null,ie=!1;if(l.has(N))z=l.get(N);else if(c.has(N))z=c.get(N),ie=!0;else{be.debug("File ".concat(N," isn't open, ignore close event"));return}Q(C,ie),x.closeComponent(r.root,{id:z},S)},[r.root,l,c,Q]),L=m.useCallback(C=>{var{itemName:S}=C;return M.getBaseName(S)},[]),W=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpen",C,S,l),S!=null&&l.has(S)},[l]),X=m.useCallback(C=>{var{id:S}=C;return be.debug("fileIsOpenAsPreview",C,S,c),S!=null&&c.has(S)},[c]),F=m.useCallback(C=>{if(C!=null){var S=i.getOpenedPanelById(C);S&&ps(S)&&S.focus()}},[i]),V=m.useCallback(C=>{var{id:S,settings:N,fileMetadata:z,session:ie,sessionLanguage:ht,isPreview:O=!1}=C,J={settings:N,fileMetadata:z},oe=L(z);return{type:"react-component",component:un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:S},session:ie,sessionLanguage:ht,panelState:J,isPreview:O,notebooksUrl:a},title:oe,id:S}},[L,e,a]),K=m.useCallback(function(C,S,N){var z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:R(N)},ie=Z(z);if(W(z)&&ie!=null){be.debug("File is already open, focus panel"),k(z),F(ie);return}if(ie==null){be.error("Panel ID for file metadata is null");return}var ht=x.getStackForComponentTypes(r.root,[un.COMPONENT]),O=V({id:ie,settings:N,fileMetadata:z,session:C,sessionLanguage:S});be.debug("createNotebook",O,l),x.openComponentInStack(ht,O)},[W,F,R,Z,r.root,V,l,k]),pe=m.useCallback(function(C,S,N,z){var ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;be.debug("selectNotebook",z,ie);var ht=W(z),O=X(z),[J]=[...c.values()],oe=!ie,fe=oe&&J?J:Z(z);if(fe==null||fe==="")throw new Error("Unable to retrieve or create panelId for metadata: ".concat(JSON.stringify(z)));if(ht||O)k(z);else{var He=x.getStackForComponentTypes(r.root,[un.COMPONENT]),St=V({id:fe,settings:N,fileMetadata:z,session:C,sessionLanguage:S,isPreview:oe});x.openComponentInStack(He,St)}if(O&&ie){var wt=z.id,ei=x.getStackForConfig(r.root,{component:un.COMPONENT,id:fe}),Hn=x.getContentItemInStack(ei,{component:un.COMPONENT,id:fe});wt!=null&&Hn&&Ae(Hn)&&(Hn.container.emit(te.PROMOTE_FROM_PREVIEW),w(wt),p(wt,fe))}ie&&F(fe)},[k,W,X,F,Z,r.root,V,c,w,p]),ke=m.useCallback(function(C,S){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,ie=i.getLastUsedPanelOfType(un);ie&&ps(ie)?N!=null&&N.value!=null&&ie.notebook!=null&&ie.notebook.append(N.value):z&&K(C,S,N)},[K,i]),j=m.useCallback((C,S)=>Lg.hydrate(fs(fs({},C),{},{notebooksUrl:a}),S),[a]);return Wn(o,ci,t),Wn(o,Vb),Wn(o,By),Wn(o,Ky),Wn(o,un,j),Le(r.eventHub,Ge.SEND_COMMAND,E),Le(r.eventHub,Ge.SETTINGS_CHANGED,P),Le(r.eventHub,te.CLOSE_FILE,G),Le(r.eventHub,te.CREATE_NOTEBOOK,K),Le(r.eventHub,te.SELECT_NOTEBOOK,pe),Le(r.eventHub,te.RENAME,re),Le(r.eventHub,te.RENAME_FILE,Y),Le(r.eventHub,te.SEND_TO_NOTEBOOK,ke),Le(r.eventHub,te.REGISTER_FILE,B),Le(r.eventHub,te.UNREGISTER_FILE,Q),null}function Qr(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=nC(n,"string");return typeof e=="symbol"?e:e+""}function nC(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.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{}Qr(Jr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Qr(Jr,"INPUT_FILTER","ControlType.INPUT_FILTER");Qr(Jr,"MARKDOWN","ControlType.MARKDOWN");Qr(Jr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{Sm as $,NC as A,se as B,rl as C,ze as D,kC as E,jl as F,Ys as G,Js as H,Ot as I,Qs as J,_ as K,Fe as L,Cl as M,wm as N,Jn as O,_e as P,H as Q,Cv as R,cl as S,T,Xt as U,al as V,Jr as W,L0 as X,or as Y,wl as Z,Wr as _,pt as a,I as a$,nn as a0,y0 as a1,vu as a2,BC as a3,yl as a4,yC as a5,cr as a6,W0 as a7,pm as a8,$e as a9,AC as aA,WC as aB,$C as aC,HC as aD,V0 as aE,K0 as aF,LC as aG,FC as aH,Sl as aI,RC as aJ,me as aK,dC as aL,Oc as aM,ir as aN,kc as aO,xc as aP,Xs as aQ,qs as aR,Ic as aS,Dc as aT,ft as aU,yt as aV,jc as aW,nl as aX,ul as aY,zh as aZ,Vr as a_,E0 as aa,Wg as ab,jC as ac,Lg as ad,Gd as ae,Vs as af,te as ag,xt as ah,o0 as ai,s0 as aj,u0 as ak,c0 as al,ae as am,D0 as an,P0 as ao,O0 as ap,un as aq,Sg as ar,hm as as,Hs as at,Ur as au,iS as av,ne as aw,Qn as ax,ly as ay,UC as az,It as b,Nr as b$,el as b0,nh as b1,Ai as b2,hC as b3,Gh as b4,Ri as b5,vC as b6,ol as b7,Zs as b8,hl as b9,qC as bA,tf as bB,YC as bC,QC as bD,lf as bE,uf as bF,e0 as bG,JC as bH,Wi as bI,t0 as bJ,up as bK,rp as bL,dp as bM,Yt as bN,El as bO,We as bP,Lr as bQ,Kf as bR,Hl as bS,Pl as bT,$m as bU,xl as bV,Im as bW,kn as bX,Tl as bY,jn as bZ,Df as b_,il as ba,Lc as bb,bh as bc,Mr as bd,sm as be,fl as bf,vl as bg,ml as bh,fC as bi,pC as bj,gC as bk,Hv as bl,Bv as bm,Ee as bn,Gv as bo,sf as bp,ee as bq,Yv as br,Ne as bs,VC as bt,Nl as bu,kl as bv,GC as bw,ZC as bx,KC as by,zC as bz,y as c,Yb as c$,Il as c0,mp as c1,we as c2,Si as c3,Ve as c4,$l as c5,Ei as c6,Bs as c7,x as c8,Wn as c9,wg as cA,Pg as cB,Eg as cC,Tg as cD,r0 as cE,$g as cF,v0 as cG,f0 as cH,x0 as cI,_0 as cJ,a0 as cK,d0 as cL,l0 as cM,h0 as cN,S0 as cO,I0 as cP,Le as cQ,Zg as cR,Y0 as cS,Q0 as cT,on as cU,Eu as cV,nS as cW,oy as cX,J0 as cY,iy as cZ,sy as c_,i0 as ca,b0 as cb,wb as cc,ub as cd,lb as ce,di as cf,pu as cg,C0 as ch,m0 as ci,uu as cj,Mg as ck,Xi as cl,qi as cm,fu as cn,Gg as co,cu as cp,wr as cq,Og as cr,su as cs,db as ct,T0 as cu,p0 as cv,g0 as cw,mu as cx,lu as cy,_g as cz,qe as d,Qd as d$,Xb as d0,Tu as d1,zb as d2,Kb as d3,qb as d4,Gb as d5,_u as d6,Ni as d7,Zb as d8,Pu as d9,H0 as dA,Su as dB,F0 as dC,B0 as dD,nr as dE,A0 as dF,Z0 as dG,R0 as dH,bt as dI,X0 as dJ,G0 as dK,z0 as dL,wu as dM,Ge as dN,k0 as dO,M0 as dP,U0 as dQ,Mb as dR,Db as dS,Hb as dT,Zy as dU,j0 as dV,N0 as dW,sC as dX,cC as dY,lC as dZ,ni as d_,Mi as da,Xr as db,Ga as dc,eS as dd,qa as de,tS as df,uC as dg,co as dh,Cg as di,zr as dj,w0 as dk,M as dl,Ji as dm,rS as dn,ci as dp,Ky as dq,Vb as dr,By as ds,zs as dt,aC as du,dr as dv,Gs as dw,Dt as dx,q0 as dy,$0 as dz,Em as e,ti as e0,XC as e1,qn as e2,fm as f,CC as g,DC as h,IC as i,xC as j,OC as k,_C as l,TC as m,bC as n,EC as o,wC as p,SC as q,Se as r,ce as s,he as t,cm as u,Pe as v,MC as w,PC as x,mC as y,Ug as z};
|
|
25
|
+
//# sourceMappingURL=ControlType-qh7zzRDd.js.map
|