@deephaven/embed-widget 0.89.1-beta.0 → 0.89.1-beta.3
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/{App-482b99ee.js → App-a13b34b2.js} +2 -2
- package/build/assets/{App-482b99ee.js.map → App-a13b34b2.js.map} +1 -1
- package/build/assets/{Chart-44115f86.js → Chart-dc8479ae.js} +2 -2
- package/build/assets/{Chart-44115f86.js.map → Chart-dc8479ae.js.map} +1 -1
- package/build/assets/{IrisGrid-aa97ef86.js → IrisGrid-e0af0874.js} +2 -2
- package/build/assets/{IrisGrid-aa97ef86.js.map → IrisGrid-e0af0874.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-382ef187.js → IrisGridThemeProvider-52df9591.js} +2 -2
- package/build/assets/IrisGridThemeProvider-52df9591.js.map +1 -0
- package/build/assets/{LocalWorkspaceStorage-b42690b1.js → LocalWorkspaceStorage-00b41816.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-b42690b1.js.map → LocalWorkspaceStorage-00b41816.js.map} +1 -1
- package/build/assets/LogPanel-76b01f67.js +18 -0
- package/build/assets/LogPanel-76b01f67.js.map +1 -0
- package/build/assets/{MarkdownEditor-7656da17.js → MarkdownEditor-c7d8aacc.js} +2 -2
- package/build/assets/{MarkdownEditor-7656da17.js.map → MarkdownEditor-c7d8aacc.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-476827a5.js → MarkdownNotebook-cfca625e.js} +2 -2
- package/build/assets/{MarkdownNotebook-476827a5.js.map → MarkdownNotebook-cfca625e.js.map} +1 -1
- package/build/assets/{index-0207a252.js → index-34e474c6.js} +2 -2
- package/build/assets/{index-0207a252.js.map → index-34e474c6.js.map} +1 -1
- package/build/assets/{index-5a85501f.js → index-aae2b5d2.js} +2 -2
- package/build/assets/{index-5a85501f.js.map → index-aae2b5d2.js.map} +1 -1
- package/build/assets/{index-07cdad10.js → index-de6164c3.js} +4 -4
- package/build/assets/{index-07cdad10.js.map → index-de6164c3.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +17 -17
- package/build/assets/IrisGridThemeProvider-382ef187.js.map +0 -1
- package/build/assets/LogPanel-05058706.js +0 -18
- package/build/assets/LogPanel-05058706.js.map +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{L as $,an as Xo,T as Aa,B as Ra,G as ka,D as Fa,A as ja,H as $a,w as Ha,O as Ua,p as Ba,M as Yo,s as Qo,b as Jo,k as Ka,ao as es,ap as Wa,aq as za,a as Pn,U as Va,F as Ga,ar as ts,r as ns,E as qa,as as Za,l as F,am as Xa,ai as rs,aj as Ya,q as is,h as Qa,ak as xr,at as Ja,au as li,av as el,aw as tl,ax as nl,ay as rl,v as il,e as os,af as ol,c as yr,a9 as sl,az as al,aA as di,ad as ll,aB as ui,aC as ss,aD as dl,a4 as ul,aE as hl,aF as cl,aG as ml,aH as fl,aI as vl,aJ as pl}from"./index-0207a252.js";import{r as m,a5 as Tn,b1 as Kr,J as D,bi as gl,E as d,G as bl,H as j,R as Wr,a6 as b,b2 as yl,I as se,D as Nt,bj as Cl,ba as as,a4 as Kt,bk as wl,bl as Sl,bm as _l,bg as Ir,_ as El,bn as T,bo as hi,L as ls,K as ds,bp as Pl,bc as ot,bq as Tl,bf as lt,bd as Le,be as Lt,br as ci,b9 as Ol,bs as xl,bb as Yt,bt as vn,bh as On}from"./vendor-e852bd02.js";var Il=Object.freeze([]),yg=new Map,us=()=>{};function Cg(n){return Array.isArray(n)?n:[n]}function wg(){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 Ml(n,e,t){return e=Dl(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dl(n){var e=Nl(n,"string");return typeof e=="symbol"?e:String(e)}function Nl(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ll extends Error{constructor(){super(...arguments),Ml(this,"isCanceled",!0)}}const mi=Ll;function fi(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function Al(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){fi(o,r,i,s,a,"next",l)}function a(l){fi(o,r,i,s,a,"throw",l)}s(void 0)})}}function Rl(n){return Mr.apply(this,arguments)}function Mr(){return Mr=Al(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}kl(n)}),Mr.apply(this,arguments)}function kl(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 rn(n,e,t){return e=Fl(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fl(n){var e=jl(n,"string");return typeof e=="symbol"?e:String(e)}function jl(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $l="table_",hs="column_",Hl=new Set(["in","not","i","ii","k"]),Ul=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"]),Bl=/[^a-zA-Z0-9_$+@-]/g,Kl=/[^A-Za-z0-9_$]/g;class Fe{}rn(Fe,"legalize",(n,e,t,r,i)=>{var o=n.trim().replace(/[- ]/g,"_");return r&&(Hl.has(o)||Ul.has(o))&&(o=e+o),o=o.replace(t,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o});rn(Fe,"legalizeTableName",n=>Fe.legalize(n,$l,Bl,!1,0));rn(Fe,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Fe.legalizeColumnName(t,r);e.includes(i)&&(i=hs+r),e.push(i)}),e});rn(Fe,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Fe.legalize(n,hs,Kl,!0,e)});rn(Fe,"isValidTableName",n=>Fe.legalizeTableName(n)===n);rn(Fe,"isValidColumnName",n=>Fe.legalizeColumnName(n)===n);const cs=Fe;class ms extends CustomEvent{constructor(e,t){super(e,t)}}function Wl(n,e,t){return e=zl(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zl(n){var e=Vl(n,"string");return typeof e=="symbol"?e:String(e)}function Vl(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gl extends Error{constructor(){super(...arguments),Wl(this,"isTimeout",!0)}}const ql=Gl;class Me{static makeCancelable(e,t){var r=!1,i,o,s=new Promise((a,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,a(u))}).catch(u=>l(u))});return s.cancel=()=>{r=!0,o(new mi),i!=null&&t&&t(i)},s}static isCanceled(e){return e instanceof mi}static isTimedOut(e){return e instanceof ql}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function vi(n,e,t){return e=Zl(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zl(n){var e=Xl(n,"string");return typeof e=="symbol"?e:String(e)}function Xl(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yl{constructor(){vi(this,"pending",[]),vi(this,"resolved",[])}add(e,t){var r=Me.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=[]}}const sr=Yl;class zr{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(!zr.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],s=i[1];if(o<=t&&t<=s)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],s=o.length-1;s>=0;s-=1){var a=o[s],l=a[0],u=a[1];if(l<=r&&i<=u)return o;r<=u&&l<=i&&(r=Math.min(r,l),i=Math.max(i,u),o.splice(s,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],s=o.length-1;s>=0;s-=1){var a=o[s],l=a[0],u=a[1];if(!(i<l||u<r))if(l<r&&i<u){o[s]=[l,r-1],o.splice(s+1,0,[i+1,u]);break}else r<=l&&u<=i?o.splice(s,1):l<r?o[s]=[l,r-1]:o[s]=[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],s=i[0];s<=i[1];s+=1)o.push(e[s]);return o},[])}}const rt=zr;function*Sg(n,e){for(var t=n;t<=e;++t)yield t}var _g=" ";class Ql{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}}function fs(n,e,t){return e=Jl(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jl(n){var e=ed(n,"string");return typeof e=="symbol"?e:String(e)}function ed(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class xn{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,s=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(s)}static isTimeString(e){return new RegExp(xn.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])}}fs(xn,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");fs(xn,"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"}]));const vs=xn;function td(n,e,t){return e=nd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nd(n){var e=rd(n,"string");return typeof e=="symbol"?e:String(e)}function rd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class id extends Error{constructor(){super(...arguments),td(this,"isInvalid",!0)}}const pn=id;function ps(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function pi(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function od(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){pi(o,r,i,s,a,"next",l)}function a(l){pi(o,r,i,s,a,"throw",l)}s(void 0)})}}var sd=$.module("useAsyncInterval");function ad(n,e){var t=ps(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),s=m.useCallback(od(function*(){var a=Date.now();i.current+=1;var l=o.current==null?e:a-o.current;o.current=a;try{yield n()}catch(c){sd.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),h=Math.max(0,e-u);r.current=window.setTimeout(s,h)}}),[n,t,e]);m.useEffect(()=>(o.current=null,s(),()=>{window.clearTimeout(r.current)}),[e,s])}function In(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 ld(n,e){var t=m.useMemo(()=>Tn(n,e),[n,e]);return m.useEffect(()=>()=>t.cancel(),[t]),t}function dd(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Kr(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var s,a;(s=(a=r.current)===null||a===void 0?void 0:a.flushOnUnmount)!==null&&s!==void 0&&s?o.flush():o.cancel()},[o]),o}function ud(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function gs(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}function gi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function hd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gi(Object(t),!0).forEach(function(r){Qt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qt(n,e,t){return e=cd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cd(n){var e=md(n,"string");return typeof e=="symbol"?e:String(e)}function md(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var bi="popper";class Vr extends m.Component{constructor(e){super(e),Qt(this,"element",void 0),Qt(this,"container",void 0),Qt(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=D.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=hd({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new gl(r||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var s=this.element.querySelector(".".concat(bi));s instanceof HTMLElement&&!s.contains(document.activeElement)&&s.focus()}}),this.setState({popper:e})}}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(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:o}=this.props,{show:s}=this.state;return d.jsx(Xo,{isPortal:!0,children:d.jsx(bl,{in:s,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:d.jsx("div",{onClick:a=>{a.stopPropagation()},onKeyDown:a=>{a.key==="Escape"&&this.hide()},className:j(bi,{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:d.jsxs("div",{className:"popper-content",children:[t,d.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return d.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Wr.createPortal(this.renderContent(),this.element)})}}Qt(Vr,"propTypes",{children:b.node.isRequired,options:b.shape({}),className:b.string,timeout:b.number,onEntered:b.func,onExited:b.func,isShown:b.bool,closeOnBlur:b.bool,interactive:b.bool,referenceObject:b.shape({}),"data-testid":b.string});Qt(Vr,"defaultProps",{options:{},className:"",timeout:Aa.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Gr=Vr;function yi(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 fd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yi(Object(t),!0).forEach(function(r){Ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):yi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ue(n,e,t){return e=vd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vd(n){var e=pd(n,"string");return typeof e=="symbol"?e:String(e)}function pd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var gd=$.module("Tooltip");class de extends m.Component{static handleHidden(){de.shownTooltipCount-=1,de.shownTooltipCount===0&&(de.lastHiddenTime=Date.now())}static handleShown(){de.shownTooltipCount+=1}constructor(e){super(e),Ue(this,"container",void 0),Ue(this,"popper",void 0),Ue(this,"parent",void 0),Ue(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=D.createRef(),this.popper=D.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?de.handleShown():de.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&de.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){gd.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),s=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=s.left&&t<=s.left+s.width&&r>=s.top&&r<=s.top+s.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(de.shownTooltipCount>0||Date.now()-de.lastHiddenTime<de.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(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":o,onEntered:s}=this.props,{isShown:a}=this.state,{options:l}=this.props;return l=fd({placement:"bottom"},l),d.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:d.jsx(Gr,{className:j(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:s,onExited:this.handleExited,interactive:e,referenceObject:r,children:d.jsxs("div",{className:"tooltip-content",children:[" ",a&&t]})})})}}Ue(de,"defaultTimeout",500);Ue(de,"defaultReshowTimeout",100);Ue(de,"triggerReshowThreshold",300);Ue(de,"shownTooltipCount",0);Ue(de,"lastHiddenTime",Date.now());Ue(de,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:de.defaultReshowTimeout,timeout:de.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const on=de;var bd=$.module("ThemeProvider"),bs=m.createContext(null);function Eg(n){var{themes:e,defaultPreloadValues:t=Ba,children:r}=n,i=m.useMemo(()=>Ra(),[]),[o,s]=m.useState(null),[a,l]=m.useState(()=>{var c,f;return(c=(f=ka())===null||f===void 0?void 0:f.themeKey)!==null&&c!==void 0?c:Fa}),u=m.useMemo(()=>e==null?null:ja(a,{base:i,custom:e??[]}),[i,a,e]),h=m.useMemo(()=>[...i,...e??[]],[i,e]);return m.useEffect(function(){if(!(u==null||e==null)){$a(t);var f=Ha(t);bd.debug2("updateThemePreloadData:",{active:u.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:f,selectedThemeKey:a}),Ua({themeKey:a,preloadStyleContent:f})}},[u,a,e,t]),m.useEffect(()=>{s({activeThemes:u,selectedThemeKey:a,themes:h,setSelectedThemeKey:l})},[u,a,h]),d.jsxs(d.Fragment,{children:[u==null?null:d.jsx(d.Fragment,{children:u.map(c=>d.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),o==null?null:d.jsx(bs.Provider,{value:o,children:d.jsx(Xo,{children:r})})]})}function ys(){return In(bs,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function ar(n){var{children:e,className:t,style:r,"data-testid":i}=n;return d.jsx("div",{className:j("btn-group",t),style:r,role:"group","data-testid":i,children:e})}ar.displayName="SplitButtonGroup";ar.propTypes={children:b.node.isRequired,className:b.string,style:b.object,"data-testid":b.string};ar.defaultProps={className:null,style:{},"data-testid":void 0};var yd=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Ci(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 wi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ci(Object(t),!0).forEach(function(r){Cd(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ci(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Cd(n,e,t){return e=wd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wd(n){var e=Sd(n,"string");return typeof e=="symbol"?e:String(e)}function Sd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function _d(n,e){if(n==null)return{};var t=Ed(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Ed(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Pd=["primary","secondary","tertiary","success","danger","inline","ghost"],Td=["group-end"];function Od(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 j("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function xd(n){switch(n){case"group-end":return j("pl-2","pr-3")}}var te=D.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:o,icon:s,disabled:a=!1,active:l,onClick:u,onContextMenu:h,onMouseDown:c,onMouseUp:f,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,className:y,style:_,children:S,tabIndex:C,"data-testid":I,"aria-label":U}=n,G=_d(n,yd),{UNSAFE_className:x}=yl({},"button"),K;r&&(K=xd(r));var A;s&&(A=D.isValidElement(s)?s:d.jsx(se,{icon:s}));var Y=A!=null&&S==null,Q=Od(t,Y),N;o!==void 0&&(N=typeof o=="string"?d.jsx(on,{children:o}):o);var W=U;U===void 0&&Y&&o!=null&&typeof o=="string"&&(W=o);var R=d.jsxs("button",wi(wi({"data-testid":I,ref:e,type:i,className:j("btn",Q,K,{active:l},y,x),onClick:u,onContextMenu:h,onMouseUp:f,onMouseDown:c,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,style:_,disabled:a,tabIndex:C,"aria-label":W},G),{},{children:[s&&A,S,o!=null&&!a&&N]}));return a&&o!=null?d.jsxs("span",{className:"btn-disabled-wrapper",children:[R,N]}):R});te.displayName="Button";te.propTypes={kind:b.oneOf(Pd).isRequired,variant:b.oneOf(Td),type:b.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!D.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:b.bool,active:b.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:b.func,onMouseUp:b.func,onMouseDown:b.func,onMouseEnter:b.func,onMouseLeave:b.func,onKeyDown:b.func,tabIndex:b.number,children:b.node,className:b.string,style:b.object,"data-testid":b.string};te.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const gn=te;function Cs(n){var{className:e,children:t,"data-testid":r}=n;return d.jsx("div",{className:j("modal-footer",e),"data-testid":r,children:t})}function Cn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:s,onModalDisable:a,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:f,"data-testid":v}=n,p=m.useRef(null),g=m.useRef(null),y=m.useCallback(()=>{g.current!==null&&g.current.checked&&a&&a(),o()},[o,a]),_=m.useCallback(()=>{var C;(C=p.current)===null||C===void 0||C.focus()},[]),S="";return e&&(S=typeof r=="function"?r():r),d.jsxs(Yo,{isOpen:e,onOpened:_,children:[d.jsx(Qo,{closeButton:!1,children:t}),d.jsx(Jo,{children:S}),d.jsxs(Cs,{children:[a&&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":v!==void 0?"".concat(v,"-checkbox-confirm"):void 0}),d.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),s&&d.jsx(gn,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:s,"data-testid":v!==void 0?"".concat(v,"-btn-discard"):void 0,children:h}),i&&d.jsx(gn,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":v!==void 0?"".concat(v,"-btn-cancel"):void 0,children:l}),d.jsxs(ar,{children:[d.jsx(gn,{kind:c?"danger":"primary",onClick:y,ref:p,"data-testid":v!==void 0?"".concat(v,"-btn-confirm"):void 0,children:u}),f]})]})]})}Cn.propTypes={isOpen:b.bool.isRequired,headerText:b.string.isRequired,bodyText:b.oneOfType([b.string,b.func]).isRequired,onCancel:b.func,onConfirm:b.func.isRequired,onDiscard:b.func,onModalDisable:b.func,cancelButtonText:b.string,confirmButtonText:b.string,discardButtonText:b.string,children:b.node,"data-testid":b.string};Cn.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};function Id(n,e,t){return e=Md(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Md(n){var e=Dd(n,"string");return typeof e=="symbol"?e:String(e)}function Dd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Cr(n){return n.then!==void 0}class St{static disableAllActions(){St.actionsDisabled=!0}static enableAllActions(){St.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,s;return((o=e.order)!==null&&o!==void 0?o:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var a,l;return((a=e.title)!==null&&a!==void 0?a:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(St.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return St.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=St.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var s=i[o],a=void 0;typeof s=="function"?a=s():a=s,a!=null&&(a instanceof Promise?t&&r.push(a):Array.isArray(a)?r=r.concat(a):r.push(a))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var s=(i+t*o+r.length)%r.length,a=r[s];if(!(a instanceof Promise)&&a.disabled!==!0)return s}return e}}Id(St,"actionsDisabled",!1);const xe=St;var Si=$.module("GlobalContextAction");class Nd 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),Si.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!xe.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;Si.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}const Ld=Nd;class Ad 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:s}=o;if(o.title!=null||o.menuElement||s){var a=d.jsx(Ld,{action:o,"data-testid":t},"".concat(o.title,".").concat(s==null?void 0:s.id));r.push(a)}}return r}}const Rd=Ad;function ws(n,e,t){return e=kd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kd(n){var e=Fd(n,"string");return typeof e=="symbol"?e:String(e)}function Fd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var jn=$.module("ContextActions");class Ss 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),ws(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=D.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=>!Cr(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!Cr(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,h=t.find(c=>u.contains(c));if(h!==void 0)return jn.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};r=r.parentElement};r!=null;){var o=i();if(typeof o=="object")return o.v}if(xe.isContextActionEvent(e)||(e.contextActions=[]),!!xe.isContextActionEvent(e)){var{actions:s}=this.props;if(s!=null){var a=s;Array.isArray(a)&&(a=a.filter(l=>Cr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(a)}jn.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(!xe.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;jn.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),jn.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(Rd,{actions:t})})}}ws(Ss,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const ne=Ss;var qr=D.forwardRef((n,e)=>{var t,r;function i(x){var{menuItem:K,onMenuItemClick:A}=n;A(K,x)}function o(x){var{menuItem:K,onMenuItemMouseMove:A}=n;A(K,x)}function s(x){var{menuItem:K,onMenuItemContextMenu:A}=n;A(K,x)}function a(x,K,A){if(typeof x.type=="string")return x;var{closeMenu:Y,menuItem:Q,isKeyboardSelected:N,isMouseSelected:W,"data-testid":R}=n,M={menuItem:Q,closeMenu:Y,isKeyboardSelected:N,isMouseSelected:W,iconElement:K,displayShortcut:A,"data-testid":R};return D.cloneElement(x,{forwardedProps:M})}var{children:l,menuItem:u,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":f}=n,v=(t=u.shortcutText)!==null&&t!==void 0?t:(r=u.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(u.icon){var g=u.icon;if(D.isValidElement(g))p=g;else{var y;u.iconColor!=null&&(u.disabled===void 0||!u.disabled)&&(y={color:u.iconColor}),p=d.jsx(se,{icon:g,style:y})}}var _=null,S=!!l;u.actions&&(_=d.jsx(se,{icon:Ka}));var C=null;if(u.menuElement)C=d.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:a(u.menuElement,p,v)});else{var I,U=u.disabled,G=u.iconOutline;C=d.jsx("button",{type:"button",className:j("btn-context-menu",{disabled:U},{active:(S||c)&&(U===void 0||!U)},{"keyboard-active":h&&(U===void 0||!U)}),onClick:i,onMouseMove:o,onContextMenu:s,title:(I=u.description)!==null&&I!==void 0?I:"",children:d.jsxs("div",{className:"btn-context-menu-wrapper",children:[d.jsx("span",{className:j("icon",{outline:G}),children:p}),d.jsx("span",{className:"title",children:u.title}),v!==void 0&&d.jsx("span",{className:"shortcut",children:v}),_&&d.jsx("span",{className:j("submenu-indicator",{disabled:U}),children:_})]})})}return d.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":f,children:[l,C]})});qr.displayName="ContextMenuItem";qr.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const jd=qr;var lr=D.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o,inputClassName:s,isInvalid:a,labelClassName:l,name:u,onChange:h,"data-testid":c}=n,[f]=m.useState(Nt()),v=gs(e);m.useEffect(function(){v.current&&(v.current.indeterminate=t===null)},[v,t]);var p=m.useCallback(g=>{v.current&&(v.current.indeterminate=t===null),h&&h(g)},[v,t,h]);return d.jsxs("div",{className:j("custom-control custom-checkbox",i),children:[d.jsx("input",{type:"checkbox",ref:v,checked:t??!1,className:j("custom-control-input",s,{"is-invalid":a}),disabled:o,id:f,name:u,onChange:p,"data-testid":c}),d.jsx("label",{className:j("custom-control-label",l),htmlFor:f,children:r})]})});lr.displayName="Checkbox";lr.propTypes={checked:(n,e)=>{var{[e]:t}=n;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:b.node.isRequired,className:b.string,disabled:b.bool,inputClassName:b.string,isInvalid:b.bool,labelClassName:b.string,name:b.string,onChange:b.func,"data-testid":b.string};lr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const $d=lr;function Qn(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function _s(n){return Qn(n)&&_s(n.WrappedComponent)?!0:n.prototype!=null&&n.prototype.isReactComponent!=null}function Hd(n){return!Qn(n)&&"$$typeof"in n&&n.$$typeof===Cl.ForwardRef}function Ud(n){return _s(n)||Hd(n)}function _i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Bd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_i(Object(t),!0).forEach(function(r){bn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_i(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bn(n,e,t){return e=Kd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kd(n){var e=Wd(n,"string");return typeof e=="symbol"?e:String(e)}function Wd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Es extends m.PureComponent{constructor(e){var t;super(e),bn(this,"container",void 0),bn(this,"oldFocus",void 0),bn(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=D.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=xe.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:xe.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}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var o;i=xe.getNextMenuItem((o=i)!==null&&o!==void 0?o:0,-1,t)}else if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var s;i=xe.getNextMenuItem((s=i)!==null&&s!==void 0?s:0,1,t)}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,menuItems:i,mouseIndex:o}=this.state,s=0;s<i.length;s+=1){var a=i[s];s>0&&a.group!==i[s-1].group&&e.push(d.jsx("hr",{},"".concat(s,".separator")));var l=d.jsx(jd,{isKeyboardSelected:r===s,isMouseSelected:o===s,menuItem:a,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},s);e.push(l)}var{menuStyle:u}=this.props;return d.jsx("div",{className:"context-menu-container",style:Bd({},u),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}bn(Es,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const zd=Es;function Ei(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 Pi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ei(Object(t),!0).forEach(function(r){Vt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ei(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Vt(n,e,t){return e=Vd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vd(n){var e=Gd(n,"string");return typeof e=="symbol"?e:String(e)}function Gd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ps extends m.PureComponent{constructor(e){super(e),Vt(this,"container",void 0),Vt(this,"parent",void 0),Vt(this,"popper",void 0),Vt(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=D.createRef(),this.parent=null,this.popper=D.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:s,popperOptions:a}=this.props;return a=Pi({placement:"bottom"},a),s=Pi({separateKeyboardMouse:!0},s),d.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:d.jsx(Gr,{ref:this.popper,options:a,className:j("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:d.jsx(zd,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:s,menuStyle:o})})})}}Vt(Ps,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const Zr=Ps;function bt(n,e,t){return e=qd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qd(n){var e=Zd(n,"string");return typeof e=="symbol"?e:String(e)}function Zd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ti=$.module("Shortcut"),O;(function(n){n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT"})(O||(O={}));var w;(function(n){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"})(w||(w={}));var Xd=new Set([w.ENTER,w.DELETE,w.F1,w.F2,w.F3,w.F4,w.F5,w.F6,w.F7,w.F8,w.F9,w.F10,w.F11,w.F12]);class ae extends as{static isAllowedKey(e){return Object.values(w).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!ae.isMacPlatform&&e.metaKey||!ae.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Xd.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 O.CTRL:t.ctrlKey=!0;break;case O.ALT:case O.OPTION:t.altKey=!0;break;case O.CMD:t.metaKey=!0;break;case O.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="":!ae.isAllowedKey(t)&&ae.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===w.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 w.ENTER:t+="⏎";break;case w.ESCAPE:t+="⎋";break;case w.BACKSPACE:t+="⌫";break;case w.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?"":ae.isMacPlatform?ae.getMacDisplayText(e):ae.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:s,tooltip:a}=e;super(),bt(this,"id",void 0),bt(this,"name",void 0),bt(this,"tooltip",void 0),bt(this,"isEditable",void 0),bt(this,"defaultKeyState",void 0),bt(this,"keyState",void 0),this.id=t,this.name=s,this.tooltip=a,this.isEditable=o;var l=ae.isMacPlatform,u=l?i:r;this.defaultKeyState=ae.createKeyState(u),this.keyState=this.defaultKeyState}getDisplayText(){return ae.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){ae.isValidKeyState(e)?(Ti.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new ms("onUpdate",{detail:this}))):Ti.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ae.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ae.NULL_KEY_STATE)}isNull(){return ae.doKeyStatesMatch(this.keyState,ae.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return ae.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(ae.getKeyStateFromEvent(e))}}bt(ae,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});bt(ae,"isMacPlatform",xe.isMacPlatform());function Oi(n,e,t){return e=Yd(e),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:String(e)}function Qd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var xi=$.module("ShortcutRegistry");class Jd extends as{constructor(){super(...arguments),Oi(this,"shortcutMap",new Map),Oi(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new ae(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return xi.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;xi.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:s}=o;return this.dispatchEvent(new ms("onUpdate",{detail:s}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var eu=Object.freeze(new Jd);const oe=eu;var tu={COPY:oe.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[O.CTRL,w.C],macShortcut:[O.CMD,w.C],isEditable:!1}),PASTE:oe.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[O.CTRL,w.V],macShortcut:[O.CMD,w.V],isEditable:!1}),SAVE:oe.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[O.CTRL,w.S],macShortcut:[O.CMD,w.S],isEditable:!1}),SELECT_ALL:oe.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[O.CTRL,w.A],macShortcut:[O.CMD,w.A],isEditable:!1}),REOPEN_CLOSED_PANEL:oe.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[O.ALT,O.SHIFT,w.T],macShortcut:[O.OPTION,O.SHIFT,w.T],isEditable:!0}),LINKER:oe.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[O.CTRL,w.L],macShortcut:[O.CMD,w.L]}),LINKER_CLOSE:oe.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[w.ESCAPE],macShortcut:[w.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:oe.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[O.CTRL,O.ALT,w.I],macShortcut:[O.CMD,O.SHIFT,w.I],isEditable:!0}),NEXT:oe.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[w.ENTER],macShortcut:[w.ENTER],isEditable:!1}),PREVIOUS:oe.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[O.SHIFT,w.ENTER],macShortcut:[O.SHIFT,w.ENTER],isEditable:!1})};const Gt=tu;function Dr(n,e,t){return e=nu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nu(n){var e=ru(n,"string");return typeof e=="symbol"?e:String(e)}function ru(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ts extends m.PureComponent{constructor(e){super(e),Dr(this,"inputField",void 0),Dr(this,"searchChangeSelection",void 0),this.inputField=D.createRef(),this.searchChangeSelection=D.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,onBlur:r,onChange:i,className:o,disabled:s,matchCount:a,id:l,onKeyDown:u,"data-testid":h,cursor:c}=this.props,f,v=[{action:()=>c==null?void 0:c.next("forward"),shortcut:Gt.NEXT},{action:()=>c==null?void 0:c.next("back"),shortcut:Gt.PREVIOUS}];return c&&a>1?f=d.jsxs(d.Fragment,{children:[d.jsx(gn,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("back")},icon:es,tooltip:"Previous match (".concat(Gt.PREVIOUS.getDisplayText(),")")}),d.jsxs("span",{className:"search-change-text",children:[c.index!==void 0&&"".concat(c.index+1," of "),a]}),d.jsx(gn,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("forward")},icon:Wa,tooltip:"Next match (".concat(Gt.NEXT.getDisplayText(),")")})]}):f=a>0&&d.jsx("span",{className:"search-match",children:a}),d.jsxs("div",{className:j("search-group",o),children:[d.jsx("input",{type:"search",value:e,onBlur:r,onChange:i,onKeyDown:u,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),a!=null?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),d.jsx(ne,{actions:v})]}):d.jsx("span",{className:"search-icon",children:d.jsx(se,{icon:za})})]})}}Dr(Ts,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});const Xr=Ts;function Os(n,e,t){return e=iu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function iu(n){var e=ou(n,"string");return typeof e=="symbol"?e:String(e)}function ou(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class xs extends m.PureComponent{constructor(e){super(e),Os(this,"searchInput",void 0),this.searchInput=D.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Tn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":o}=this.props,{value:s}=this.state;return d.jsx(Xr,{value:s,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}Os(xs,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const su=xs;function Is(n,e,t){return e=au(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function au(n){var e=lu(n,"string");return typeof e=="symbol"?e:String(e)}function lu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var du=$.module("ItemListItem");class dr extends m.Component{static handleKeyDown(){return du.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Is(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=D.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":s}=this.props;return d.jsx("div",{className:j("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:dr.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":s,children:o})}}Is(dr,"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:{}});const uu=dr;function Ii(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Mi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ii(Object(t),!0).forEach(function(r){Re(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ii(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Re(n,e,t){return e=hu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hu(n){var e=cu(n,"string");return typeof e=="symbol"?e:String(e)}function cu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Di=$.module("ItemList"),Ni=5;class Ie 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),Re(this,"list",void 0),Re(this,"listContainer",void 0),Re(this,"getItemSelected",Kt((i,o)=>rt.isSelected(o,i),{max:Ie.CACHE_SIZE})),Re(this,"getCachedItem",Kt((i,o,s,a,l,u,h,c)=>{var f=u({item:s,itemIndex:i,isFocused:a,isSelected:l,style:h});return d.jsx(uu,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:a,isSelected:l,itemIndex:i,style:h,children:f},o)},{max:Ie.CACHE_SIZE})),Re(this,"getOuterElement",Kt(i=>{var o=D.forwardRef((s,a)=>d.jsx("div",Mi({ref:a,tabIndex:-1,onKeyDown:i,role:"presentation"},s)));return o.displayName="ItemListOuterElement",o})),Re(this,"getInnerElement",Kt(()=>{var i=D.forwardRef((o,s)=>d.jsx("div",Mi({className:"item-list-inner-element",ref:s},o)));return i.displayName="ItemListInnerElement",i})),Re(this,"getItemData",Kt((i,o,s)=>({items:i,selectedRanges:o,renderItem:s}))),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=D.createRef(),this.listContainer=D.createRef();var{isStickyBottom:t,selectedRanges:r}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:r,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:s,scrollOffset:a,height:l,selectedRanges:u}=this.state;if(s&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(a!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==u)this.setSelectedRanges(r);else if(u!==t.selectedRanges){var{onSelectionChange:h}=this.props;h(u)}if(o!==t.focusIndex){var{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex: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=rt.isSelected(r,e),o=i||xe.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:s}=o;return{selectedRanges:rt.selectRange(s,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Di.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){Di.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:s,selectedRanges:a,mouseX:l,mouseY:u}=this.state;if(!(s==null||o)){var h=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(u??0));h>Ni&&c>Ni&&this.setState({isDragging:!0}),(r||s===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,a)&&!xe.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(s,e),Math.max(s,e)])):this.toggleSelect(e,t.shiftKey,xe.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:s,isDragging:a}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(s===e&&!a){var l=t.shiftKey,u=xe.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,s=o;if(e.key==="Enter"||e.key===" "){!t&&s!=null&&this.setState({selectedRanges:[[s,s]]},()=>{s!=null&&i(s,e)});return}if(e.key==="ArrowUp")s!=null&&s>=0?s=Math.max(0,s-1):s=r-1;else if(e.key==="ArrowDown")s!=null&&s>=0?s=Math.min(s+1,r-1):s=0;else return;if(o!==s){e.stopPropagation(),e.preventDefault(),this.focusItem(s);var{selectedRanges:a}=this.state;if(e.shiftKey&&a.length>0){var l=a[a.length-1];this.selectRange([Math.min(s,l[0]),Math.max(s,l[1])])}else if(this.deselectAll(),s!==null)this.selectItem(s);else{var u;(u=this.listContainer.current)===null||u===void 0||u.focus()}this.scrollIntoView(s)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:s}=i,a=o&&this.isListAtBottom({scrollOffset:r,height:s});return{isStuckToBottom:a,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:s}=this.state;if(o&&t&&s.length>0){var a=s[s.length-1];this.selectRange([Math.min(a[0],e),Math.max(e,a[1])])}else o&&s.length===1&&s[0][0]===e&&s[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,s)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){rt.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:rt.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){rt.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:rt.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),s=o+Math.ceil(t/i);r(o,s)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:s,disableSelect:a}=this.props,{focusIndex:l,selectedRanges:u}=this.state;if(t<o||t>=o+i.length)return null;var h=i[t-o];return this.getCachedItem(t,t,h,t===l&&!a,this.getItemSelected(t,u),s,r,a)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":s}=this.props,{selectedRanges:a,isStuckToBottom:l}=this.state;return d.jsx(wl,{className:"item-list-auto-sizer",onResize:this.handleResize,children:u=>{var{width:h,height:c}=u;return d.jsx(Sl,{className:"item-list-scroll-pane",height:c,width:h,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,a,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":s,children:this.renderInnerElement})}})}}Re(Ie,"CACHE_SIZE",1e3);Re(Ie,"DEFAULT_ROW_HEIGHT",20);Re(Ie,"DEFAULT_OVERSCAN",10);Re(Ie,"defaultProps",{offset:0,items:[],rowHeight:Ie.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ie.DEFAULT_OVERSCAN,renderItem:Ie.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var mu=$.module("ErrorBoundary");class fu 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;mu.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(Pn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function vu(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:s,"data-testid":a}=n;return d.jsx("button",{type:"button",className:j("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:s,disabled:o,"data-testid":a,children:d.jsx("div",{className:"handle"})})}var pu=["children","className","isInvalid","onChange","data-testid"];function Li(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 Ai(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Li(Object(t),!0).forEach(function(r){gu(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Li(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gu(n,e,t){return e=bu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bu(n){var e=yu(n,"string");return typeof e=="symbol"?e:String(e)}function yu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Cu(n,e){if(n==null)return{};var t=wu(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function wu(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Ms=D.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":s}=n,a=Cu(n,pu),l=gs(e),u=m.useCallback(h=>{o(h.target.value)},[o]);return d.jsx("select",Ai(Ai({ref:l,className:j("custom-select",r,{"is-invalid":i}),onChange:u,"data-testid":s},a),{},{children:t}))});Ms.displayName="Select";const Su=Ms;function _u(){return In(Va,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Ds(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Ns(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function Pg(n){return Ds(n)||Ns(n)}var Eu=m.createContext(null);function Tg(n){if(Ns(n))return{id:n.id,type:n.type};if(Ds(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function Pu(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 Og(){return In(Eu,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function Ri(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ri(Object(t),!0).forEach(function(r){Ou(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ri(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ou(n,e,t){return e=xu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xu(n){var e=Iu(n,"string");return typeof e=="symbol"?e:String(e)}function Iu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mu=Object.freeze({}),Du=new Map,xg=n=>n.api,Ig=n=>n.user,Ls=n=>n.storage,As=n=>Ls(n).commandHistoryStorage,Nu=n=>Ls(n).fileStorage,Lu=n=>n.defaultWorkspaceSettings,Rs=n=>{var{workspace:e}=n;return e},ks=_l(n=>{for(var e,t,r=(e=(t=Rs(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=Tu({},Lu(n)),o=Object.keys(r),s=0;s<o.length;s+=1){var a=o[s];r[a]!==void 0&&(i[a]=r[a])}return i}),Au=n=>ks(n).timeZone,Mg=n=>{var e;return(e=ks(n).defaultNotebookSettings)!==null&&e!==void 0?e:Mu},Dg=n=>n.activeTool,Ru=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:Du},ku="SET_ACTIVE_TOOL",Fu="SET_API",Ng="SET_COMMAND_HISTORY_STORAGE",Lg="SET_FILE_STORAGE",Ag="SET_PLUGINS",ju="SET_USER",$u="SET_WORKSPACE",Hu="SET_DEFAULT_WORKSPACE_SETTINGS",Rg="SET_WORKSPACE_STORAGE",Uu="SET_SERVER_CONFIG_VALUES";function ki(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ot(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ki(Object(t),!0).forEach(function(r){Bu(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ki(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bu(n,e,t){return e=Ku(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ku(n){var e=Wu(n,"string");return typeof e=="symbol"?e:String(e)}function Wu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kg=n=>({type:ju,payload:n}),Fg=n=>({type:Fu,payload:n}),Fs=n=>({type:$u,payload:n}),jg=n=>({type:Hu,payload:n}),zu=n=>(e,t)=>{e(Fs(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i==null?void 0:i.save(n)},Vu=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=Ot(Ot({},r),{},{data:Ot(Ot(Ot({},i),n),{},{settings:Ot(Ot({},i==null?void 0:i.settings),n.settings)})});return e(zu(o))},$g=n=>e=>e(Vu({settings:n})),Hg=n=>({type:ku,payload:n}),Ug=n=>({type:Uu,payload:n});function Fi(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 ji(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fi(Object(t),!0).forEach(function(r){Gu(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Gu(n,e,t){return e=qu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qu(n){var e=Zu(n,"string");return typeof e=="symbol"?e:String(e)}function Zu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");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 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.type){case n:{var{id:o,payload:s}=i;return t&&Ir({payload:s},{payload:r[o]})?r:ji(ji({},r),{},{[o]:s})}default:return r}}}function $i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Hi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$i(Object(t),!0).forEach(function(r){Nr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$i(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Nr(n,e,t){return e=Yu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yu(n){var e=Qu(n,"string");return typeof e=="symbol"?e:String(e)}function Qu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ju{constructor(){Nr(this,"reducers",{}),Nr(this,"listener",null)}register(e,t){var r;this.reducers=Hi(Hi({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var eh=new Ju;const th=eh;function Yr(n,e,t){return e=nh(e),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:String(e)}function rh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ur{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""}}Yr(ur,"TYPE_GLOBAL","type-global");Yr(ur,"TYPE_CONTEXT_PRESET","type-context-preset");Yr(ur,"TYPE_CONTEXT_CUSTOM","type-context-custom");const Xe=ur;function yt(n,e,t){return e=ih(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ih(n){var e=oh(n,"string");return typeof e=="symbol"?e:String(e)}function oh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ui=$.module("DateTimeColumnFormatter");class st extends Xe{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]:Xe.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=st.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=st.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=st.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),yt(this,"dh",void 0),yt(this,"dhTimeZone",void 0),yt(this,"defaultDateTimeFormatString",void 0),yt(this,"showTimeZone",void 0),yt(this,"showTSeparator",void 0),yt(this,"formatStringMap",void 0);var s=t||st.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(s)}catch{Ui.error("Unsupported time zone id",s),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(st.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=st.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{Ui.error("Invalid format arguments")}return""}}yt(st,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");yt(st,"DEFAULT_TIME_ZONE_ID","America/New_York");function Ye(n,e,t){return e=sh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sh(n){var e=ah(n,"string");return typeof e=="symbol"?e:String(e)}function ah(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lh=$.module("DecimalColumnFormatter");class ue extends Xe{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]:Xe.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 ue.makeFormat(e,t,Xe.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 ue.makeFormat("Custom Format",e,Xe.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=ue.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ye(this,"defaultFormatString",void 0),Ye(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{lh.error("Invalid format arguments")}return""}}Ye(ue,"DEFAULT_FORMAT_STRING","###,##0.0000");Ye(ue,"FORMAT_PERCENT",ue.makePresetFormat("Percent","##0.00%"));Ye(ue,"FORMAT_BASIS_POINTS",ue.makePresetFormat("Basis Points","###,##0 bp",1e4));Ye(ue,"FORMAT_MILLIONS",ue.makePresetFormat("Millions","###,##0.000 mm",1e-6));Ye(ue,"FORMAT_SCIENTIFIC_NOTATION",ue.makePresetFormat("Scientific Notation","0.0000E0"));Ye(ue,"FORMAT_ROUND",ue.makePresetFormat("Round","###,##0"));Ye(ue,"FORMAT_ROUND_TWO_DECIMALS",ue.makePresetFormat("0.00","###,##0.00"));Ye(ue,"FORMAT_ROUND_FOUR_DECIMALS",ue.makePresetFormat("0.0000","###,##0.0000"));function wn(n,e,t){return e=dh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dh(n){var e=uh(n,"string");return typeof e=="symbol"?e:String(e)}function uh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var hh=$.module("IntegerColumnFormatter");class ut extends Xe{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]:Xe.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 ut.makeFormat(e,t,Xe.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 ut.makeFormat("Custom Format",e,Xe.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=ut.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),wn(this,"dh",void 0),wn(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{hh.error("Invalid format arguments")}return""}}wn(ut,"DEFAULT_FORMAT_STRING","###,##0");wn(ut,"FORMAT_MILLIONS",ut.makePresetFormat("Millions","###,##0.000 mm",1e-6));wn(ut,"FORMAT_SCIENTIFIC_NOTATION",ut.makePresetFormat("Scientific Notation","0.0000E0"));var ch=m.createContext(null),Mn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function mh(n){return"DashboardPlugin"in n}function fh(n){return"AuthPlugin"in n}function vh(n){return"TablePlugin"in n}function Bg(n){return mh(n)||fh(n)||vh(n)}function ph(n){return"type"in n&&n.type===Mn.DASHBOARD_PLUGIN}function Qr(n){return"type"in n&&n.type===Mn.WIDGET_PLUGIN}function gh(n){return"type"in n&&n.type===Mn.TABLE_PLUGIN}function bh(n){return"type"in n&&n.type===Mn.AUTH_PLUGIN}function js(n){return"type"in n&&n.type===Mn.THEME_PLUGIN}function Kg(n){return ph(n)||bh(n)||gh(n)||js(n)||Qr(n)}var yh=$.module("@deephaven/plugin.PluginUtils");function Bi(n,e){return n==null||!Qr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function Ch(n){var e=d.jsx(se,{icon:ts});if(!Qr(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:d.jsx(se,{icon:t})}function Wg(n){var e=[...n.entries()].filter(t=>js(t[1]));return yh.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(s=>{var{name:a,baseTheme:l,styleContent:u}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Ga(r,a),name:a,styleContent:u}})}).flat()}function zg(){return In(ch,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}const wh="var(--dh-color-chart-colorway)",Sh="var(--dh-color-chart-grid)",_h="var(--dh-color-chart-axis-line)",Eh="var(--dh-color-chart-axis-line-zero)",Ki={"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:wh,gridcolor:Sh,linecolor:_h,zerolinecolor:Eh,"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)"};var Wi=$.module("ChartTheme");function Ph(){var n,e=ns(Ki);return e.colorway=qa((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Za.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Wi.debug2("Chart theme:",Ki),Wi.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"]})}function zi(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?zi(Object(t),!0).forEach(function(r){Oh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):zi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Oh(n,e,t){return e=xh(e),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:String(e)}function Ih(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mh=m.lazy(()=>El(()=>import("./Plot-74bd29ee.js"),["./Plot-74bd29ee.js","./Plotly-553bb1c7.js","./plotly-6b2849c1.js","./helpers-de833af9.js","./vendor-e852bd02.js","./vendor-bd6e7036.css"],import.meta.url));function Dh(n){return d.jsx(m.Suspense,{fallback:d.jsx(Pn,{}),children:d.jsx(Mh,Th({},n))})}var $s=m.createContext(null);function Vg(n){var{children:e}=n,{activeThemes:t}=ys(),r=m.useMemo(Ph,[t]);return d.jsx($s.Provider,{value:r,children:e})}function Nh(){return In($s,"No ChartThemeContext value found.")}var Hs=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 Us(n){return n.componentName!==void 0}function Lh(n){return n.component!==void 0}var Bs=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Ah=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Hs,isGLComponentConfig:Us,isReactComponentConfig:Lh,itemDefaultConfig:Bs},Symbol.toStringTag,{value:"Module"}));function Xn(n,e,t){return e=Rh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rh(n){var e=kh(n,"string");return typeof e=="symbol"?e:String(e)}function kh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Sn{constructor(){Xn(this,"_mSubscriptions",void 0),Xn(this,"off",this.unbind),Xn(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Sn.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var s=0;s<t.length;s++){var a=t[s].ctx||{};try{t[s].fn.apply(a,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Sn.ALL_EVENT],u=0;u<l.length;u++){var h=l[u].ctx||{};try{l[u].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,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)}}Xn(Sn,"ALL_EVENT","__all");const Ke=Sn;function $e(n,e,t){return e=Fh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fh(n){var e=jh(n,"string");return typeof e=="symbol"?e:String(e)}function jh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Lr extends Ke{constructor(e,t,r){super(),$e(this,"width",void 0),$e(this,"height",void 0),$e(this,"title",void 0),$e(this,"parent",void 0),$e(this,"layoutManager",void 0),$e(this,"tab",void 0),$e(this,"_config",void 0),$e(this,"isHidden",!1),$e(this,"beforeCloseHandler",void 0),$e(this,"_element",T(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),$e(this,"_contentElement",void 0),this.title=Us(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,o,s=this.parent,a=null;s&&!s.isColumn&&!s.isRow;){var l;if(a=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!a)return!1;for(var u=s.isColumn?"height":"width",h=u==="height"?t:e,c=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=a.config[u])!==null&&i!==void 0?i:0)/100)),f=h/c*100,v=(((o=a.config[u])!==null&&o!==void 0?o:0)-f)/(s.contentItems.length-1),p=0;p<s.contentItems.length;p++)if(s.contentItems[p]===a)s.contentItems[p].config[u]=f;else{var g;s.contentItems[p].config[u]=((g=s.contentItems[p].config[u])!==null&&g!==void 0?g:0)+v}return s.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(T.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var 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 $h=Object.freeze(Object.defineProperty({__proto__:null,Container:Lr,ItemContainer:Lr},Symbol.toStringTag,{value:"Module"}));function Ks(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Ws(n){if(window.location.hash)return Ks(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 Jr(n){return window.requestAnimationFrame(n)}function Hh(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 Jn(){return Nt()}function Uh(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 ei(n){return T.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ee(n,e,t){return e=Bh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bh(n){var e=Kh(n,"string");return typeof e=="symbol"?e:String(e)}function Kh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wh extends Ke{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ee(this,"_eElement",void 0),Ee(this,"_oDocument",void 0),Ee(this,"_eBody",void 0),Ee(this,"_destroyAfterMouseUp",void 0),Ee(this,"_nDelay",400),Ee(this,"_timeout",void 0),Ee(this,"timeout",void 0),Ee(this,"_nDistance",10),Ee(this,"_nX",0),Ee(this,"_nY",0),Ee(this,"_nOriginalX",0),Ee(this,"_nOriginalY",0),Ee(this,"_bDragging",!1),this._eElement=e,this._oDocument=T(document),this._eBody=T(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,o,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=s.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,o,s;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(o=i.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var a;(a=this._eElement)===null||a===void 0||a.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.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}}}const Dn=Wh;function Ht(n,e,t){return e=zh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zh(n){var e=Vh(n,"string");return typeof e=="symbol"?e:String(e)}function Vh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zs{constructor(e,t){Ht(this,"_container",void 0),Ht(this,"_reactComponent",null),Ht(this,"_portalComponent",null),Ht(this,"_originalComponentWillUpdate",null),Ht(this,"_initialState",void 0),Ht(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Wr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=T.extend(e,this._container._config.props);return D.createElement(this._reactClass,t)}}var er=["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"],Gh=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ti(n){if(er.length>36)throw new Error("Too many keys in config minifier map");var e={};return ni(n,e,"_min"),e}function Ar(n){if(er.length>36)throw new Error("Too many keys in config minifier map");var e={};return ni(n,e,"_max"),e}function ni(n,e,t){var r=t==="_min"?qh:Zh;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var s=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=s;else{var a=r(i,er);e[a]=s}ni(o,s,t)}else{var l=r(o,Gh);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,er);e[u]=l}}}}function qh(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Zh(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function wr(n,e,t){return e=Xh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xh(n){var e=Yh(n,"string");return typeof e=="symbol"?e:String(e)}function Yh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rr{constructor(e,t){wr(this,"name",void 0),wr(this,"origin",void 0),wr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function $n(n,e,t){return e=Qh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qh(n){var e=Jh(n,"string");return typeof e=="symbol"?e:String(e)}function Jh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let ec=class extends Ke{constructor(e){super(),$n(this,"_layoutManager",void 0),$n(this,"_dontPropagateToParent",void 0),$n(this,"_childEventSource",void 0),$n(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ke.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),T(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){T(window).off("gl_child_event",this._boundOnEventFromChild)}};const Vs=ec;function ri(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function Gs(n){return(e,t)=>ri(e,n,t)}function qs(n){return(e,t)=>{e.emit(n,t)}}function Zs(n){return(e,t)=>{m.useEffect(()=>ri(e,n,t),[e,t])}}function Xs(n){return{listen:Gs(n),emit:qs(n),useListener:Zs(n)}}const tc=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Rr,DragListener:Dn,EventEmitter:Ke,EventHub:Vs,ReactComponentHandler:zs,animFrame:Jr,filterXss:Uh,getHashValue:Ks,getQueryStringParam:Ws,getUniqueId:Jn,listenForEvent:ri,makeEmitFunction:qs,makeEventFunctions:Xs,makeListenFunction:Gs,makeUseListenerFunction:Zs,minifyConfig:ti,removeFromArray:Hh,stripTags:ei,unminifyConfig:Ar},Symbol.toStringTag,{value:"Module"}));function vt(n,e,t){return e=nc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nc(n){var e=rc(n,"string");return typeof e=="symbol"?e:String(e)}function rc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ys extends Ke{constructor(e,t,r,i,o){super(),vt(this,"isInitialised",!1),vt(this,"_config",void 0),vt(this,"_dimensions",void 0),vt(this,"_parentId",void 0),vt(this,"_indexInParent",void 0),vt(this,"_layoutManager",void 0),vt(this,"_popoutWindow",null),vt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,s,a,l,u,h,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&r!==void 0?r:0,top:(a=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&a!==void 0?a:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=T.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;T(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Jn();e=ti(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 fe(n,e,t){return e=ic(e),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:String(e)}function oc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ft extends Ke{constructor(e,t,r,i,o,s){var a,l,u,h,c,f,v,p;if(super(),fe(this,"_dragListener",void 0),fe(this,"_layoutManager",void 0),fe(this,"_contentItem",void 0),fe(this,"_originalParent",void 0),fe(this,"_area",null),fe(this,"_lastValidArea",null),fe(this,"_minX",void 0),fe(this,"_maxX",void 0),fe(this,"_minY",void 0),fe(this,"_maxY",void 0),fe(this,"_width",void 0),fe(this,"_height",void 0),fe(this,"_sided",void 0),fe(this,"element",void 0),fe(this,"childElementContainer",void 0),fe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=T(Ft._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",ei((a=this._contentItem.config.title)!==null&&a!==void 0?a:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),T(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var _,S;this._layoutManager.tabDropPlaceholder.width((_=this._proxyTab.outerWidth(!0))!==null&&_!==void 0?_:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var C=this._layoutManager.container.offset();this._minX=(u=C==null?void 0:C.left)!==null&&u!==void 0?u:0,this._minY=(h=C==null?void 0:C.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(v=this.element.width())!==null&&v!==void 0?v: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,s=(i=r.pageX)!==null&&i!==void 0?i:0,a=(o=r.pageY)!==null&&o!==void 0?o:0,l=s>this._minX&&s<this._maxX&&a>this._minY&&a<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,a)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}fe(Ft,"_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 Hn(n,e,t){return e=sc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sc(n){var e=ac(n,"string");return typeof e=="symbol"?e:String(e)}function ac(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Qs{constructor(e,t,r){Hn(this,"_element",void 0),Hn(this,"_itemConfig",void 0),Hn(this,"_layoutManager",void 0),Hn(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Dn(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(T.extend(!0,{},r));new Ft(e,t,this._dragListener,this._layoutManager,i,null)}}function Un(n,e,t){return e=lc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lc(n){var e=dc(n,"string");return typeof e=="symbol"?e:String(e)}function dc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Js{constructor(e,t,r){Un(this,"_element",T(window)),Un(this,"_itemConfig",void 0),Un(this,"_layoutManager",void 0),Un(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Dn(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(T.extend(!0,{},r));new Ft(e,t,this._dragListener,this._layoutManager,i,null)}}}function ea(n,e,t){return e=uc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uc(n){var e=hc(n,"string");return typeof e=="symbol"?e:String(e)}function hc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nn{constructor(){ea(this,"element",T(Nn._template)),T(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}ea(Nn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Sr(n,e,t){return e=cc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cc(n){var e=mc(n,"string");return typeof e=="symbol"?e:String(e)}function mc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cn{constructor(e,t,r,i){Sr(this,"element",void 0),Sr(this,"_header",void 0),Sr(this,"_action",void 0),this._header=e,this.element=T('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function fc(n,e,t){return e=vc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vc(n){var e=pc(n,"string");return typeof e=="symbol"?e:String(e)}function pc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gc extends Error{constructor(e,t){super(),fc(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Dt=gc,bc=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Dt},Symbol.toStringTag,{value:"Module"}));function ce(n,e,t){return e=yc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yc(n){var e=Cc(n,"string");return typeof e=="symbol"?e:String(e)}function Cc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function At(n){return n.isStack}function ke(n){return n.isComponent}function ta(n){return n.isRoot}class pe extends Ke{constructor(e,t,r,i){super(),ce(this,"config",void 0),ce(this,"type",void 0),ce(this,"contentItems",void 0),ce(this,"parent",void 0),ce(this,"layoutManager",void 0),ce(this,"element",void 0),ce(this,"childElementContainer",void 0),ce(this,"componentName",void 0),ce(this,"isInitialised",!1),ce(this,"isMaximised",!1),ce(this,"isRoot",!1),ce(this,"isRow",!1),ce(this,"isColumn",!1),ce(this,"isStack",!1),ce(this,"isComponent",!1),ce(this,"tab",void 0),ce(this,"_pendingEventPropagations",void 0),ce(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(Ke.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,At(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(o){for(var s=0;s<o.contentItems.length;s++)e(o.contentItems[s])===!0&&t.push(o.contentItems[s]),i(o.contentItems[s])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&ke(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},s=(r=e.width())!==null&&r!==void 0?r:0,a=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+s,y2:o.top+a,surface:s*a,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new Rr(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Dt("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(Bs)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof Rr&&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,Jr(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function dn(n,e,t){return e=wc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:String(e)}function Sc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class na extends pe{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(a=>{var[l,u]=a;t[l]===void 0&&(t[l]=u)}),super(e,t,r,T()),dn(this,"config",void 0),dn(this,"componentName",void 0),dn(this,"container",void 0),dn(this,"parent",void 0),dn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),s=T.extend(!0,{},this.config.componentState||{});if(o==null)throw new Dt('Unknown component "'+this.config.componentName+'"');s.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Lr(this.config,this,e),this.instance=new o(this.container,s),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){pe.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),pe.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),pe.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),pe.prototype._$destroy.call(this)}_$getArea(){return null}}function De(n,e,t){return e=_c(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _c(n){var e=Ec(n,"string");return typeof e=="symbol"?e:String(e)}function Ec(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _n extends pe{constructor(e,t,r,i){super(t,r,i,T('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),De(this,"isRow",void 0),De(this,"isColumn",void 0),De(this,"childElementContainer",void 0),De(this,"parent",void 0),De(this,"_splitter",[]),De(this,"_splitterSize",void 0),De(this,"_splitterGrabSize",void 0),De(this,"_isColumn",void 0),De(this,"_dimension",void 0),De(this,"_splitterPosition",null),De(this,"_splitterMinPosition",null),De(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,o,s,a;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(a),a.after(e.element)):(this.contentItems[0].element.before(a),a.before(e.element))):this.childElementContainer.append(e.element),pe.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[s].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,o=this.contentItems.indexOf(e),s=Math.max(o-1,0),a,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),a=0;a<this.contentItems.length;a++)if(this.contentItems[a]!==e){var u;this.contentItems[a].config[this._dimension]=((u=this.contentItems[a].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}if(pe.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=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(pe.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,s=0,a=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,h,c=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));s+=c,a.push(c)}var f=Math.floor((this._isColumn?o:i)-s);return{itemSizes:a,additionalPixel:f,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var s=0;s<t.length;s++)t[s].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var a=0;a<t.length;a++)t[a].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var 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,s=0,a=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=u.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},r.push(l)),a.push(l)}if(!(o===0||o>i)){var f=o/i;s=o;for(var v=0;v<r.length;v++){l=r[v];var p=Math.round((l.width-t)*f);s-=p,l.width-=p}s!==0&&(a[a.length-1].width-=s);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=a[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new ra(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var o,s;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((s=e[i].minHeight)!==null&&s!==void 0?s:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,s=this._getItemsForSplitter(e),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((r=s.after.config.content)!==null&&r!==void 0?r:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=s.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||a)),this._splitterMaxPosition=((o=s.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||a)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,s,a=this._getItemsForSplitter(e),l=(t=a.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=a.after.element[this._dimension]())!==null&&r!==void 0?r:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),c=((o=a.before.config[this._dimension])!==null&&o!==void 0?o:0)+((s=a.after.config[this._dimension])!==null&&s!==void 0?s:0);a.before.config[this._dimension]=h*c,a.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Jr(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Vi(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 Gi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vi(Object(t),!0).forEach(function(r){kr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Vi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function kr(n,e,t){return e=Pc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pc(n){var e=Tc(n,"string");return typeof e=="symbol"?e:String(e)}function Tc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Fr extends pe{constructor(e,t,r){super(e,Gi(Gi({},t),{},{type:"root"}),null,T('<div class="lm_goldenlayout lm_item lm_root"></div>')),kr(this,"childElementContainer",void 0),kr(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(ke(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,o=i==="left"||i==="right"?"row":"column",s=i==="left"||i==="right"?"width":"height",a=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof _n)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,a?0:void 0,!0),u.addChild(l,a?void 0:0,!0),l.config[s]=50,e.config[s]=50,u.callDownwards("setSize")}else{var h,c=l.contentItems[a?0:l.contentItems.length-1];l.addChild(e,a?0:void 0,!0),c.config[s]=((h=c.config[s])!==null&&h!==void 0?h:0)*.5,e.config[s]=c.config[s],l.callDownwards("setSize")}}}}function qi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ut(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qi(Object(t),!0).forEach(function(r){Pe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Pe(n,e,t){return e=Oc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Oc(n){var e=xc(n,"string");return typeof e=="symbol"?e:String(e)}function xc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jr extends pe{constructor(e,t,r){var i,o,s,a,l,u,h,c,f;super(e,t,r,T('<div class="lm_item lm_stack"></div>')),Pe(this,"_activeContentItem",null),Pe(this,"_header",void 0),Pe(this,"childElementContainer",T('<div class="lm_items"></div>')),Pe(this,"header",void 0),Pe(this,"parent",void 0),Pe(this,"isStack",!0),Pe(this,"_dropSegment",null),Pe(this,"_contentAreaDimensions",null),Pe(this,"_dropIndex",void 0),Pe(this,"_side",void 0),Pe(this,"_sided",!1),Pe(this,"config",void 0),this.parent=r,this.config=t;var v=e.config;this._side=!1,this._header={show:((i=v.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(s=v.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=v.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=v.settings)!==null&&u!==void 0&&u.showCloseIcon?(h=v.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&c!==void 0?c:void 0},v.header&&(this._header=Ut(Ut({},this._header),v.header)),t.header&&(this._header=Ut(Ut({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Ut(Ut({},this._header),t.content[0].header)),this.header=new ht(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,a=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?s:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:s);for(this.childElementContainer.width(a),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(a).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$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(){pe.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 _n&&(t&&this.parent.isColumn||r&&this.parent.isRow),s=t?"column":"row",a=t?"height":"width";if(ke(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[a]=((u=this.config[a])!==null&&u!==void 0?u:0)*.5,e.config[a]=this.config[a],this.parent.callDownwards("setSize")}else{var c,f=this.layoutManager.createContentItem({type:s},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,f),f.addChild(e,i?0:void 0,!0),f.addChild(this,i?void 0:0,!0),this.config[a]=50,e.config[a]=50,f.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,s,a,l,u,h,c,f,v,p,g,y,_,S=this.header.tabs.length;if(S===0){var C,I,U,G,x,K,A,Y,Q=this.header.element.offset();(C=this.layoutManager.dropTargetIndicator)===null||C===void 0||C.highlightArea({x1:(I=Q==null?void 0:Q.left)!==null&&I!==void 0?I:0,x2:((U=Q==null?void 0:Q.left)!==null&&U!==void 0?U:0)+100,y1:(G=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&G!==void 0?G:0,y2:((K=(A=this.header.element.offset())===null||A===void 0?void 0:A.top)!==null&&K!==void 0?K:0)+((Y=this.header.element.innerHeight())!==null&&Y!==void 0?Y:0)});return}var N=this.header.tabsContainer,W=(t=N.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),R=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!W||!R)){e<W.left?e=W.left+1:e>W.right&&(e=W.right-1);var M,k;if(!(R.left<e&&e<R.right)){for(var H=0;H<S;H++){var he;if(M=this.header.tabs[H].element,k=(he=M.get(0))===null||he===void 0?void 0:he.getBoundingClientRect(),k&&k.left<e&&e<k.right){this._dropIndex=H;break}}if(M&&k&&e<k.left+k.width*.5)M.before(this.layoutManager.tabDropPlaceholder);else if(M){var We;this._dropIndex=Math.min(((We=this._dropIndex)!==null&&We!==void 0?We:0)+1,S),M.after(this.layoutManager.tabDropPlaceholder)}}var je=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;je=Math.max(je,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var L=je+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);L=Math.min(L,((u=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&u!==void 0?u:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:je,x2:L,y1:(v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.top)!==null&&g!==void 0?g:0)+((_=this.header.element.innerHeight())!==null&&_!==void 0?_: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,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const Ic=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:pe,Component:na,ContentItem:pe,Root:Fr,RowOrColumn:_n,Stack:jr,isComponent:ke,isRoot:ta,isStack:At},Symbol.toStringTag,{value:"Module"}));function nt(n,e,t){return e=Mc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mc(n){var e=Dc(n,"string");return typeof e=="symbol"?e:String(e)}function Dc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ln{constructor(e,t){var r;nt(this,"header",void 0),nt(this,"contentItem",void 0),nt(this,"element",T(Ln._template)),nt(this,"titleElement",void 0),nt(this,"closeElement",void 0),nt(this,"isActive",!1),nt(this,"_layoutManager",void 0),nt(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new Dn(this.element),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.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),ke(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.html(e)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),ke(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new Ft(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){T(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){ke(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&&ke(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):ke(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),ke(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(),ke(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}nt(Ln,"_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 V(n,e,t){return e=Nc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nc(n){var e=Lc(n,"string");return typeof e=="symbol"?e:String(e)}function Lc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ht extends Ke{constructor(e,t){var r,i;super(),V(this,"layoutManager",void 0),V(this,"element",T(ht._template)),V(this,"tabsContainer",void 0),V(this,"tabDropdownContainer",void 0),V(this,"tabDropdownSearch",void 0),V(this,"tabDropdownList",null),V(this,"controlsContainer",void 0),V(this,"parent",void 0),V(this,"tabs",[]),V(this,"activeContentItem",null),V(this,"closeButton",null),V(this,"tabDropdownButton",null),V(this,"tabNextButton",T(ht._nextButtonTemplate)),V(this,"tabPreviousButton",T(ht._previousButtonTemplate)),V(this,"holdTimer",null),V(this,"rAF",null),V(this,"CLICK_TIMEOUT",500),V(this,"START_SPEED",.01),V(this,"ACCELERATION",5e-4),V(this,"PADDING",10),V(this,"SCROLL_LEFT","left"),V(this,"SCROLL_RIGHT","right"),V(this,"isDraggingTab",!1),V(this,"isOverflowing",!1),V(this,"isDropdownShown",!1),V(this,"dropdownKeyIndex",0),V(this,"_lastVisibleTabIndex",-1),V(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 Ln(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,o,s=0;s<this.tabs.length;s++)o=this.tabs[s].contentItem===e,this.tabs[s].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,o,s,a;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&o!==void 0?o:0)+((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,h;l.scrollLeft=(u=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,s=this.tabsContainer.get(0);if(s){var a=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(h=>{var c,f,v=o||h,p=h-v,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,v)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),T(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new cn(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 cn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new cn(this,s,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",a??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new cn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),T(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),T(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(a,l,u){if(u==null||u.length<2)return-1;for(var h=(a+l+u.length)%u.length;h!==a;){if(u.eq(h).css("display")!=="none")return h;h=(h+l+u.length)%u.length}return a}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,s;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),T(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var s=this.tabDropdownContainer[0].getBoundingClientRect(),a=(r=T(window).height())!==null&&r!==void 0?r:0,l=(i=T(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<a-u.bottom,c=!h&&u.bottom>a*.6,f=Math.min(u.left+(c?u.width:0),l-s.width-this.PADDING),v=c?Math.max(u.top-o,this.PADDING):u.bottom,p=a-v-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:v,left:f})}}}}_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()}}}}V(ht,"_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(""));V(ht,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));V(ht,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function un(n,e,t){return e=Ac(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ac(n){var e=Rc(n,"string");return typeof e=="symbol"?e:String(e)}function Rc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ra{constructor(e,t,r){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 Dn(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=T('<div class="lm_drag_handle"></div>'),t=T('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const kc=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Ys,DragProxy:Ft,DragSource:Qs,DragSourceFromEvent:Js,DropTargetIndicator:Nn,Header:ht,HeaderButton:cn,Splitter:ra,Tab:Ln},Symbol.toStringTag,{value:"Module"}));var Fc={config:Ah,container:$h,controls:kc,errors:bc,items:Ic,utils:tc};const jc=Fc;function Zi(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 _e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zi(Object(t),!0).forEach(function(r){Z(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Z(n,e,t){return e=$c(e),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:String(e)}function Hc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Xi=["column","row","stack","component"];class hr extends Ke{static isLayoutItemConfig(e){return Xi.includes(e.type)}static minifyConfig(e){return ti(e)}static unminifyConfig(e){return Ar(e)}constructor(e,t){super(),Z(this,"isInitialised",!1),Z(this,"_isFullPage",!1),Z(this,"_resizeTimeoutId",void 0),Z(this,"_components",{"lm-react-component":zs}),Z(this,"_fallbackComponent",void 0),Z(this,"_itemAreas",[]),Z(this,"_maximisedItem",null),Z(this,"_maximisePlaceholder",T('<div class="lm_maximise_place"></div>')),Z(this,"_creationTimeoutPassed",!1),Z(this,"_subWindowsCreated",!1),Z(this,"_dragSources",[]),Z(this,"_updatingColumnsResponsive",!1),Z(this,"_firstLoad",!0),Z(this,"_reactChildMap",new Map),Z(this,"_reactChildren",null),Z(this,"_initialHeaderHeight",void 0),Z(this,"width",null),Z(this,"height",null),Z(this,"root",void 0),Z(this,"openPopouts",[]),Z(this,"selectedItem",null),Z(this,"isSubWindow",!1),Z(this,"eventHub",new Vs(this)),Z(this,"config",void 0),Z(this,"container",void 0),Z(this,"_originalContainer",void 0),Z(this,"dropTargetIndicator",null),Z(this,"tabDropPlaceholder",T('<div class="lm_drop_tab_placeholder"></div>')),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&T("body").css("visibility","hidden")}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof pe))throw new Error("Root must be a ContentItem");var t={settings:_e({},this.config.settings),dimensions:_e({},this.config.dimensions),labels:_e({},this.config.labels),content:[]},r=function o(s,a){for(var l in a.config)l!=="content"&&(s[l]=a.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),a.contentItems.length){s.content=[];for(var u=0;u<a.contentItems.length;u++)s.content[u]={},o(s.content[u],a.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){T(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new Nn,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,s;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),T(window).off("resize",this._onResize),T(window).off("unload beforeunload",this._onUnload),T(window).off("blur.lm").off("focus.lm"),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 Dt("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!hr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Xi.join(","),new Dt(i);return e.type==="component"&&!(t instanceof jr)&&t&&!(this.isSubWindow===!0&&t instanceof Fr)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Jn(),e.type==="stack"?new jr(this,e,t):e.type==="row"?new _n(!1,this,e,t):e.type==="column"?new _n(!0,this,e,t):new na(this,e,t)}createPopout(e,t,r,i){var o=[],s=e instanceof pe,a=this;if(s){var l;o=this.toConfig(e).content,r=Jn();for(var u=e.parent,h=e;((c=u)===null||c===void 0?void 0:c.contentItems.length)===1&&!u.isRoot;){var c;h=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var f;i=(f=u)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&s){var v,p,g,y=window.screenX||window.screenLeft,_=window.screenY||window.screenTop,S=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:y+S.left,top:_+S.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&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!r||i===void 0)){var C=new Ys(o,t,r,i,this);return C.on("initialised",function(){a.emit("windowOpened",C)}),C.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(C),C}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Qs(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Js(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,o=0;o<this._itemAreas.length;o++){var s=this._itemAreas[o];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&r>s.surface&&(r=s.surface,i=s)}return i}_$createRootItemAreas(){var e=50,t=_e({},this.root._$getArea()),r=[_e(_e({},t),{},{side:"left",x2:t.x1+e}),_e(_e({},t),{},{side:"right",x1:t.x2-e}),_e(_e({},t),{},{side:"top",y2:t.y1+e}),_e(_e({},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(At(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var s=_e(_e({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof pe)return e;if(T.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&T(window).resize(this._onResize),T(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Ws("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Ar(e),localStorage.removeItem(r)),e=T.extend(!0,{},Hs,e);var i=function o(s){for(var a in s){var l=s[a];a!=="props"&&typeof l=="object"&&l!=null?o(l):a==="type"&&l==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=T('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=ei((e=this.config.content[0].title)!==null&&e!==void 0?e:""),T("head").append(T("body link, body style, template, .gl_keep")),this.container=T("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?T(this._originalContainer):T("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,T("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new Dt(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Dt(t,e);this.root=new Fr(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),o=e-i,s=this.root.contentItems[0],a=this._findAllStackContainers()[0],l=0;l<o;l++){var u=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(a,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=>{At(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}Z(hr,"__lm",jc);const qg=hr,Uc="_lm_dragging_k4a5m_1",Bc="_lm_goldenlayout_k4a5m_1",Kc="_lm_header_k4a5m_1",Wc="_lm_controls_k4a5m_1",zc="_lm_tabpreviousbutton_k4a5m_1",Vc="_lm_tabnextbutton_k4a5m_1",Gc="_lm_tab_k4a5m_1",qc="_lm_active_k4a5m_1",Zc="_lm_close_tab_k4a5m_1",Xc="_lm_content_k4a5m_1",Yc="_lm_dragProxy_k4a5m_1",Qc="_lm_dropTargetIndicator_k4a5m_1",Jc="_march_k4a5m_1",em="_lm_inner_k4a5m_1",tm="_lm_splitter_k4a5m_1",nm="_lm_selectable_k4a5m_1",rm="_lm_tabdropdown_list_k4a5m_1",im="_lm_title_k4a5m_1",om="_lm_title_before_k4a5m_1",sm="_lm_selected_k4a5m_1",am="_lm_focusin_k4a5m_1",lm="_lm_window_blur_k4a5m_1",dm="_lm_popout_k4a5m_1",um="_lm_maximise_k4a5m_1",hm="_lm_tabdropdown_k4a5m_1",cm="_lm_close_k4a5m_1",mm="_lm_tabdropdown_search_k4a5m_1",fm="_lm_tabs_k4a5m_1",vm="_lm_keyboard_active_k4a5m_1",pm="_lm_maximised_k4a5m_1",gm="_lm_items_k4a5m_1",Yi={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Uc,lm_goldenlayout:Bc,lm_header:Kc,lm_controls:Wc,lm_tabpreviousbutton:zc,lm_tabnextbutton:Vc,lm_tab:Gc,lm_active:qc,lm_close_tab:Zc,lm_content:Xc,lm_dragProxy:Yc,lm_dropTargetIndicator:Qc,march:Jc,lm_inner:em,lm_splitter:tm,lm_selectable:nm,lm_tabdropdown_list:rm,lm_title:im,lm_title_before:om,lm_selected:sm,lm_focusin:am,lm_window_blur:lm,lm_popout:dm,lm_maximise:um,lm_tabdropdown:hm,lm_close:cm,lm_tabdropdown_search:mm,lm_tabs:fm,lm_keyboard_active:vm,lm_maximised:pm,lm_items:gm},Qi=Object.freeze({tabHeight:parseInt(Yi["tab-height"],10),dragBorderWidth:parseInt(Yi["drag-border-width"],10)});function Ji(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?Ji(Object(t),!0).forEach(function(r){ia(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ji(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ia(n,e,t){return e=bm(e),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:String(e)}function ym(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var pt=$.module("LayoutUtils");function oa(n){return n.componentName!==void 0}function qt(n){var e=n;return(oa(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Bn(n){return n.focus!==void 0}function eo(n){return n.type==="stack"}class P{static activateTab(e,t){var r=P.getStackForRoot(e,t,!1);if(!r){pt.error("Could not find stack for config",t);return}var i=P.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=P.getStackForRoot(e,t,!1);if(!r)return pt.error("Could not find stack for config",t),!1;var i=P.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(ta(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var s=document.activeElement;e.contentItems[0].addChild(i),s&&s.focus!=null&&s.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var a=e.contentItems[e.contentItems.length-1],l=t?a.isRow:a.isColumn;if(!l){var u={type:t?"row":"column"};e.addChild(u),e.removeChild(a,!0),e.contentItems[e.contentItems.length-1].addChild(a),a=e.contentItems[e.contentItems.length-1]}return this.addStack(a,!t)}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&At(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(At(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var s=this.getStackById(e.contentItems[o],t,i);if(s)return s}return null}static 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&&At(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&&hi(o.config,t))return e;var s=this.getStackForConfig(o,t,r);if(s)return s}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=this.getStackForConfig(e,t);return!s&&i&&(s=this.getStackForConfig(e,{component:t.component},o)),!s&&r&&(s=this.addStack(e)),s}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;s<t.length;s+=1){var a=t[s],l=s===t.length-1,u=P.getStackForRoot(e,{component:a},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&&hi(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],{component:s,content:a}=o;if(s){var l=t(s,o);l!=null?r.push(l):pt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(a){var u=Je(Je({},o),{},{content:P.dehydrateLayoutConfig(a,t)});r.push(u)}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?(eo(r)&&delete r.activeItemIndex,P.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=P.cloneLayout(e),o=P.cloneLayout(t);return r?(P.dropLayoutMinorChange(i),P.dropLayoutMinorChange(o),Ir(i,o)):Ir(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 s,{component:a,props:l={}}=o;r.push(Je(Je({},o),{},{id:(s=o==null?void 0:o.id)!==null&&s!==void 0?s:Nt(),props:t(a,l)}))}else if(o.content!==void 0){var u=P.hydrateLayoutConfig(o.content,t);eo(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=u.length&&(pt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(Je(Je({},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:s=!1,focusElement:a=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=document.activeElement,h=Je({},t);if(h.id==null&&(h.id=Nt()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};F(e);var f=r??(s?P.addStack(e):P.getStackForRoot(e,c));F(f);var v=P.getContentItemInStack(f,c);if(a!=null){var p=y=>{pt.debug("Component created, focusing element",a),f.off("componentCreated",p);var{element:_}=y.origin;requestAnimationFrame(()=>{P.focusElement(_[0],a)})};f.on("componentCreated",p)}if(i&&v){var g=f.contentItems.indexOf(v);f.addChild(h,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(h);a==null&&u&&Bn(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},s=P.getContentItemInStack(e,o);if(r&&s&&e){var a=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,a+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[a])}else e==null||e.addChild(t);i&&Bn(i)&&i.focus()}static closeComponent(e,t,r){var i=P.getStackForRoot(e,t,!1,!1,!1);if(!i){pt.warn("Cannot find stack for component, ignoring close",t);return}var o=P.getContentItemInStack(i,t),s=document.activeElement;o&&(ke(o)?o.container.close(r):i.removeChild(o)),s&&document.contains(s)&&Bn(s)&&s.focus()}static renameComponent(e,t,r){var i=P.getStackForRoot(e,t,!1);if(!i){pt.error("Could not find stack for config",t);return}var o=P.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=P.getStackForRoot(e,t,!1);if(!r)return pt.error("Could not find stack for config",t),null;var{props:i={}}=t,o=P.getPanelComponentState(t),s={type:"react-component",component:t.component,props:Je(Je({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Nt()};return P.openComponentInStack(r,s),s}static getPanelComponentState(e){if(oa(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:Qi.tabHeight,borderWidth:Qi.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=P.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return P.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=P.getComponentConfigFromContainer(t);if(r&&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]:P.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Bn(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)})}}ia(P,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Cm=D.forwardRef((n,e)=>{var t=P.getComponentNameFromPanel({props:n});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Cm.displayName="PanelPlaceholder";var X=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:Zg,emit:wm,useListener:Xg}=Xs(X.OPEN);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 no(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){Ct(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 Ct(n,e,t){return e=Sm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sm(n){var e=_m(n,"string");return typeof e=="symbol"?e:String(e)}function _m(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ne=$.module("PanelManager");class sa{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(a,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(a,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Ct(this,"layout",void 0),Ct(this,"hydrateComponent",void 0),Ct(this,"dehydrateComponent",void 0),Ct(this,"onPanelsUpdated",void 0),Ct(this,"closed",void 0),Ct(this,"openedMap",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.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=s,this.openedMap=new Map(i),this.closed=[...o],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(X.FOCUS,this.handleFocus),e.on(X.MOUNT,this.handleMount),e.on(X.UNMOUNT,this.handleUnmount),e.on(X.REOPEN,this.handleReopen),e.on(X.REOPEN_LAST,this.handleReopenLast),e.on(X.DELETE,this.handleDeleted),e.on(X.CLOSED,this.handleClosed),e.on(X.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(X.FOCUS,this.handleFocus),e.off(X.MOUNT,this.handleMount),e.off(X.UNMOUNT,this.handleUnmount),e.off(X.REOPEN,this.handleReopen),e.off(X.REOPEN_LAST,this.handleReopenLast),e.off(X.DELETE,this.handleDeleted),e.off(X.CLOSED,this.handleClosed),e.off(X.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return P.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&qt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=P.getStackForConfig(this.layout.root,{id:e});return(t=r&&P.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>Qn(r)&&t instanceof r.WrappedComponent||!Qn(r)&&t instanceof r))}updatePanel(e){var t=P.getIdFromPanel(e);if(t==null){Ne.error("updatePanel Panel did not have an ID",e);return}Ne.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=P.getIdFromPanel(e);if(t==null){Ne.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){Ne.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){Ne.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}Ne.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){Ne.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){Ne.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){Ne.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){Ne.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=no(no({},e),{},{props:i}),{root:s}=this.layout,a=e.parentStackId===void 0?void 0:P.getStackById(s,e.parentStackId);P.openComponent({root:s,config:o,replaceConfig:t,stack:a??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=P.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){Ne.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){Ne.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;P.closeComponent(r,t)}addClosedPanel(e){var{root:t}=this.layout,r=P.getComponentConfigFromContainer(e);if(r&&qt(r)){var i=this.dehydrateComponent(r.component,r);if(i!=null){var o;i.parentStackId=(o=P.getStackForConfig(t,r))===null||o===void 0?void 0:o.config.id,this.closed.push(i)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Ct(sa,"MAX_CLOSED_PANEL_COUNT",100);var Em=$.module("PanelErrorBoundary");class Pm 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=P.getIdFromContainer(e);Em.debug("componentWillUnmount",r),t.emit(X.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(Pn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}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 tr(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){Tm(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 Tm(n,e,t){return e=Om(e),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:String(e)}function xm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function aa(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),tr(tr({},n),{},{componentState:null,props:o,type:"react-component"})}function la(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return tr(tr({},n),{},{localDashboardId:e})}const Yg={dehydrate:aa,hydrate:la};var Im=D.createContext(void 0),Mm=b.shape({on:b.func,off:b.func,isHidden:b.bool,tab:b.shape({header:b.shape({tabs:b.arrayOf(b.shape({contentItem:b.shape({})}))})}),title:b.string,setTitle:b.func,close:b.func}),da=b.shape({on:b.func,off:b.func,emit:b.func}),Dm=b.shape({registerComponent:b.func,root:b.shape({addChild:b.func}),on:b.func,off:b.func,eventHub:da}),Nm=Object.freeze({Container:Mm,EventHub:da,Layout:Dm});function Bt(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var ua="SET_DASHBOARD_DATA";const Lm=Xu(ua,{},!1),Am={dashboardData:Lm};var Rm=new Map,ha=Object.freeze({}),km=Object.freeze([]),Qg=ds,Jg=ls,eb=Pl,Fm=n=>n.dashboardData,be=(n,e)=>{var t;return(t=Fm(n)[e])!==null&&t!==void 0?t:ha},tb=(n,e)=>{var t;return(t=be(n,e).closed)!==null&&t!==void 0?t:km},nb=(n,e)=>{var t;return(t=be(n,e).openedMap)!==null&&t!==void 0?t:Rm},ca=(n,e)=>{var t;return(t=be(n,e).pluginDataMap)!==null&&t!==void 0?t:ha},rb=(n,e,t)=>ca(n,e)[t];function io(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Zt(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){jm(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 jm(n,e,t){return e=$m(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $m(n){var e=Hm(n,"string");return typeof e=="symbol"?e:String(e)}function Hm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ma=(n,e)=>({type:ua,id:n,payload:e}),Um=(n,e)=>(t,r)=>t(ma(n,Zt(Zt({},be(r(),n)),e))),ib=(n,e,t)=>(r,i)=>r(ma(n,Zt(Zt({},be(i(),n)),{},{pluginDataMap:Zt(Zt({},ca(i(),n)),{},{[e]:t})})));Object.entries(Am).map(n=>{var[e,t]=n;return th.register(e,t)});function Bm(n){var{children:e}=n;return d.jsx(d.Fragment,{children:e})}function oo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function hn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oo(Object(t),!0).forEach(function(r){Km(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Km(n,e,t){return e=Wm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wm(n){var e=zm(n,"string");return typeof e=="symbol"?e:String(e)}function zm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Kn=$.module("DashboardLayout"),Vm=Object.freeze({}),Gm=[],so=()=>{},qm=1e3,ao=n=>n;function Zm(n){var e,t,{id:r,children:i,emptyDashboard:o=d.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:a=Gm,onLayoutChange:l=so,onLayoutInitialized:u=so,hydrate:h=la,dehydrate:c=aa,panelWrapper:f=Bm}=n,v=ds(),p=(e=ls(L=>be(L,r)))!==null&&e!==void 0?e:Vm,[g,y]=m.useState(!1),[_,S]=m.useState(!1),[C,I]=m.useState(),[U]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[G,x]=m.useState(s.getReactChildren()),K=m.useMemo(()=>new Map,[]),A=m.useMemo(()=>new Map,[]),Y=m.useCallback(function(L,J){var re,ln=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,ft=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Kn.debug2("registerComponent",L,J,ln,ft);function Fn(B,ee){var me=J,ye=f,Da=Ud(me),{glContainer:Na,glEventHub:La}=B;return d.jsx(Pm,{glContainer:Na,glEventHub:La,children:d.jsx(ye,hn(hn({},B),{},{children:Da?d.jsx(me,hn(hn({},B),{},{ref:ee})):d.jsx(me,hn({},B))}))})}Fn.displayName="DashboardWrapper(".concat((re=J.displayName)!==null&&re!==void 0?re:L,")");var E=s.registerComponent(L,D.forwardRef(Fn));return K.set(L,ln),A.set(L,ft),E},[h,c,K,A,s,f]),Q=m.useCallback((L,J)=>{var re;return((re=K.get(L))!==null&&re!==void 0?re:ao)(J,r)},[K,r]),N=m.useCallback((L,J)=>{var re;return((re=A.get(L))!==null&&re!==void 0?re:ao)(J,r)},[A,r]),W=m.useMemo(()=>new sa(s,Q,N,new Map,U,L=>{var{closed:J,openedMap:re}=L;v(Um(r,{closed:J,openedMap:re}))}),[N,v,Q,r,U,s]),R=dd(L=>{var J=C==null||!P.isEqual(C,L);Kn.debug("handleLayoutStateChanged",J,L),J&&(y(s.root.contentItems.length===0),I(L),l(L),x(s.getReactChildren()))},qm,{flushOnUnmount:!0});m.useEffect(()=>()=>R.flush(),[R]);var M=m.useCallback(()=>{if(!_){var L=s.toConfig(),J=L.content,re=P.dehydrateLayoutConfig(J,N);R(re)}},[N,_,s,R]),k=m.useCallback(L=>{var J=P.getIdFromContainer(L);s.eventHub.emit(X.DRAGGING,J),S(!0)},[s.eventHub]),H=m.useCallback(L=>{var J=P.getIdFromContainer(L);s.eventHub.emit(X.DROPPED,J),S(!1)},[s.eventHub]),he=m.useCallback(L=>{if(Kn.debug2("handleComponentCreated",L),!(L==null||L.config==null||L.config.component==null||L.element==null)){var J=L.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),re="".concat(J,"-component");L.element.addClass(re)}},[]),We=m.useCallback(()=>{x(s.getReactChildren())},[s]);Bt(s,"stateChanged",M),Bt(s,"itemPickedUp",k),Bt(s,"itemDropped",H),Bt(s,"componentCreated",he),Bt(s.eventHub,X.TITLE_CHANGED,M),Bt(s,"reactChildrenChanged",We);var je=ud(a);return m.useEffect(function(){if(je!==a&&a!==C){Kn.debug("Setting new layout content...");for(var J=P.hydrateLayoutConfig(a,Q);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var re=0;re<J.length;re+=1)s.root.addChild(J[re]);y(s.root.contentItems.length===0)}},[Q,s,a,C,W,je]),m.useEffect(()=>u(),[]),d.jsxs(d.Fragment,{children:[g&&o,G,D.Children.map(i,L=>L!=null?d.jsx(fu,{fallback:[],children:D.cloneElement(L,{id:r,layout:s,panelManager:W,registerComponent:Y})}):null)]})}Zm.propTypes={id:b.string.isRequired,children:b.node,data:b.shape({}),emptyDashboard:b.node,layout:Nm.Layout.isRequired,layoutConfig:b.arrayOf(b.shape({})),onLayoutChange:b.func,onLayoutInitialized:b.func};var ob="default";function fa(n){var{type:e}=n,t=_u();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(se,{icon:Ya});case t.VariableType.FIGURE:return d.jsx(se,{icon:rs});case t.VariableType.PANDAS:return d.jsx(se,{icon:Xa});default:return d.jsx(se,{icon:ts})}}function lo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.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 s(l){lo(o,r,i,s,a,"next",l)}function a(l){lo(o,r,i,s,a,"throw",l)}s(void 0)})}}function va(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=ys();return m.useEffect(()=>{var s=!1;function a(){return l.apply(this,arguments)}function l(){return l=Xm(function*(){if(e!=null&&o!=null){var u=yield ot.colorize(e.toString(),t,{});s||i(u)}}),l.apply(this,arguments)}return a(),()=>{s=!0}},[o,e,t]),d.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class Ym{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const pa=Ym;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)?[]:Tl.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}}const Qm=nr;function ga(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})]})}ga.propTypes={children:b.node.isRequired};function $r(n,e,t){return e=Jm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jm(n){var e=ef(n,"string");return typeof e=="symbol"?e:String(e)}function ef(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ba extends m.Component{constructor(e){super(e),$r(this,"timer",void 0),$r(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&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:j("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(is,{className:"ml-2"}),"Running... ",vs.formatElapsedTime(r)," ",d.jsx(te,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Qa,tooltip:"Cancel",onClick:t,disabled:e})]})})}}$r(ba,"defaultProps",{disabled:!1});const tf=ba;function yn(n,e,t){return e=nf(e),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:String(e)}function rf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class en extends m.PureComponent{constructor(e){super(e),yn(this,"mouseX",void 0),yn(this,"mouseY",void 0),yn(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=en.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=en.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:r}=this.props;F(r);var i=r.indexOf(`
|
|
2
|
-
`),o=i>-1,s=r;o&&(s=r.slice(0,i));var a=r.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return d.jsxs("div",{className:j("error-message",{expanded:e}),children:[o&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"error-gutter",children:d.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:d.jsx(se,{icon:e?xr:Ja,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?a:""]})]}),!o&&d.jsx("div",{className:"error-content",children:d.jsx("div",{className:"console-error-text",children:s})})]},"error")}}yn(en,"defaultProps",{message:""});yn(en,"mouseDragThreshold",5);const of=en;function sf(n,e,t){return e=af(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function af(n){var e=lf(n,"string");return typeof e=="symbol"?e:String(e)}function lf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var uo=$.module("ConsoleHistoryItem");class ya extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){uo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(uo.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:r,iconForType:i}=this.props,{disabledObjects:o,result:s}=t,a=t.command!=null&&t.command!=="",l=null;a&&(l=d.jsxs("div",{className:"console-history-item-command",children:[d.jsx("div",{className:"console-history-gutter",children:">"}),d.jsx("div",{className:"console-history-content",children:d.jsx(va,{language:r,children:t.command})})]}));var u=[],h=!1;if(s){var{error:c,message:f,changes:v}=s;if(v){var{created:p,updated:g}=v;[...p,...g].forEach(G=>{h=!0;var{title:x}=G,K="".concat(x),A=e===void 0||e||(o??[]).indexOf(K)>=0,Y=d.jsx(te,{kind:"primary",onClick:()=>this.handleObjectClick(G),className:"btn-console-object",disabled:A,icon:i(G.type),children:x},K);u.push(Y)})}if(c!=null&&!a){var y,_="".concat((y=c.message)!==null&&y!==void 0?y:c);_||(_=c);var S=d.jsx(of,{message:_},"result-error");u.push(S)}if(f!==void 0&&f!==""){var C=d.jsx("div",{className:"log-message",children:f},"log-message");u.push(C)}}else{h=!0;var I=d.jsx(tf,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");u.push(I)}var U=null;return u.length>0&&(U=d.jsx(ga,{children:u})),d.jsxs("div",{className:j("console-command-result",{"console-result-buttons":h}),children:[l,U]})}}sf(ya,"defaultProps",{disabled:!1});const df=ya;function uf(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function hf(n){for(var{disabled:e=!1,items:t,language:r,openObject:i,supportsType:o,iconForType:s}=n,a=[],l=0;l<t.length;l+=1){var u=t[l],h=d.jsx(df,{disabled:e,item:u,openObject:i,language:r,supportsType:o,iconForType:s},uf(l,u));a.push(h)}return d.jsx("div",{className:"container-fluid console-history",children:a})}var cf={name:"Console",CLEAR:oe.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[O.CTRL,w.L],macShortcut:[O.CTRL,w.C]}),FOCUS_HISTORY:oe.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[O.CTRL,w.H],macShortcut:[O.CTRL,O.OPTION,w.H]})},mf={name:"Command History",FOCUS_HISTORY:oe.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[O.CTRL,w.H],macShortcut:[O.CTRL,O.OPTION,w.H]}),SEND_TO_CONSOLE:oe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[w.ENTER],macShortcut:[w.ENTER]}),SEND_TO_NOTEBOOK:oe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[O.CTRL,w.ENTER],macShortcut:[O.CMD,w.ENTER]}),RUN:oe.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[O.ALT,w.R],macShortcut:[O.OPTION,w.R]})},ff={name:"Notebook",RUN:oe.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[O.ALT,w.R],macShortcut:[O.OPTION,w.R]}),RUN_SELECTED:oe.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[O.ALT,O.SHIFT,w.R],macShortcut:[O.OPTION,O.SHIFT,w.R]}),FIND:oe.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[O.CTRL,w.F],macShortcut:[O.CMD,w.F],isEditable:!1}),MINIMAP:oe.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[O.ALT,w.M],macShortcut:[O.OPTION,w.M]}),WORDWRAP:oe.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[O.ALT,w.Z],macShortcut:[O.OPTION,w.Z]})},vf={CONSOLE:cf,COMMAND_HISTORY:mf,NOTEBOOK:ff};const Jt=vf,ve=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),pf="var(--dh-color-editor-bg)",gf="var(--dh-color-editor-fg)",bf="var(--dh-color-editor-string)",yf="var(--dh-color-editor-delimiter)",Cf="var(--dh-color-editor-predefined)",wf="var(--dh-color-editor-keyword)",Sf="var(--dh-color-editor-storage)",_f="var(--dh-color-editor-number)",Ef="var(--dh-color-editor-operator)",Pf="var(--dh-color-editor-identifier)",Tf="var(--dh-color-editor-comment)",Hr={"error-foreground":"var(--dh-color-editor-error-fg)",background:pf,foreground:gf,"line-height":"19px",string:bf,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:yf,predefined:Cf,keyword:wf,storage:Sf,number:_f,operator:Ef,identifier:Pf,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Tf,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)"};var Of="python",xf={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/}}},If={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"]]}},Mf={id:Of,conf:xf,language:If};const Df=Mf;var Nf="groovy",Lf={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/}}},Af={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"]]}},Rf={id:Nf,conf:Lf,language:Af};const kf=Rf;var Ff="scala",jf={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>))/}}},$f={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"]]}},Hf={id:Ff,conf:jf,language:$f};const Uf=Hf;var Bf="deephavenDb",Kf={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/}}},Wf={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"]]}},zf={id:Bf,conf:Kf,language:Wf};const Vf=zf;var Gf="log",qf={},Zf={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"}]]}},Xf={id:Gf,conf:qf,language:Zf};const Yf=Xf;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 co(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){Qf(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 Qf(n,e,t){return e=Jf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jf(n){var e=ev(n,"string");return typeof e=="symbol"?e:String(e)}function ev(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var et=$.module("MonacoUtils");class it{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et.debug("Initializing Monaco..."),e!==void 0&&it.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=it;t(),r([Vf,Df,kf,Yf,Uf]),it.removeConflictingKeybindings(),et.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=it,i=ns(Hr);et.debug2("Monaco theme:",Hr),et.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],s={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"]};ot.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:s});try{ot.setTheme("dh-dark")}catch(a){et.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",a),ot.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=co(co({},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});lt.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;et.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{it.registerLanguage(r)})}static registerLanguage(e){et.debug2("Registering language: ",e.id),lt.register(e),lt.onLanguage(e.id,()=>{lt.setLanguageConfiguration(e.id,e.conf),lt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ot.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();F(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};et.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(s=>{for(var{changes:a,versionId:l}=s,u=[],h=0;h<a.length;h+=1){var c=a[h],{range:f,rangeLength:v,text:p}=c,g={range:{start:{line:f.startLineNumber-1,character:f.startColumn-1},end:{line:f.endLineNumber-1,character:f.endColumn-1}},rangeLength:v,text:p};u.push(g)}if(u.length>0){var y={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};et.debug2("didChangeDocumentParams",y),t.changeDocument(y)}});return o}static closeDocument(e,t){var r=e.getModel();F(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,s=e.getModel();F(s);var a=s.getValueInRange(t.range);(r.test(a)||i.test(a)||o.test(a))&&s.applyEdits([{range:t.range,text:a.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){ot.addKeybindingRule({keybinding:Le.CtrlCmd|Lt.KeyD,command:null}),it.isMacPlatform()||ot.addKeybindingRule({keybinding:Le.CtrlCmd|Lt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Nt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=it.isMacPlatform();return i?(t.metaKey?Le.CtrlCmd:0)|(t.shiftKey?Le.Shift:0)|(t.altKey?Le.Alt:0)|(t.ctrlKey?Le.WinCtrl:0)|ci.fromString(r):(t.ctrlKey?Le.CtrlCmd:0)|(t.shiftKey?Le.Shift:0)|(t.altKey?Le.Alt:0)|(t.metaKey?Le.WinCtrl:0)|ci.fromString(r)}static provideLinks(e){for(var t=[],r=function(s){var a=e.getLineContent(s),l=Ol(a),u=l.filter(h=>h.type==="url"?/^https?:\/\//.test(h.value):!0);u.forEach(h=>{t.push({url:h.href,range:new xl(s,h.start+1,s,h.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}}const Wt=it;function _r(n,e,t){return e=tv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:String(e)}function nv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tt=$.module("MonacoCompletionProvider");class Mt extends m.PureComponent{static lspToMonacoKind(e){var t=lt.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}}constructor(e){super(e),_r(this,"registeredCompletionProvider",void 0),_r(this,"registeredSignatureProvider",void 0),_r(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=lt.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=lt.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=lt.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Mt.monacoToLspPosition(t),context:r},a=o.getCompletionItems(s);tt.debug("Requested completion items",s);var l=a.then(u=>{tt.debug("Completion items received: ",s,u);var h=u.map(c=>{var{label:f,kind:v,detail:p,documentation:g,sortText:y,filterText:_,textEdit:S,insertTextFormat:C}=c;return{label:f,kind:Mt.lspToMonacoKind(v),detail:p,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:y,filterText:_,insertText:S.text,insertTextRules:C===2?4:C,range:Mt.lspToMonacoRange(S.range)}});return{incomplete:!0,suggestions:h}}).catch(u=>(tt.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:s,session:a}=this.props;if(e!==s||a.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Mt.monacoToLspPosition(t),context:i},u=a.getSignatureHelp(l);tt.debug("Requested signature help",l);var h=u.then(c=>{tt.debug("Signatures received: ",l,u);var f=c.map(p=>{var{label:g,documentation:y,parameters:_}=p;return{documentation:(y==null?void 0:y.kind)==="markdown"?y:y==null?void 0:y.value,label:g,parameters:_??[]}});if(f.length===0)return o;var v=0;return{value:{signatures:f,activeSignature:v,activeParameter:c[v].activeParameter},dispose:()=>{}}}).catch(c=>(tt.error("There was an error retrieving completion items",c),o));return h}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:Mt.monacoToLspPosition(t)},s=i.getHover(o);tt.debug("Requested hover",o);var a=s.then(l=>{tt.debug("Hover received: ",o,l);var{contents:u}=l;return{contents:u!=null?[u]:[]}}).catch(l=>(tt.error("There was an error retrieving hover",l),{contents:[]}));return a}render(){return null}}const rv=Mt;function mo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function iv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){mo(o,r,i,s,a,"next",l)}function a(l){mo(o,r,i,s,a,"throw",l)}s(void 0)})}}function Te(n,e,t){return e=ov(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ov(n){var e=sv(n,"string");return typeof e=="symbol"?e:String(e)}function sv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Er=$.module("ConsoleInput"),rr=parseInt(Hr["line-height"],10),Ca=6,wa=6,av=rr+Ca+wa,Pr=100;class An extends m.PureComponent{constructor(e){super(e),Te(this,"cancelListener",void 0),Te(this,"resizeObserver",void 0),Te(this,"commandContainer",void 0),Te(this,"commandEditor",void 0),Te(this,"commandHistoryIndex",void 0),Te(this,"commandSuggestionContainer",void 0),Te(this,"loadingPromise",void 0),Te(this,"timestamp",void 0),Te(this,"bufferIndex",void 0),Te(this,"history",void 0),Te(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=D.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:rr,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(Er.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={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:rr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ca,bottom:wa},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace"},i=this.commandContainer.current;F(i),this.commandEditor=ot.create(i,r),Wt.setEOL(this.commandEditor),Wt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var o,s=(o=this.commandEditor)===null||o===void 0?void 0:o.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(o=>{var{commandEditor:s,commandHistoryIndex:a}=this,l=s==null?void 0:s.getPosition();F(l);var{lineNumber:u}=l,h=s==null?void 0:s.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&u===1){a!=null?this.loadCommand(a+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&u===(h==null?void 0:h.getLineCount())){a!=null&&a>0?this.loadCommand(a-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey&&o.keyCode===Lt.Enter&&!this.isSuggestionMenuPopulated()){var c;o.stopPropagation(),o.preventDefault();var f=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(f!==void 0){var v;this.processCommand(f),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}),Wt.disableKeyBindings(this.commandEditor,[Le.CtrlCmd|Lt.KeyF]),Wt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(Wt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,r;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(r=t.getDomNode())===null||r===void 0?void 0:r.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,r;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(r=t.querySelector(".monaco-list-rows"))===null||r===void 0?void 0:r.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();F(s);var a=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,a);F(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:a}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();F(s);var a=s.getLineCount(),l=s.getLineLength(a)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(a,l);F(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:a,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,r;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,r;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),o=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(i??o),e!==null&&e>this.history.length-Pr&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return iv(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=Me.makeCancelable(t.getTable(r,i??"",e.timestamp),a=>a.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+Pr-1}),e.loadingPromise=Me.makeCancelable(o.getViewportData(),()=>o.close());var s=yield e.loadingPromise;e.bufferIndex+=Pr,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...s.items.filter((a,l,u)=>{var{name:h}=a;return l===0||h!==u[l-1].name}).map(a=>{var{name:l}=a;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(a){if(e.loadingPromise=void 0,Me.isCanceled(a)){Er.debug2("Promise canceled, not loading history");return}Er.error("Error fetching history",a)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),F(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;F(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),av),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var s,a;(s=this.commandEditor)===null||s===void 0||s.updateOptions(o),(a=this.commandEditor)===null||a===void 0||a.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:s}=this.state;return d.jsx("div",{className:j("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:j("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:An.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),s&&d.jsx(rv,{model:s,language:t,session:r})]})})}}Te(An,"defaultProps",{maxHeight:rr*10,scope:null,disabled:!1});Te(An,"INPUT_CLASS_NAME","console-input");const fo=An;function _t(n,e,t){return e=lv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lv(n){var e=dv(n,"string");return typeof e=="symbol"?e:String(e)}function dv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vo="pasted values",uv=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Tr=[".csv",".tsv",".tab",".psv",".dsv",".txt"],po=[".zip"];class Ze extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!uv.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Tr.some(r=>e.endsWith(r))||t&&po.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===vo?li:e.endsWith(".csv")?el:e.endsWith(".zip")?tl:nl}constructor(e){super(e),_t(this,"fileElem",void 0),_t(this,"divElem",void 0),_t(this,"getValidExtensions",Yt(t=>t?[...Tr,...po]:[...Tr])),_t(this,"getAcceptString",Yt(t=>this.getValidExtensions(t).join(", "))),_t(this,"getFileTypeErrorString",Yt(t=>Ql.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=D.createRef(),this.divElem=D.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();F(o),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:vo,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:li,action:this.handleMenuPaste,shortcut:Gt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,s=t??o,a=this.makeContextMenuItems();return 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:a}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(s===void 0||s==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(se,{icon:rl})}),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(te,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(s===void 0||s==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(se,{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(te,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:il,tooltip:"Remove"})]})]})]}),!!s&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(se,{icon:os})}),d.jsx("label",{children:s}),s===Ze.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}_t(Ze,"defaultProps",{allowZip:!1,dragError:null});_t(Ze,"MULTIPLE_FILE_ERROR","Please select only one file");_t(Ze,"FILE_TYPE_ERROR","Filetype not supported.");const zt=Ze;function jt(n,e,t){return e=hv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hv(n){var e=cv(n,"string");return typeof e=="symbol"?e:String(e)}function cv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Pt{}jt(Pt,"INTEGER","int");jt(Pt,"LONG","long");jt(Pt,"DOUBLE","double");jt(Pt,"BOOLEAN","bool");jt(Pt,"STRING","string");jt(Pt,"DATE_TIME","datetime");jt(Pt,"LOCAL_TIME","localtime");const q=Pt;function Sa(n,e){var t=n.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(r,i)=>e(i)),t}function go(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?go(Object(t),!0).forEach(function(r){we(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 we(n,e,t){return e=mv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mv(n){var e=fv(n,"string");return typeof e=="symbol"?e:String(e)}function fv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var yo="unknown",vv=2147483647,pv=-2147483648,Co=/^[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]+)?$/,wo=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class ge{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case q.STRING:return q.STRING;case q.INTEGER:return ge.checkInteger(e);case q.LONG:return ge.checkLong(e);case q.DOUBLE:return ge.checkDouble(e);case q.BOOLEAN:return ge.checkBoolean(e);case q.DATE_TIME:return ge.checkDateTime(e);case q.LOCAL_TIME:return ge.checkLocalTime(e);default:return ge.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return ge.isNotParsableNumber(t)?q.STRING:ge.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return ge.isNotParsableNumber(t)?q.STRING:t.includes(".")?q.DOUBLE:q.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return ge.isNotParsableNumber(t)?q.STRING:q.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?q.BOOLEAN:q.STRING}static checkDateTime(e){return Co.test(e)?q.DATE_TIME:q.STRING}static checkLocalTime(e){return wo.test(e)?q.LOCAL_TIME:q.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(ge.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?q.BOOLEAN:Co.test(e)&&e.includes(":")?q.DATE_TIME:wo.test(e)?q.LOCAL_TIME:q.STRING}return ge.getNumberType(t)}static getNumberType(e){if(e.includes("."))return q.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return q.LONG;var r=parseInt(e,10);return r>vv||r<pv?q.LONG:q.INTEGER}constructor(e,t,r,i,o,s,a,l,u,h){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=s,this.onError=a,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=h,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=bo(bo({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)vn.parse(this.file,this.config);else{var e=Sa(this.file,this.handleNodeUpdate);vn.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(yo),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,F(this.types);var i=[...this.types];r.forEach(a=>{if(a.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=ge.determineType(this.shouldTrim?a[l].trim():a[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
3
|
-
Expected length `.concat(i.length," but found ").concat(a.length,`.
|
|
4
|
-
Row = `).concat(a))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var s=this.onProgress(o);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;F(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===yo||i===q.LOCAL_TIME?q.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const gv=ge;function ie(n,e,t){return e=bv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bv(n){var e=yv(n,"string");return typeof e=="symbol"?e:String(e)}function yv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Wn=$.module("CsvParser"),Cv=650;class tn{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(tn.generateHeaderRecursive(Math.floor(e/26)-1)),r=e%26),t.concat(String.fromCharCode(65+r))}constructor(e){var{onFileCompleted:t,session:r,file:i,type:o,readHeaders:s=!0,onProgress:a,onError:l,timeZone:u,isZip:h}=e;ie(this,"onFileCompleted",void 0),ie(this,"session",void 0),ie(this,"file",void 0),ie(this,"isZip",void 0),ie(this,"type",void 0),ie(this,"readHeaders",void 0),ie(this,"timeZone",void 0),ie(this,"onProgress",void 0),ie(this,"onError",void 0),ie(this,"tables",void 0),ie(this,"headers",void 0),ie(this,"types",void 0),ie(this,"rowCount",void 0),ie(this,"rowsProcessed",void 0),ie(this,"chunks",void 0),ie(this,"totalChunks",void 0),ie(this,"isComplete",void 0),ie(this,"zipProgress",void 0),ie(this,"consolidatedChunks",void 0),ie(this,"numConsolidated",void 0),ie(this,"isCancelled",void 0),ie(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=h,this.type=o,this.readHeaders=s,this.timeZone=u,this.onProgress=a,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(i.size/vn.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:o.delimiter,newline:o.newline,escapeChar:o.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:o.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var r=t.length,i=new Array(e).fill(null).map(()=>new Array(r)),o=0;o<r;o+=1){var s=t[o];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
|
|
5
|
-
`).concat(s));for(var a=0;a<e;a+=1){var l=this.type.shouldTrim?t[o][a].trim():t[o][a];i[a][o]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)vn.parse(this.file,this.config);else{var o=Sa(this.file,this.handleNodeUpdate);vn.parse(o,this.config),o.resume()}},t=new gv(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:r,onError:i,handleCreateTable:o,isZip:s,tables:a}=this;if(this.isCancelled){Wn.debug2("CSV parser cancelled."),t.abort(),a.forEach(c=>c.close());return}var{data:l}=e;this.headers||(r?(this.headers=cs.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=tn.generateHeaders(l[0].length));var u=[];try{if(u=this.transpose(this.headers.length,l),s)this.consolidateChunks(u,t);else{var h=this.chunks;this.chunks+=1,o(h,u,t)}}catch(c){i(c)}}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>=Cv||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:r}=this,i=this.chunks;this.chunks+=1;var o=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,F(o),r(i,o,e)}handleCreateTable(e,t,r){var{session:i,tables:o,onFileCompleted:s,totalChunks:a,types:l,onProgress:u,onError:h}=this;r&&r.pause(),F(this.headers),F(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(c=>{if(this.isCancelled){Wn.debug2("CSV parser cancelled."),r&&r.abort(),o.forEach(v=>v.close());return}r&&r.resume(),o[e]=c;var f=0;a>0?f=Math.round(o.length/a*50)+50:f=Math.round(this.rowsProcessed/this.rowCount*50)+50,Wn.debug2("CSV parser progress ".concat(f)),u(f),this.isComplete&&o.length===this.chunks&&(Wn.debug2("CSV parser complete."),s(o))}).catch(c=>{!this.isComplete&&r&&r.abort(),h(c)})}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}}ie(tn,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(tn.generateHeaderRecursive(t));return e});const wv=tn;function ii(n,e,t){return e=Sv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sv(n){var e=_v(n,"string");return typeof e=="symbol"?e:String(e)}function _v(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cr{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}ii(cr,"DEFAULT_TYPE","DEFAULT_CSV");ii(cr,"AUTO","AUTODETECT");ii(cr,"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
|
|
6
|
-
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
7
|
-
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
8
|
-
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
9
|
-
`,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)"}}));const mn=cr;function _a(n,e,t){return e=Ev(e),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:String(e)}function Pv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var So=$.module("CsvInputBar"),Tv=Object.entries(mn.TYPES).map(n=>{var[e,t]=n;return d.jsx("option",{value:e,children:t.name},e)});class Ea extends m.Component{constructor(e){super(e),_a(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=D.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:mn.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:r}=this.props,{tableName:i,tableNameSet:o}=this.state;if(!o&&t!=null&&!i){var s,a=t.name.lastIndexOf("."),l=cs.legalizeTableName(t.name.substring(0,a));this.setState({tableName:l,tableNameSet:!0}),(s=this.inputRef.current)===null||s===void 0||s.focus()}else(t==null&&e.file!=null||r==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});r!=null&&r!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:mn.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:mn.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;So.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;So.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:r,timeZone:i,onInProgress:o}=this.props,{tableName:s,isFirstRowHeaders:a,type:l}=this.state,u=c=>{c.length===1?r.bindTableToVariable(c[0],s).then(()=>this.openTable()).catch(f=>this.handleError(f)):r.mergeTables(c).then(f=>{r.bindTableToVariable(f,s).then(()=>this.openTable()).catch(v=>this.handleError(v)),c.forEach(v=>v.close())}).catch(f=>this.handleError(f))},h=new wv({onFileCompleted:u,session:r,file:e,type:mn.TYPES[l],readHeaders:a,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});h.parse(),this.setState({showProgress:!0,parser:h}),o(!0)}handleZipFile(e){var{onUpdate:t,unzip:r}=this.props;if(r==null){this.handleError(new Error("No support for zip files available."));return}r(e).then(i=>{for(var o=!1,s=0;s<i.length;s+=1){var a=i[s];if(zt.isValidExtension(a.name)){t("Loading ".concat(a.name," as csv from ").concat(e.name)),o=!0,this.handleFile(a,!0);break}}if(!o)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}handleProgress(e){var{showProgress:t}=this.state;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var{onInProgress:e}=this.props,{parser:t}=this.state;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var{onOpenTable:e,onClose:t}=this.props,{tableName:r}=this.state;e(r),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:r,isFirstRowHeaders:i,showProgress:o,progressValue:s,type:a}=this.state,l=!!t&&!r;return 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:j("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(Su,{id:"formatSelect",className:"custom-select",value:a,onChange:this.handleQueryTypeChange,children:Tv})]}),d.jsx($d,{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(te,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),d.jsx(te,{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(s,"%")},"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100})}),d.jsxs("label",{children:[s,"%"]}),d.jsx(te,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}_a(Ea,"defaultProps",{file:null,paste:null,unzip:null});const Ov=Ea;function _o(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.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 s(l){_o(o,r,i,s,a,"next",l)}function a(l){_o(o,r,i,s,a,"throw",l)}s(void 0)})}}var Iv={placement:"bottom-end"};function Mv(n){var{children:e,dh:t,session:r,overflowActions:i}=n,[o,s]=m.useState(0),a=m.useCallback(function(){var c=xv(function*(f){s(p=>p+1);try{var{result:v}=f.detail;yield v}catch{}s(p=>p-1)});return function(f){return c.apply(this,arguments)}}(),[]);m.useEffect(function(){return r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,a)},[t,a,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 h=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:j("console-status-icon",l)}),d.jsx(on,{children:u})]}),e,h&&d.jsx(te,{kind:"ghost",icon:ol,tooltip:"More Actions...","aria-label":"More Actions...",onClick:us,children:d.jsx(Zr,{actions:i,popperOptions:Iv})})]})}var Dv=5e3;function Nv(n){var{openObject:e,objects:t}=n,[r,i]=m.useState(""),o=m.useRef(null),s=ld(()=>{i("")},Dv),a=m.useCallback(()=>{var h;s.cancel(),(h=o.current)===null||h===void 0||h.select()},[s]),l=m.useCallback(()=>{s()},[s]),u=m.useMemo(()=>{if(t.length===0)return[];var h={menuElement:d.jsx(Xr,{value:r,onChange:v=>{i(v.target.value)},className:"console-menu",ref:o})},c=r?t.filter(v=>{var{title:p}=v;return p!=null&&p.toLowerCase().includes(r.toLowerCase())}):t,f=c.map(v=>({title:v.title,action:()=>{e(v)},icon:d.jsx(fa,{type:v.type})}));return[h,...f]},[t,r,e]);return d.jsx(te,{"aria-label":"Objects",kind:"ghost",disabled:t.length===0,onClick:us,tooltip:t.length===0?"No objects available":"Objects",icon:d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(se,{mask:rs,icon:xr,transform:"right-5 down-5"}),d.jsx(se,{icon:xr,transform:"right-8 down-6"})]}),children:d.jsx(Zr,{actions:u,onMenuOpened:a,onMenuClosed:l,options:{initialKeyboardIndex:1},popperOptions:{placement:"bottom-end"}})})}function Eo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eo(Object(t),!0).forEach(function(r){Ae(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Eo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ae(n,e,t){return e=Lv(e),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:String(e)}function Av(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ze=$.module("Console"),Po={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function Rv(){return!0}function kv(n){return d.jsx(d.Fragment,{})}class Et extends m.PureComponent{static isErrorLevel(e){return e===ve.STDERR||e===ve.ERROR||e===ve.FATAL}static isOutputLevel(e){return e===ve.STDOUT||Et.isErrorLevel(e)}constructor(e){super(e),Ae(this,"cancelListener",void 0),Ae(this,"consolePane",void 0),Ae(this,"consoleInput",void 0),Ae(this,"consoleHistoryScrollPane",void 0),Ae(this,"pending",void 0),Ae(this,"queuedLogMessages",void 0),Ae(this,"processLogMessageQueue",Kr(()=>{this.setState(i=>{ze.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=i;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Et.LOG_THROTTLE)),Ae(this,"getObjects",Yt(i=>Array.from(i.values()))),Ae(this,"getContextActions",Yt(i=>[...i,{action:this.handleClearShortcut,shortcut:Jt.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Jt.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.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=D.createRef(),this.consoleInput=D.createRef(),this.consoleHistoryScrollPane=D.createRef(),this.pending=new sr,this.queuedLogMessages=[];var{objectMap:t,settings:r}=this.props;this.state=He(He({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},Po),r)}componentDidMount(){this.initConsoleLogging();var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}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()}initConsoleLogging(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}isAtBottom(){if(this.consoleHistoryScrollPane.current==null)return!1;var{scrollHeight:e,clientHeight:t,scrollTop:r}=this.consoleHistoryScrollPane.current;return Math.abs(e-t-r)<=1}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:r}=e.detail,i=this.pending.add(r),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{r.cancel()},wrappedResult:i},{commandHistoryStorage:s,language:a,scope:l}=this.props,u=s.addItem(a,l,t,{command:t,startTime:new Date().toJSON()});u.catch(h=>{ze.debug("Error adding workspace item",h)}),this.setState(h=>({consoleHistory:h.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom()}),i.then(h=>{this.handleCommandResult(h,o,u)}).catch(h=>{this.handleCommandError(h,o,u)})}handleCommandResult(e,t,r){var i=He(He({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(o=>{var{consoleHistory:s}=o,a=s.lastIndexOf(t);if(a<0)return ze.error("historyItem not found in consoleHistory"),null;var l=s.concat();return l[a]=i,{consoleHistory:l}}),e&&(this.updateHistory(e,i),this.updateKnownObjects(i),this.updateWorkspaceHistoryItem({error:e.error},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(Me.isCanceled(e)){ze.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),s=o.lastIndexOf(t),a=He({},t);return a.wrappedResult=void 0,a.cancelResult=void 0,a.endTime=Date.now(),a.result={error:e},o[s]=a,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&Et.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};Et.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){ze.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:r}=this.props;[...e.created,...e.updated].forEach(i=>r(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:r}=e;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.setState(i=>{var o=i.consoleHistory.concat();return{consoleHistory:o}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){ze.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,s,{consoleHistory:a}=r,l=a.lastIndexOf(e);if(l<0)return ze.error("historyItem not found in state.consoleHistory"),null;var u=new Map(r.objectHistoryMap),h=new Map(r.objectMap),c=function(v){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:g}=v;F(g);var y=u.get(g);if(y!=null&&y>=0){var _;a===r.consoleHistory&&(a=a.concat());var S=He(He({},a[y]),{},{disabledObjects:[...(_=a[y].disabledObjects)!==null&&_!==void 0?_:[],g]});a[y]=S}u.set(g,l),p?h.delete(g):h.set(g,v)};return(i=t)===null||i===void 0||i.updated.forEach(f=>c(f)),(o=t)===null||o===void 0||o.removed.forEach(f=>c(f,!0)),(s=t)===null||s===void 0||s.created.forEach(f=>{var{title:v}=f;F(v),u.set(v,l),h.set(v,f)}),{objectHistoryMap:u,objectMap:h,consoleHistory:a}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(o=>{var s=He(He({},o),{},{data:He(He({},o.data),{},{endTime:i,result:e})}),{commandHistoryStorage:a,language:l}=this.props;a.updateItem(l,s).catch(u=>{ze.warn("Error updating command history storage",u)})}).catch(o=>{ze.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=this.consoleHistoryScrollPane.current;e!=null&&window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight})})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;F(e),this.setState({isScrollDecorationShown:e.scrollTop>0&&e.scrollHeight>e.clientHeight,isStuckToBottom:this.isAtBottom()})}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:zt.MULTIPLE_FILE_ERROR});return}var r=t[0];zt.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:zt.FILE_TYPE_ERROR})}}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){var{dh:t,openObject:r,commandHistoryStorage:i,language:o,scope:s}=this.props,{consoleHistory:a,objectMap:l}=this.state,u={name:e,title:e,type:t.VariableType.TABLE},h=l.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[h?"updated":"created"]:[u]}}},f=a.concat(c);this.setState({consoleHistory:f}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(c),r({name:e,type:t.VariableType.TABLE}),i.addItem(o,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:r}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=r.concat(i);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:r}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ne.groups.high,icon:r?yr:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ne.groups.high,icon:e?yr:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ne.groups.high,icon:t?yr: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=>{ze.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(),this.setState(i=>({consoleHistory:i.consoleHistory.concat(r)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(r=>[r,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,r),t&&this.scrollConsoleHistoryToBottom())}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(Po),o={},s=!1,a=0;a<i.length;a+=1){var l=i[a],{[l]:u}=t,{[l]:h}=e;u!==h&&(s=!0),o[l]=u}if(!(r&&!s)){var{onSettingsChange:c}=this.props;c(o)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var{actions:e,dh:t,historyChildren:r,language:i,statusBarChildren:o,openObject:s,session:a,scope:l,commandHistoryStorage:u,timeZone:h,disabled:c,unzip:f,supportsType:v,iconForType:p,showObjectsMenu:g}=this.props,{consoleHeight:y,consoleHistory:_,isScrollDecorationShown:S,objectMap:C,showCsvOverlay:I,csvFile:U,csvPaste:G,dragError:x,csvUploadInProgress:K}=this.state,A=this.getObjects(C),Y=Math.round(y*.7),Q=this.getContextActions(e);return d.jsxs("div",{role:"presentation",className:j("iris-console","h-100","w-100",{disabled:c}),children:[d.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[d.jsxs(Mv,{dh:t,session:a,overflowActions:this.handleOverflowActions,children:[o,g===!0&&d.jsx(Nv,{openObject:s,objects:A})]}),d.jsxs("div",{className:"console-csv-container",onDragOver:zt.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[I&&d.jsx(zt,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:x,onError:this.handleCsvError,uploadInProgress:K,allowZip:f!=null}),d.jsxs("div",{role:"presentation",className:j("scroll-pane no-scroll-x",{"scroll-decoration":S}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[d.jsx(hf,{items:_,openObject:s,language:i,disabled:c,supportsType:v,iconForType:p}),r]})]}),!I&&d.jsx(fo,{ref:this.consoleInput,session:a,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:Y,commandHistoryStorage:u}),I&&d.jsx(Ov,{session:a,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:U??void 0,paste:G??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),d.jsx(ne,{actions:Q,ignoreClassNames:[fo.INPUT_CLASS_NAME]})]})}}Ae(Et,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:Rv,iconForType:kv,showObjectsMenu:!0});Ae(Et,"LOG_THROTTLE",500);const Fv=Et;function fn(n,e,t){return e=jv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jv(n){var e=$v(n,"string");return typeof e=="symbol"?e:String(e)}function $v(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Hv=250,Uv=2500;class mr extends m.Component{static getTimeString(e,t){if(e==null||t===""||t===0)return null;var r=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return r<1?"<1s":vs.formatElapsedTime(r)}constructor(e){super(e),fn(this,"timer",void 0),fn(this,"cleanup",void 0),fn(this,"loadData",Tn(()=>{var{commandHistoryStorage:t,item:r,language:i}=this.props,{id:o}=r;this.cleanup=t.listenItem(i,o,this.handleUpdate,this.handleError)},Hv)),fn(this,"getPreviewText",Kt(t=>t.split(`
|
|
10
|
-
`,Uv).join(`
|
|
11
|
-
`),{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=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var{data:t}=e??{};this.setState({data:t});var{onUpdate:r}=this.props;r==null||r(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:r}=this.props,{currentTime:i,data:o,error:s}=this.state,{result:a,startTime:l,endTime:u}=o??{},h=(e=a==null?void 0:a.error)!==null&&e!==void 0?e:s,c=mr.getTimeString(l,u??i),f=this.getPreviewText(t),v=!!c;return d.jsxs("div",{className:"command-history-item-tooltip",children:[d.jsxs("div",{className:"scroll-container",children:[d.jsx(va,{language:r,children:f}),f.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:[!!h&&d.jsxs("div",{className:"text-danger mr-1",children:[d.jsx(se,{icon:os})," Executed with errors"]}),d.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",v?d.jsx("span",{className:"time-string",children:c}):d.jsx(is,{className:"loading-spinner-vertical-align"})]})]}),!!h&&d.jsx("div",{className:"error-message",children:h})]})]})}}fn(mr,"defaultProps",{onUpdate:()=>{}});const Bv=mr;var Kv=512;function Pa(n){var{item:e,language:t,isSelected:r,commandHistoryStorage:i}=n,o=e.name.substring(0,Kv),s=m.useRef(null),a=m.useCallback(()=>{var l;(l=s.current)===null||l===void 0||l.update()},[s]);return d.jsxs("div",{className:j("command-history-item",{selected:r}),children:[o,d.jsx(on,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:d.jsx(Bv,{item:e,language:t,onUpdate:a,commandHistoryStorage:i})})]})}Pa.defaultProps={isSelected:!1};class ir 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(se,{icon:sl,mask:e.icon,transform:"right-5 down-5 shrink-4"}),d.jsx(se,{icon:es,transform:"shrink-3 right-7 down-6"})]}):d.jsx(se,{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(te,{kind:"inline",className:j(r.className),onClick:r.action,tooltip:r.description,disabled:r.selectionRequired!==void 0&&r.selectionRequired&&!t,icon:ir.renderContent(r)},ir.itemKey(i,r)))})}}const Wv=ir;var zv=150,To=3,Oo=$.module("CommandHistoryViewportUpdater");function Vv(n){var{table:e,columns:t,top:r=0,bottom:i=0,search:o,isReversed:s=!1,onUpdate:a}=n,l=m.useMemo(()=>Kr(u=>{var h=u.bottom-u.top,c=Math.max(0,u.top-h*To),f=u.bottom+h*To;e.setViewport({top:c,bottom:f,columns:u.columns})},zv),[e]);return m.useEffect(function(){var h=e.onUpdate(c=>{var f,v;a({items:(f=c.items)!==null&&f!==void 0?f:[],offset:(v=c.offset)!==null&&v!==void 0?v:0})});return()=>{Oo.debug("onUpdate cleanup"),h()}},[e,a]),m.useEffect(function(){e.setSearch(o??"")},[e,o]),m.useEffect(function(){l({top:r,bottom:i,columns:t})},[l,r,i,t,o,s]),m.useEffect(()=>()=>{Oo.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function xo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function Io(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){xo(o,r,i,s,a,"next",l)}function a(l){xo(o,r,i,s,a,"throw",l)}s(void 0)})}}function qe(n,e,t){return e=Gv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gv(n){var e=qv(n,"string");return typeof e=="symbol"?e:String(e)}function qv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var gt=$.module("CommandHistory");class Se extends m.Component{static getCommandsFromViewport(e,t,r){for(var i=[],o=0;o<r.length;o+=1)for(var s=r[o],a=s[0];a<=s[1];a+=1)if(a>=t&&a<t+e.length){var{name:l}=e[a-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return Io(function*(){var r=yield e.getSnapshot(t);return[...r.values()].map(i=>i.name)})()}constructor(e){super(e),qe(this,"itemActions",void 0),qe(this,"historyActions",void 0),qe(this,"pending",void 0),qe(this,"searchInputRef",void 0),qe(this,"itemListRef",void 0),qe(this,"debouncedSearchChange",Tn(()=>{this.setState(r=>{var{searchText:i}=r;return{debouncedSearchText:i,selectedRanges:[]}})},Se.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:al,shortcut:Gt.COPY,action:this.copySelectedCommands,group:ne.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:di,shortcut:Jt.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Se.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:ll,shortcut:Jt.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Se.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:ui,shortcut:Jt.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Se.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:ss,action:this.createNotebook,group:Se.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:di,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:ui,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new sr,this.searchInputRef=D.createRef(),this.itemListRef=D.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 Io(function*(){var{items:t,offset:r,selectedRanges:i}=e.state,o=i.slice().sort((a,l)=>a[0]-l[0]);if(o.length===0)return[];if(o[0][0]>=r&&o[o.length-1][1]<r+t.length)return Se.getCommandsFromViewport(t,r,o);var{table:s}=e.props;return e.pending.add(Se.getCommandsFromSnapshot(s,o))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
12
|
-
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<Se.MAX_SELECTION_COUNT?(gt.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(gt.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Rl).catch(gt.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t},!0)}).catch(gt.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t})}).catch(gt.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(gt.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(gt.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:r,offset:i}=this.state;if(e<i||e>=i+r.length){gt.error("Invalid index!",e);return}var{name:o}=r[e-i];t(o)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value}),this.debouncedSearchChange()}handleViewportUpdate(e){var{items:t,offset:r}=e,{table:i}=this.props,o=i.size;this.setState({items:t,itemCount:o,offset:r})}renderItem(e){var{item:t,itemIndex:r,isSelected:i}=e,{language:o,commandHistoryStorage:s}=this.props;return d.jsx(Pa,{isSelected:i,item:t,language:o,commandHistoryStorage:s})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:r}=this.props,{actions:i,historyActions:o,searchText:s,debouncedSearchText:a,top:l,bottom:u,items:h,itemCount:c,offset:f,selectedRanges:v}=this.state,p=(e=pa.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(Xr,{ref:this.searchInputRef,value:s,placeholder:"".concat(p," Command History"),onChange:this.handleSearchChange}),d.jsx(Wv,{actions:o,hasSelection:v.length>0})]}),d.jsxs("div",{className:"command-history-list",children:[d.jsx(Ie,{ref:this.itemListRef,itemCount:c,items:h,offset:f,selectedRanges:v,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Se.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),d.jsx(Vv,{table:r,top:l,bottom:u,search:a,onUpdate:this.handleViewportUpdate}),d.jsx(ne,{actions:i})]})]})}}qe(Se,"ITEM_HEIGHT",29);qe(Se,"MAX_SELECTION_COUNT",1e4);qe(Se,"SET_SEARCH_DEBOUNCE_MS",150);qe(Se,"menuGroups",{send:ne.groups.medium+100});const Zv=Se;class Xv 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:j("log-level-menu-item",e),children:[d.jsx(vu,{on:t,onClick:this.handleSwitchClick}),e]})}}const Yv=Xv;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 Do(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){Oe(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 Oe(n,e,t){return e=Qv(e),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:String(e)}function Jv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class le extends m.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),r=Qm.formatTimestamp(t);return"".concat(r," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),Oe(this,"cancelListener",void 0),Oe(this,"editor",void 0),Oe(this,"editorContainer",void 0),Oe(this,"logLevelMenuItems",void 0),Oe(this,"flushTimer",void 0),Oe(this,"bufferedMessages",void 0),Oe(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 a=le.AllLogLevels[o],l=e[a]!=null?e[a]:!1;r.push({title:a,group:1,order:o+100,menuElement:d.jsx(Yv,{logLevel:a,on:l,onClick:t.handleMenuItemClick,ref:u=>{u!=null&&(t.logLevelMenuItems[a]=u)}})})},o=0;o<le.AllLogLevels.length;o+=1)i();return r.push({group:1,order:1e3,menuElement:d.jsxs("div",{className:"log-level-menu-controls",children:[d.jsx(te,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),d.jsx(te,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),r}resetLogLevels(){for(var e={},t=function(){var o=le.AllLogLevels[r],s=le.DefaultLogLevels.some(a=>a===o);e[o]=s},r=0;r<le.AllLogLevels.length;r+=1)t();this.setState({shownLogLevels:e})}startListening(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){F(this.editorContainer),this.editor=ot.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"}),[[Lt.Escape],[Le.Shift|Lt.Escape]].forEach(e=>{F(this.editor),Wt.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[Lt.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,r,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();F(i),(r=this.editor)===null||r===void 0||r.setPosition(i)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,r=0;r<le.AllLogLevels.length;r+=1){var i=le.AllLogLevels[r];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var o={},s=0;s<le.AllLogLevels.length;s+=1){var a=le.AllLogLevels[s];o[a]=!0}this.setState({shownLogLevels:o})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,r=t[e],i={};i[e]=!r,this.updateLogLevels(i)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=Do(Do({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),r=t==null?void 0:t.getLineCount();F(r);var i=t==null?void 0:t.getLineLength(r);F(i);var o=this.isBottomVisible(),s=[];if(i>0&&(s.push({range:{startLineNumber:r,startColumn:i+1,endLineNumber:r,endColumn:i+1},text:`
|
|
13
|
-
`,forceMoveMarkers:!0}),r+=1,i=0),s.push({range:{startLineNumber:r,startColumn:i,endLineNumber:r,endColumn:i},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(s),o){var a=t==null?void 0:t.getLineCount();F(a),this.editor.revealLine(a,1)}}}refreshLogText(){if(this.editor){this.truncateLogIfNecessary();for(var{shownLogLevels:e}=this.state,t=this.isBottomVisible(),r="",i=0;i<this.messages.length;i+=1){var o=this.messages[i];if(e[o.logLevel]){var s=le.getLogText(o);s.length>0&&(r+=s,s.charAt(s.length-1)!==`
|
|
14
|
-
`&&(r+=`
|
|
15
|
-
`))}}if(r=r.trimRight(),this.editor.setValue(r),t){var a,l=(a=this.editor.getModel())===null||a===void 0?void 0:a.getLineCount();F(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>le.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-le.truncateSize))}scrollToBottom(){var e,t,r;if(this.editor){var i=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(r=t.call(e))===null||r===void 0?void 0:r.getLineCount();F(i),this.editor.revealLine(i,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return F(t),this.isLineVisible(t)}isLineVisible(e){var t,r=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(r==null||r.length===0)return!1;for(var i=0;i<r.length;i+=1){var o=r[i];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var r=this.bufferedMessages[t],i=le.getLogText(r);e+=i,i.charAt(i.length-1)!==`
|
|
16
|
-
`&&(e+=`
|
|
17
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,le.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(te,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:dl,tooltip:"Clear log"}),d.jsx(te,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:ul,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(Zr,{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}})]})}}Oe(le,"DefaultLogLevels",[ve.STDOUT,ve.ERROR,ve.FATAL,ve.STDERR,ve.WARN]);Oe(le,"AllLogLevels",[ve.INFO,ve.STDOUT,ve.ERROR,ve.FATAL,ve.STDERR,ve.WARN,ve.DEBUG,ve.TRACE]);Oe(le,"bufferTimeout",16);Oe(le,"maxLogSize",131072);Oe(le,"truncateSize",65536);const ep=le;function No(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function tp(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){No(o,r,i,s,a,"next",l)}function a(l){No(o,r,i,s,a,"throw",l)}s(void 0)})}}var np=$.module("HeapUsage");function rp(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:s}=n,a=Nh(),[l,u]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),f=m.useRef({timestamps:[],usages:[]}),v=ps(),p=m.useCallback(tp(function*(){try{var M=yield t.getWorkerHeapInfo();if(!v.current)return;if(u(M),o||h){for(var k=(M.totalHeapSize-M.freeMemory)/M.maximumHeapSize,H=Date.now(),{timestamps:he,usages:We}=f.current;he.length!==0&&H-he[0]>s*1.5;)he.shift(),We.shift();he.push(H),We.push(k)}else f.current={timestamps:[],usages:[]}}catch(je){np.warn("Unable to get heap usage",je)}}),[t,v,o,h,s]);ad(p,h?i:r);var g=(M,k)=>Math.round(M*10**k)/10**k,y=2,_=1024**3,{freeMemory:S,totalHeapSize:C,maximumHeapSize:I}=l,U=g(S/_,y),G=g(C/_,y),x=g(I/_,y),K=G-U,A=function(k,H){var he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:j("heap-usage-info-row",{"heading-bottom-border":he}),children:[d.jsx("div",{className:"font-weight-bold",children:k}),d.jsx("div",{children:H})]})},{timestamps:Y,usages:Q}=f.current,N=(e=Y[Y.length-1])!==null&&e!==void 0?e:0,W=C/I,R=(C-S)/I;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:j("used-memory",{"heap-overflow":(C-S)/I>.95}),style:{width:"calc(".concat(R*100,"% - ").concat(R*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[x.toFixed(1)," GB"]}),d.jsx(on,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[A("In use:","".concat(K.toFixed(y)," of ").concat(x.toFixed(y)," GB"),!0),A("Free:","".concat(U.toFixed(y)," GB")),A("Total:","".concat(G.toFixed(y)," GB")),A("Max:","".concat(x.toFixed(y)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Dh,{data:[{x:[...Y],y:[...Q],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(s/6),gridcolor:a.linecolor,range:[N-s,N],linecolor:a.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:a.linecolor,range:[0,1],linecolor:a.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}function Rn(n,e,t){return e=ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ip(n){var e=op(n,"string");return typeof e=="symbol"?e:String(e)}function op(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sn{}Rn(sn,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Rn(sn,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Rn(sn,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Rn(sn,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Rn(sn,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const dt=sn;function Tt(n,e,t){return e=sp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sp(n){var e=ap(n,"string");return typeof e=="symbol"?e:String(e)}function ap(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ct{}Tt(ct,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Tt(ct,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Tt(ct,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Tt(ct,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Tt(ct,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Tt(ct,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Tt(ct,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Tt(ct,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Lo=ct;function mt(n,e,t){return e=lp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lp(n){var e=dp(n,"string");return typeof e=="symbol"?e:String(e)}function dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Qe{}mt(Qe,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");mt(Qe,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");mt(Qe,"CLOSE_FILE","NotebookEvent.closeFile");mt(Qe,"RENAME","NotebookEvent.rename");mt(Qe,"RENAME_FILE","NotebookEvent.renameFile");mt(Qe,"REGISTER_FILE","NotebookEvent.registerFile");mt(Qe,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");mt(Qe,"UNREGISTER_FILE","NotebookEvent.unregisterFile");mt(Qe,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const Xt=Qe;function an(n,e,t){return e=up(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function up(n){var e=hp(n,"string");return typeof e=="symbol"?e:String(e)}function hp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $t{}an($t,"focus","TabEvent.focus");an($t,"blur","TabEvent.blur");an($t,"openPQObject","TabEvent.openPQObject");an($t,"openControl","TabEvent.openControl");an($t,"reload","TabEvent.reload");an($t,"clearAllFilters","TabEvent.clearAllFilters");const zn=$t;function cp(n,e,t){return e=mp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mp(n){var e=fp(n,"string");return typeof e=="symbol"?e:String(e)}function fp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ta 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,r,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(r=t.header)===null||r===void 0?void 0:r.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t==null?void 0:t.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,s,a,l,u,h;if(((i=t[r].contentItem)===null||i===void 0||(o=i.config)===null||o===void 0?void 0:o.id)===((s=e.tab)===null||s===void 0||(a=s.contentItem)===null||a===void 0||(l=a.config)===null||l===void 0?void 0:l.id))break;(u=((h=t[r])===null||h===void 0?void 0:h.contentItem).container)===null||u===void 0||u.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(X.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,s,a,l,u,h,c,f;if(((o=t[i].contentItem)===null||o===void 0||(s=o.config)===null||s===void 0?void 0:s.id)===((a=e.tab)===null||a===void 0||(l=a.contentItem)===null||l===void 0||(u=l.config)===null||u===void 0?void 0:u.id))break;var v=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(f=c.config)===null||f===void 0)&&f.isClosable);if(v){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o,s,a=!!(!((i=e[r])===null||i===void 0||(o=i.contentItem)===null||o===void 0||(s=o.config)===null||s===void 0)&&s.isClosable);if(a){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=P.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(s=>s.parentStackId===o))}render(){var e,t,r,{additionalActions:i,glContainer:o}=this.props,s=[...i];s.push(()=>({title:"Re-open closed panel",group:ne.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var a=(e=o.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(r=t.config)===null||r===void 0?void 0:r.isClosable;return s.push({title:"Close",order:10,group:ne.groups.low,action:this.handleCloseTab,disabled:a===void 0||!a}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ne.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ne.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(ne,{actions:s})}}cp(Ta,"defaultProps",{additionalActions:[]});var vp=n=>({workspace:Rs(n)}),pp=On(vp,{setWorkspace:Fs})(Ta);const gp=pp;function Oa(n,e,t){return e=bp(e),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:String(e)}function yp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class xa extends m.PureComponent{constructor(e){super(e),Oa(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=D.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,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.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:j("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:s=>{s.stopPropagation()},onMouseUp:s=>{s.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(te,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(te,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Gr,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Oa(xa,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function Ao(n,e,t){return e=Cp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cp(n){var e=wp(n,"string");return typeof e=="symbol"?e:String(e)}function wp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Sp=$.module("Panel");class _p extends m.PureComponent{constructor(e){super(e),Ao(this,"ref",void 0),Ao(this,"getAdditionalActions",Yt((r,i,o)=>{var s=[];return i&&s.push(this.getCloneAction()),o&&s.push(this.getRenameAction()),[...s,...r]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),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.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.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=D.createRef();var{glContainer:t}=this.props;this.state={title:P.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:r,glContainer:i,glEventHub:o}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),o.on(dt.SESSION_CLOSED,this.handleSessionClosed),o.on(dt.SESSION_OPENED,this.handleSessionOpened),o.on(zn.focus,this.handleTabFocus),o.on(zn.blur,this.handleTabBlur),o.on(Lo.CLEAR_ALL_FILTERS,this.handleClearAllFilters),o.emit(X.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.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(dt.SESSION_CLOSED,this.handleSessionClosed),r.off(dt.SESSION_OPENED,this.handleSessionOpened),r.off(zn.focus,this.handleTabFocus),r.off(zn.blur,this.handleTabBlur),r.off(Lo.CLEAR_ALL_FILTERS,this.handleClearAllFilters),r.emit(X.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:P.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}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)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(X.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)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e,t){var{onSessionOpen:r}=this.props;r==null||r(e,t)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=P.getRootFromContainer(t),i=P.getComponentConfigFromContainer(t);F(i),P.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=P.getRootFromContainer(e),i=P.getComponentConfigFromContainer(e);if(i==null){Sp.error("Could not get component config from container",e);return}var o=P.cloneComponent(r,i);o!==null&&t.emit(X.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:s=Il,errorMessage:a,isLoaded:l=!0,isLoading:u=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:f}=i,{showRenameDialog:v,title:p,isWithinPanel:g}=this.state;return d.jsxs("div",{className:j("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(Pn,{errorMessage:a,isLoaded:l,isLoading:u}),!g&&f!=null&&Wr.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(gp,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(s,h,c)}),c&&d.jsx(xa,{isShown:v,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&d.jsx(on,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),f.element[0])]})}}const fr=_p;var Ep=Object.freeze({}),Pp=new Map,vr=Object.freeze([]),sb=(n,e)=>{var t;return(t=be(n,e).columns)!==null&&t!==void 0?t:vr},ab=(n,e)=>{var t;return(t=be(n,e).filterSets)!==null&&t!==void 0?t:vr},lb=(n,e)=>{var t;return(t=be(n,e).filters)!==null&&t!==void 0?t:vr},db=(n,e)=>{var t;return(t=be(n,e).tableMap)!==null&&t!==void 0?t:Pp},ub=(n,e)=>be(n,e).isolatedLinkerPanelId,hb=(n,e)=>{var t;return(t=be(n,e).links)!==null&&t!==void 0?t:vr},cb=(n,e)=>be(n,e).columnSelectionValidator,mb=(n,e)=>{var t;return(t=be(n,e).consoleSettings)!==null&&t!==void 0?t:Ep},fb=(n,e)=>be(n,e).connection,pr=(n,e)=>be(n,e).sessionWrapper;function or(n,e,t){return e=Tp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tp(n){var e=Op(n,"string");return typeof e=="symbol"?e:String(e)}function Op(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vn=$.module("CommandHistoryPanel");class kn extends m.Component{static handleError(e){Vn.error(e)}constructor(e){super(e),or(this,"container",void 0),or(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=D.createRef(),this.pending=new sr;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Jt.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(dt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(dt.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(Vn.debug("handleSendToNotebook",r,e),!r){Vn.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?Xt.CREATE_NOTEBOOK:Xt.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;Vn.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(dt.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;F(t),F(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(kn.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:s}=this.state;return d.jsxs(fr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!s&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),s&&i!=null&&d.jsxs(d.Fragment,{children:[d.jsx(Zv,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:r}),d.jsx(ne,{actions:o})]})]})}}or(kn,"COMPONENT","CommandHistoryPanel");or(kn,"TITLE","Command History");var xp=(n,e)=>{var t=As(n),r=pr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:s,id:a}=o??{};return{commandHistoryStorage:t,language:s,session:i,sessionId:a}},Ip=On(xp,null,null,{forwardRef:!0})(kn);const vb=Ip;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 Gn(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){Rt(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 Rt(n,e,t){return e=Mp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mp(n){var e=Dp(n,"string");return typeof e=="symbol"?e:String(e)}function Dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qn=$.module("ConsolePanel"),Np=500,Lp=Object.freeze({consoleSettings:{},itemIds:[]});class gr extends m.PureComponent{constructor(e){super(e),Rt(this,"consoleRef",void 0),Rt(this,"objectSubscriptionCleanup",void 0),Rt(this,"savePanelState",Tn(()=>{var{consoleSettings:s,itemIds:a}=this.state,l={consoleSettings:s,itemIds:[...a]};qn.debug("Saving panel state",l),this.setState({panelState:l})},Np)),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=D.createRef();var{panelState:t}=e,r=Gn(Gn({},Lp),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(X.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(X.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=>{qn.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:s,created:a,removed:l}=r,u=[...s,...l],h=new Map(o);u.forEach(f=>{var{title:v}=f;v!==void 0&&h.delete(v)});var c=[...s,...a];return c.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}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=Nt(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i,{itemIds:o}=this.state,s=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(r=e.props)===null||r===void 0||(i=r.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(s&&a){var l=new Set(o.values());l.has(a)&&this.setItemId(s,s)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(dt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&P.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;i.emit(X.CLOSE,r)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;qn.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(dt.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;F(r);var{config:i,session:o}=r,{title:s=e.name}=e;F(s);var a=this.getItemId(s),l={fetch:()=>o.getObject(e),panelId:a,widget:Gn(Gn({},Pu(e)),{},{sessionId:i.id})};qn.debug("openWidget",l),wm(t,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:s}=this.props;o.forEach(a=>{s.emit(X.CLOSE,a)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>Bi(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Bi(i,e));return r!=null?Ch(r):d.jsx(fa,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:s}=this.props;if(i==null)return d.jsx(Pn,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:a,error:l,objectMap:u}=this.state,{config:h,session:c,connection:f,details:v={},dh:p}=i,{workerName:g,processInfoId:y}=v,{id:_,type:S}=h;return d.jsx(fr,{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:c!=null&&d.jsx(Fv,{dh:p,ref:this.consoleRef,settings:a,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:S,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:pa.LANGUAGE_MAP.get(S)}),g!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),g]}),y!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:"•"}),y,d.jsx("div",{children:"•"})]}),d.jsx(rp,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:_,timeZone:o,objectMap:u,unzip:s,supportsType:this.supportsType,iconForType:this.iconForType})})}}Rt(gr,"COMPONENT","ConsolePanel");Rt(gr,"TITLE","Console");Rt(gr,"contextType",Im);var Ap=(n,e)=>({commandHistoryStorage:As(n),sessionWrapper:pr(n,e.localDashboardId),timeZone:Au(n),plugins:Ru(n)}),Rp=On(Ap,null,null,{forwardRef:!0})(gr);const pb=Rp;function gb(n){return n==="file"||n==="directory"}function Be(n){return n.type==="directory"}function kp(n,e,t){return e=Fp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=jp(n,"string");return typeof e=="symbol"?e:String(e)}function jp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $p extends Error{constructor(){super("No file exists at the path specified"),kp(this,"isFileNotFound",!0)}}const oi=$p;function ko(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function Fo(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){ko(o,r,i,s,a,"next",l)}function a(l){ko(o,r,i,s,a,"throw",l)}s(void 0)})}}var at;(function(n){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=""})(at||(at={}));class Ge{static fileExists(e,t){return Fo(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof oi))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(!Ge.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 Fo(function*(){for(var r=Ge.getCopyFileName(t);yield Ge.fileExists(e,r);)r=Ge.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return at.GROOVY;case"py":return at.PYTHON;case"pyc":return at.PYTHON_COMPILED;case"scala":return at.SCALA;case"txt":return at.PLAIN_TEXT;default:return at.UNKNOWN}}static getParent(e){if(!Ge.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(!Ge.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=Ge.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new pn("Name cannot be empty");if(t.includes(e))throw new pn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,s;throw new pn('Invalid characters in name: "'.concat((o=(s=e.match(r))===null||s===void 0?void 0:s.reduce((a,l)=>a.includes(l)?a:[...a,l],[]).map(a=>i.has(a)?i.get(a):a).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>Ge.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)}}const z=Ge;var si=26;function Ur(n){return Be(n)?z.makePath(n.filename):z.getPath(n.filename)}function jo(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=Ur(e);if(n.some(r=>{var{filename:i}=r;return z.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>Be(r)&&t.startsWith(z.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Hp(n){if(Be(n))return n.isExpanded?hl:cl;var e=z.getMimeType(n.basename);switch(e){case at.PYTHON:return fl;default:return ml}}function Br(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:s,item:a,itemIndex:l,dropTargetItem:u,onDragStart:h,onDragOver:c,onDragEnd:f,onDrop:v}=n,p=(e=r==null?void 0:r.some(x=>x.id===a.id))!==null&&e!==void 0?e:!1,g=Ur(a),y=i&&u?Ur(u):null,_=i&&o&&Be(a)&&y===g,S=i&&o&&y===g,C=i&&!o&&y===g,I=Hp(a),U=z.getDepth(a.filename),G=Array(U).fill(null).map((x,K)=>d.jsx("span",{className:"file-list-depth-line"},K));return d.jsxs("div",{className:j("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":_,"is-in-drop-target":S,"is-invalid-drop-target":C,"is-selected":s}),onDragStart:x=>h(l,x),onDragOver:x=>c(l,x),onDragEnd:x=>f(l,x),onDrop:x=>v(l,x),draggable:!0,role:"presentation","aria-label":a.basename,children:[G," ",d.jsx(se,{icon:I,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[a.basename,d.jsx(on,{children:a.basename})]})})]})}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 Zn(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){Up(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 Up(n,e,t){return e=Bp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bp(n){var e=Kp(n,"string");return typeof e=="symbol"?e:String(e)}function Kp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ce=$.module("FileList"),Wp=500,Ho="item-list-scroll-pane";function zp(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:s=()=>{},renderItem:a=Br,rowHeight:l=si,overscanCount:u=Ie.DEFAULT_OVERSCAN}=n,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[f,v]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[y,_]=m.useState(),[S,C]=m.useState(),[I,U]=m.useState([]),G=m.useRef(),x=m.useRef(null),K=m.useRef(null),A=m.useCallback(E=>{if(E.length===0||h==null)return[];for(var B=[],ee=0;ee<E.length;ee+=1)for(var me=E[ee],ye=me[0];ye<=me[1];ye+=1)ye>=h.offset&&ye<h.offset+h.items.length&&B.push(h.items[ye-h.offset]);return B},[h]),Y=m.useCallback(E=>{var B=A([[E,E]]);if(B.length>0)return B[0]},[A]),Q=m.useCallback(()=>{var E=rt.count(I);if(E===0)return null;if(E===1){var B=I[0][0],ee=Y(B);if(ee!=null)return ee.filename}return"".concat(E," items")},[Y,I]),N=m.useCallback(E=>{if(!(!y||!p)){Ce.debug("dropItems",y,"to",E);try{var{files:B,targetPath:ee}=jo(y,p);if(i==null||i(B,ee),E!=null){var me;U([[E,E]]),(me=x.current)===null||me===void 0||me.focusItem(E)}}catch(ye){Ce.error("Unable to complete move",ye)}}},[y,p,i]),W=m.useCallback((E,B)=>{var ee=h.items[E-h.offset];ee!==void 0&&(Ce.debug("handleItemClick",ee),o(ee,B),Be(ee)&&(t==null||t.setExpanded(ee.filename,!ee.isExpanded)))},[h,o,t]),R=m.useCallback((E,B)=>{var ee;Ce.debug2("handleItemDragStart",E,I);var me=I;rt.isSelected(I,E)||(me=[[E,E]],U(me)),_(A(me)),(ee=x.current)===null||ee===void 0||ee.resetMouseState();var ye=document.createElement("div");ye.innerHTML='<div class="dnd-placeholder-content">'.concat(Q(),"</div>"),ye.className="file-list-dnd-placeholder",document.body.appendChild(ye),B.dataTransfer.setDragImage(ye,0,0),B.dataTransfer.effectAllowed="move",C(ye)},[Q,A,I]),M=m.useCallback((E,B)=>{B.preventDefault(),Ce.debug2("handleItemDragOver",B),g(Y(E))},[Y]),k=m.useCallback((E,B)=>{Ce.debug("handleItemDragEnd",E),S==null||S.remove(),_(void 0),g(void 0),C(void 0)},[S]),H=m.useCallback((E,B)=>{N(E)},[N]),he=m.useCallback(()=>{Ce.debug2("handleItemDragExit"),g(void 0)},[]),We=m.useCallback(E=>{E.target instanceof Element&&E.target.classList.contains(Ho)&&(E.preventDefault(),Ce.debug2("handleListDragOver",E),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),je=m.useCallback(E=>{E.target instanceof Element&&E.target.classList.contains(Ho)&&(Ce.debug("handleListDrop"),N())},[N]),L=m.useCallback(function(E){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ce.debug2("handleSelectionChange",E),B===!0||E!==I){U(E);var ee=A(E);s(ee)}},[A,s,I]),J=m.useCallback(E=>{if(Ce.debug2("handleFocusChange",E),E!=null){var[B]=A([[E,E]]);r(B)}else r();G.current=E},[A,r]),re=m.useCallback((E,B)=>{Ce.debug("handleViewportChange",E,B),(E!==f.top||B!==f.bottom)&&v({top:E,bottom:B})},[f]),ln=m.useMemo(()=>{if(!y||!p)return!1;try{return jo(y,p),Ce.debug("handleValidateDropTarget true"),!0}catch{return Ce.debug("handleValidateDropTarget false"),!1}},[y,p]),{focusedPath:ft}=n;m.useEffect(()=>{ft!==void 0&&(ft==="/"?t.collapseAll():(t.setExpanded(ft,!1),t.setExpanded(ft,!0)))},[t,ft]),m.useEffect(function(){Ce.debug("updating table viewport",f),t==null||t.setViewport({top:Math.max(0,f.top-u),bottom:f.bottom+u})},[u,t,f]),m.useEffect(function(){var B=t.onUpdate(ee=>{c({items:ee.items.map(me=>Zn(Zn({},me),{},{itemName:me.basename})),offset:ee.offset,itemCount:t.size})});return()=>{B()}},[t]),m.useEffect(function(){G.current!=null&&J(G.current),I.length>0&&L(I,!0)},[h,J,L,I]),m.useEffect(function(){if(p!=null&&Be(p)&&p.filename!=="/"){var B=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},Wp);return()=>clearTimeout(B)}},[p,t]);var Fn=m.useCallback(E=>a(Zn(Zn({},E),{},{isDragInProgress:y!=null,dropTargetItem:p,draggedItems:y,isDropTargetValid:ln,onDragStart:R,onDragEnd:k,onDragOver:M,onDragExit:he,onDrop:H})),[k,he,M,R,H,y,p,ln,a]);return d.jsx("div",{ref:K,className:j("file-list",{"is-dragging":y!=null}),onDragOver:We,onDrop:je,children:d.jsx(Ie,{ref:x,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:J,onSelect:W,onSelectionChange:L,onViewportChange:re,selectedRanges:I,renderItem:Fn,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Vp={name:"File Explorer",DELETE:oe.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[w.DELETE],macShortcut:[O.CMD,w.BACKSPACE]}),RENAME:oe.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[w.ENTER],macShortcut:[w.ENTER]})};const Uo={FILE_EXPLORER:Vp};var Bo=$.module("FileListItemEditor"),Gp=()=>Promise.resolve();function qp(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Gp}=n,o=m.useRef(null),[s,a]=m.useState(e.basename),[l,u]=m.useState(),[h,c]=m.useState(Promise.resolve()),f=m.useCallback(()=>{var S;(S=o.current)===null||S===void 0||S.focus()},[o]),v=m.useCallback(S=>S.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{r(s)}).catch(S=>Bo.info("Unable to validate name",S))},[r,s,h]);m.useEffect(function(){var C=Me.makeCancelable(i(s));return C.then(()=>u(void 0)).catch(I=>{Me.isCanceled(I)||u(I)}),c(C),()=>C.cancel()},[i,s]),m.useEffect(function(){f()},[f]);var g=m.useCallback(()=>{Bo.debug2("handleBlur"),p()},[p]),y=m.useCallback(S=>{var{value:C}=S.target;a(C)},[]),_=m.useCallback(S=>{S.stopPropagation();var{key:C}=S;switch(C){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:j("form-control file-list-item-editor-input",{"is-invalid":l}),value:s,ref:o,onBlur:g,onKeyDown:_,onChange:y,onClick:v,onDoubleClick:v,onMouseDown:v}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Ko(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ko(Object(t),!0).forEach(function(r){Zp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ko(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zp(n,e,t){return e=Xp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xp(n){var e=Yp(n,"string");return typeof e=="symbol"?e:String(e)}function Yp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ia(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:s,onDelete:a,onMove:l,onRename:u,onSelect:h,onSelectionChange:c,table:f,rowHeight:v=si,validateRename:p=()=>Promise.resolve()}=n,[g,y]=m.useState(),[_,S]=m.useState([]),[C,I]=m.useState(),U=m.useCallback(H=>{S(H),c==null||c(H)},[c]),G=m.useCallback(H=>{I(H)},[]),x=m.useCallback(()=>{C&&(s==null||s(C))},[C,s]),K=m.useCallback(()=>{_.length>0&&(a==null||a(_))},[a,_]),A=m.useCallback(()=>{i==null||i()},[i]),Y=m.useCallback(()=>{C&&(o==null||o(z.getPath(C.filename)))},[C,o]),Q=m.useCallback(()=>{C&&y(C)},[C]),N=m.useCallback(()=>{y(void 0)},[]),W=m.useCallback(H=>{g&&(u==null||u(g,H),y(void 0))},[u,g]),R=m.useMemo(()=>{if(g)return[];var H=[];return i&&H.push({title:"New File",description:"Create new file",action:A,group:ne.groups.medium}),o&&H.push({title:"New Folder",description:"Create new folder",action:Y,group:ne.groups.medium}),s&&H.push({title:"Copy File",description:"Copy the selected file",action:x,group:ne.groups.low,disabled:C==null||Be(C)}),a&&_.length>0&&H.push({title:"Delete",description:"Delete",shortcut:Uo.FILE_EXPLORER.DELETE,action:K,group:ne.groups.low}),u&&H.push({title:"Rename",description:"Rename",shortcut:Uo.FILE_EXPLORER.RENAME,action:Q,group:ne.groups.low,disabled:C==null}),H},[x,K,A,Y,Q,C,s,i,o,a,u,_,g]),M=m.useCallback(H=>(F(g),p(g,H)),[g,p]),k=m.useCallback(H=>{var{item:he}=H;return g&&g.filename===he.filename?d.jsx(Br,Or(Or({},H),{},{children:d.jsx(qp,{item:he,validate:M,onSubmit:W,onCancel:N})})):d.jsx(Br,Or({},H))},[N,W,g,M]);return d.jsxs("div",{className:"file-list-container",children:[f!=null&&d.jsx(zp,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:G,renderItem:k,rowHeight:v,table:f,isMultiSelect:e,focusedPath:t}),r&&d.jsx(ne,{actions:R})]})}Ia.displayName="FileListContainer";function Wo(n,e,t){return e=Qp(e),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:String(e)}function Jp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eg extends pn{constructor(e){super("Name already exists"),Wo(this,"isExistingFile",!0),Wo(this,"info",void 0),this.info=e}}const Yn=eg;function zo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function Vo(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){zo(o,r,i,s,a,"next",l)}function a(l){zo(o,r,i,s,a,"throw",l)}s(void 0)})}}var Ve=$.module("FileExplorer");function ai(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:s=()=>{},onCreateFile:a=()=>{},onCreateFolder:l=()=>{},onSelect:u,onSelectionChange:h,rowHeight:c=si}=n,[f,v]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var W;function R(){return M.apply(this,arguments)}function M(){return M=Vo(function*(){Ve.debug("initTable"),W=Me.makeCancelable(e.getTable(),k=>k.close());try{g(yield W)}catch(k){Me.isCanceled(k)||Ve.error("Unable to initialize table",k)}}),M.apply(this,arguments)}return R(),()=>{W.cancel()}},[e]);var y=m.useCallback(N=>{Me.isCanceled(N)||Ve.error(N)},[]),_=m.useCallback(()=>{Ve.debug("handleCreateFile"),a()},[a]),S=m.useCallback(()=>{Ve.debug("handleCreateFolder"),l()},[l]),C=m.useCallback(N=>{Ve.debug("handleCopyFile",N.filename),i(N)},[i]),I=m.useCallback(N=>{Ve.debug("handleDelete, pending confirmation",N),v(N)},[]),U=m.useCallback(()=>{Ve.debug("handleDeleteConfirm",f),f.forEach(N=>e.deleteFile(Be(N)?z.makePath(N.filename):N.filename)),o(f),v([])},[f,o,e]),G=m.useCallback(()=>{Ve.debug("handleDeleteCancel"),v([])},[]),x=m.useCallback((N,W)=>{var R=z.reducePaths(N.map(M=>Be(M)?z.makePath(M.filename):M.filename));R.forEach(M=>{var k=z.isPath(M)?"".concat(W).concat(z.getBaseName(M.substring(0,M.length-1)),"/"):"".concat(W).concat(z.getBaseName(M));e.moveFile(M,k).then(()=>{s(M,k)}).catch(y)})},[y,s,e]),K=m.useCallback((N,W)=>{var R=N.filename,M=Be(N);M&&!R.endsWith("/")&&(R="".concat(R,"/"));var k="".concat(z.getParent(R)).concat(W);M&&!k.endsWith("/")&&(k="".concat(k,"/")),Ve.debug2("handleRename",R,k),e.moveFile(R,k).catch(y),s(R,k)},[y,s,e]),A=m.useCallback(function(){var N=Vo(function*(W,R){if(R!==W.basename){z.validateName(R);var M="".concat(z.getPath(W.filename)).concat(R);try{var k=yield e.info(M);throw new Yn(k)}catch(H){if(!(H instanceof oi))throw H}}});return function(W,R){return N.apply(this,arguments)}}(),[e]),Y=f.length>0,Q=m.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return d.jsxs("div",{className:"file-explorer",children:[p&&d.jsx(Ia,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:C,onCreateFolder:S,onCreateFile:_,onMove:x,onDelete:I,onRename:K,onSelect:u,onSelectionChange:h,rowHeight:c,table:p,validateRename:A}),d.jsx(Cn,{isOpen:Y,headerText:Q,bodyText:"You cannot undo this action.",onCancel:G,onConfirm:U,confirmButtonText:"Delete"})]})}ai.displayName="FileExplorer";function Go(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function tg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){Go(o,r,i,s,a,"next",l)}function a(l){Go(o,r,i,s,a,"throw",l)}s(void 0)})}}function wt(n,e,t){return e=ng(e),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:String(e)}function rg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var xt=$.module("NewItemModal");class kt extends m.PureComponent{static getValidationMessage(e){return e instanceof Yn&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Me.isCanceled(e)||xt.error(e)}constructor(e){super(e),wt(this,"inputRef",D.createRef()),wt(this,"cancelableValidatePromise",void 0),wt(this,"cancelableExistingItemPromise",void 0),wt(this,"pending",new sr),wt(this,"pathMap",new Map),wt(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=z.hasPath(t)?z.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:z.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:z.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:s}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(s!==t.path||o!==t.value)&&this.updateValidationStatus(s,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=z.hasPath(e)?z.getPath(e):"/";this.setState({path:t,value:z.getBaseName(e),validationError:void 0,prevExtension:z.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=Me.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return tg(function*(){z.validateName(t);var{defaultValue:o,storage:s}=i.props;if(r){var a="".concat(e).concat(t);if(a!==o)try{var l=yield s.info(a);throw new Yn(l)}catch(u){if(!(u instanceof oi))throw u}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(kt.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(xt.debug("handleSelect",e),e.type==="directory")this.setState({path:z.makePath(e.filename)});else{var t=e.basename,r=z.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 pn))throw e;xt.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;xt.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){xt.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=z.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){xt.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:s,type:a}=this.props;xt.debug("submitModal",r,i);var l=z.getExtension(i);return s&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(u=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(u=>{if(u instanceof Yn&&a!=="directory"&&u.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw u}).catch(u=>{throw Me.isCanceled(u)&&this.setState({isSubmitting:!1}),u}).catch(this.handleValidationError).catch(kt.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((r,i)=>{for(var o="",s=0;s<i;s+=1)o+="".concat(t[s],"/");return o+="".concat(r,"/"),d.jsxs(D.Fragment,{children:[d.jsx(te,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?d.jsx(se,{icon:vl,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:s}=this.props,{isSubmitting:a,path:l,showExtensionChangeModal:u,showOverwriteModal:h,validationError:c,value:f,prevExtension:v,newExtension:p}=this.state,g=s==="directory",y=z.fileExtensionToString(v),_=z.fileExtensionToString(p),S=g?"Create":"Save",C=g?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(Yo,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[d.jsx(Qo,{toggle:r,children:o}),d.jsx(Jo,{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:C}),d.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:j("form-control",{"is-invalid":c}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:kt.getValidationMessage(c)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(ai,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Cs,{children:[d.jsx(te,{kind:"secondary",onClick:r,children:"Cancel"}),d.jsx(te,{kind:"primary",disabled:a,onClick:this.handleModalSubmit,children:S})]})]}),d.jsx(Cn,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),d.jsx(Cn,{isOpen:u,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(_,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(_,'"')})]})}}wt(kt,"propTypes",{isOpen:b.bool,title:b.string.isRequired,defaultValue:b.string,type:b.oneOf(["file","directory"]).isRequired,onSubmit:b.func,onCancel:b.func,placeholder:b.string,storage:b.shape({}).isRequired,notifyOnExtensionChange:b.bool});wt(kt,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});const ig=kt;function og(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(te,{kind:"ghost",icon:ss,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(te,{kind:"ghost",icon:pl,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(su,{value:i,onChange:r,placeholder:"Search by name"})})]})}function qo(n,e,t,r,i,o,s){try{var a=n[o](s),l=a.value}catch(u){t(u);return}a.done?e(l):Promise.resolve(l).then(r,i)}function sg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function s(l){qo(o,r,i,s,a,"next",l)}function a(l){qo(o,r,i,s,a,"throw",l)}s(void 0)})}}function Ma(n,e,t){return e=ag(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ag(n){var e=lg(n,"string");return typeof e=="symbol"?e:String(e)}function lg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var It=$.module("FileExplorerPanel"),dg=(n,e)=>{var t=Nu(n),r=pr(n,e.localDashboardId),{session:i,config:o}=r??{},s=o==null?void 0:o.type;return{fileStorage:t,language:s,session:i}},ug=On(dg,null,null,{forwardRef:!0});function hg(n){var e=n;return e!=null&&typeof e.button=="number"}class nn extends D.Component{static handleError(e){It.error(e)}static isFocusEvent(e){return hg(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:""};It.debug("handleCreateFile",t,r,i),e.emit(Xt.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){It.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){It.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(nn.handleError)}handleCopyFile(e){var t=this;return sg(function*(){var{fileStorage:r}=t.props;if(Be(e)){It.error("Invalid item in handleCopyItem",e);return}var i=yield z.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(Xt.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=z.makePath(e[0].filename):t=z.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(It.debug("fileSelect",e),e.type!=="directory"){var r=nn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:s,language:a}=this.state,l={value:null,language:a};o.emit(Xt.SELECT_NOTEBOOK,s,a,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;It.debug("handleRename",e,t),r.emit(Xt.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:s}=this.state;return d.jsxs(fr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(og,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&d.jsx(ai,{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(ig,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}Ma(nn,"COMPONENT","FileExplorerPanel");Ma(nn,"TITLE","File Explorer");var cg=ug(nn);const bb=cg;function En(n,e,t){return e=mg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mg(n){var e=fg(n,"string");return typeof e=="symbol"?e:String(e)}function fg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Zo=$.module("LogPanel");class br extends m.PureComponent{constructor(e){super(e),En(this,"isBottomVisible",void 0),En(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){Zo.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Zo.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(fr,{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(ep,{session:r,ref:i=>{this.logView=i}})]})}}En(br,"defaultProps",{session:null});En(br,"COMPONENT","LogPanel");En(br,"TITLE","Log");var vg=(n,e)=>{var t;return{session:(t=pr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},pg=On(vg,null,null,{forwardRef:!0})(br);const yb=pg;export{Eu as $,xe as A,gn as B,$d as C,Zr as D,Il as E,jd as F,su as G,Gt as H,Ie as I,uu as J,w as K,Cs as L,O as M,Xr as N,Su as O,Gr as P,ar as Q,rt as R,ae as S,on as T,bs as U,Eg as V,vu as W,Ud as X,_s as Y,Hd as Z,Qn as _,Fm as a,gb as a$,Ns as a0,Ds as a1,Pg as a2,Tg as a3,Og as a4,ql as a5,st as a6,ue as a7,ut as a8,Xe as a9,rb as aA,ob as aB,Zm as aC,Yg as aD,Nm as aE,Pm as aF,X as aG,sa as aH,ua as aI,aa as aJ,tb as aK,be as aL,nb as aM,ca as aN,la as aO,Zg as aP,Am as aQ,ma as aR,Um as aS,Qg as aT,Jg as aU,eb as aV,Bt as aW,Wt as aX,ks as aY,z as aZ,oi as a_,Me as aa,zg as ab,Qr as ac,Mn as ad,ch as ae,Ch as af,Wg as ag,bh as ah,ph as ai,fh as aj,mh as ak,Bg as al,vh as am,Kg as an,gh as ao,js as ap,Bi as aq,mi as ar,Ph as as,$s as at,Vg as au,Dh as av,Nh as aw,P as ax,Xg as ay,Im as az,fu as b,qg as b0,Cm as b1,Vu as b2,pb as b3,yb as b4,vb as b5,bb as b6,Rl as b7,Fu as b8,ku as b9,xg as bA,Ig as bB,ab as bC,$g as bD,Xt as bE,dt as bF,ig as bG,Nu as bH,Mg as bI,pr as bJ,Be as bK,Au as bL,ke as bM,zn as bN,fb as bO,mb as bP,_g as bQ,Cg as bR,cs as bS,va as bT,pn as bU,Ag as ba,Ng as bb,Lg as bc,Rg as bd,ju as be,$u as bf,Hu as bg,Uu as bh,th as bi,Ql as bj,wg as bk,yg as bl,Jt as bm,rv as bn,ms as bo,fr as bp,hb as bq,Hg as br,sr as bs,Lo as bt,db as bu,Dg as bv,ub as bw,cb as bx,lb as by,sb as bz,oe as c,Ug as d,wm as e,kg as f,Pu as g,Fs as h,jg as i,ib as j,Sg as k,ad as l,In as m,ld as n,gs as o,ps as p,ud as q,dd as r,Fg as s,ys as t,_u as u,us as v,vs as w,ne as x,Cn as y,te as z};
|
|
18
|
-
//# sourceMappingURL=LogPanel-05058706.js.map
|