@deephaven/embed-widget 0.59.1-beta.3 → 0.59.1-beta.4

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.
@@ -1,4 +1,4 @@
1
- import{ae as sr,af as hl,ag as cl,ah as vl,ai as pl,C as d,F as J,r as p,aj as or,ak as ml,V as $,E as X,al as Gn,G as Z,am as Sn,an as Ds,a7 as te,ao as En,a6 as Ms,K as Je,U as Et,R as Fs,ap as zi,aq as Ke,D as qi,L as $e,ar as xs,as as fl,at as Is,X as Bn}from"./vendor-d09ca476.js";import{bP as lr,$ as $t,k as gl,e as Rs,B as k,N as xe,w as se,K as re,bQ as bl,b7 as Be,G as Mn,i as Q,bR as qe,bS as ks,H as qt,C as Cl,f as Kt,S as js,bT as Tt,T as wt,bU as As,bV as _s,I as Yi,X as Sl,aH as ci,u as El,aF as yl,P as Pl,aI as M,aL as oe,q as wl,aS as $s,a$ as ot,b6 as Ot,n as Ar,Q as Us,aG as _r,ay as Hs,bz as je,az as Vs,b0 as Gs,aM as Tl,o as dr,ab as Ae,a7 as $r,a2 as Bs,a6 as Ur,bW as yn,R as Hr,l as Fn,z as Ws,s as Ol,E as Nl,F as Vr,bb as Ll,bK as Ri,bq as mt,ba as vi,aQ as Dl,bu as Ml,a_ as Fl,aA as Pn,aW as nn,aK as me,bX as xl,aR as Il,aJ as dn,br as ur,bY as Rl,bZ as kl,b_ as jl,b$ as mn,a3 as Al,aY as _l,b1 as $l,aX as Ul}from"./IrisGridModelFactory-08259eaa.js";import{L as z,R as Hl,U as Ks,V as hr,X as cr,n as zs,e as Vl,h as I,Y as Wt,Z as Gl,_ as Gr,$ as Bl,a0 as Wl,a1 as Kl,a2 as zl,v as kn,a3 as vr,a4 as qs,c as wn,a as pr,a5 as Xi,a6 as ql,a7 as Yl,a8 as Br,a9 as ri,aa as Wr,ab as Ys,ac as Xl,ad as pi,ae as Zl,T as Zi,af as Ql,ag as Jl,ah as ed,ai as td,aj as nd,M as Xs,o as Zs,b as Qs,ak as id,al as Js,am as rd,an as eo,ao as to,ap as Kr,aq as ad,ar as sd,as as od,at as ld,au as dd,av as ud,aw as hd}from"./index-d6a38fca.js";import{P as ge,t as cd,r as zr,g as vd,C as pd,u as md,e as Nt,s as no,o as fd,n as gd,q as bd}from"./usePlugins-939066ff.js";import"./helpers-042e6b4d.js";import"./plotly-6980623c.js";function qr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Cd(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(t),!0).forEach(function(n){Sd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):qr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Sd(i,e,t){return e=Ed(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ed(i){var e=yd(i,"string");return typeof e=="symbol"?e:String(e)}function yd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Pd=Object.freeze({}),wd=new Map,io=i=>i.api,Td=i=>i.user,ro=i=>i.storage,ao=i=>ro(i).commandHistoryStorage,so=i=>ro(i).fileStorage,Od=i=>i.defaultWorkspaceSettings,oo=i=>{var{workspace:e}=i;return e},jn=i=>{for(var e=oo(i).data.settings,t=Cd({},Od(i)),n=Object.keys(e),r=0;r<n.length;r+=1){var a=n[r];e[a]!==void 0&&(t[a]=e[a])}return t},mr=i=>jn(i).timeZone,Nd=i=>{var e;return(e=jn(i).defaultNotebookSettings)!==null&&e!==void 0?e:Pd},fr=i=>i.activeTool,Ld=i=>{var e;return(e=i.plugins)!==null&&e!==void 0?e:wd},lo="SET_ACTIVE_TOOL",Dd="SET_API",Md="SET_COMMAND_HISTORY_STORAGE",Fd="SET_FILE_STORAGE",xd="SET_PLUGINS",Id="SET_USER",uo="SET_WORKSPACE",Rd="SET_DEFAULT_WORKSPACE_SETTINGS",kd="SET_WORKSPACE_STORAGE",jd="SET_SERVER_CONFIG_VALUES";function Yr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Ft(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yr(Object(t),!0).forEach(function(n){Ad(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Yr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ad(i,e,t){return e=_d(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _d(i){var e=$d(i,"string");return typeof e=="symbol"?e:String(e)}function $d(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ud=i=>({type:uo,payload:i}),Hd=i=>(e,t)=>{e(Ud(i));var{storage:n}=t(),{workspaceStorage:r}=n;return r.save(i)},Vd=i=>(e,t)=>{var{workspace:n}=t(),{data:r}=n,a=Ft(Ft({},n),{},{data:Ft(Ft(Ft({},r),i),{},{settings:Ft(Ft({},r.settings),i.settings)})});return e(Hd(a))},Gd=i=>e=>e(Vd({settings:i})),ho=i=>({type:lo,payload:i});function Xr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ki(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xr(Object(t),!0).forEach(function(n){Bd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Xr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Bd(i,e,t){return e=Wd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Wd(i){var e=Kd(i,"string");return typeof e=="symbol"?e:String(e)}function Kd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function co(i,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case i:{var r=n.payload;return r==null?null:t!=null?ki(ki({},t),r):ki({},r)}default:return t}}}function Lt(i,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case i:return n.payload;default:return t}}}const zd=Lt(Dd,null),qd=Lt(lo,null),Yd=Lt(xd,null),Xd=Lt(Md,null),Zd=Lt(Fd,null),Qd=Lt(kd,null),Jd=sr({commandHistoryStorage:Xd,fileStorage:Zd,workspaceStorage:Qd}),eu=co(Id,null),tu=co(uo,null),nu=Lt(Rd,null),iu=Lt(jd,null);var ru={activeTool:qd,api:zd,plugins:Yd,storage:Jd,user:eu,workspace:tu,defaultWorkspaceSettings:nu,serverConfigValues:iu};const au=ru;var Zr=z.module("redux-logger"),su=i=>e=>t=>{Zr.debug("dispatching",t);var n=e(t);return Zr.debug("next state",i.getState()),n};const ou=su;var lu=z.module("redux-crashReporter"),du=i=>e=>t=>{try{return e(t)}catch(n){throw lu.error("Error executing",t," with state ",i.getState(),":",n),n}};const uu=du,hu=[ou,uu,hl];var ji;Object.entries(au).map(i=>{var[e,t]=i;return lr.register(e,t)});var cu=(ji=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&ji!==void 0?ji:pl,vo=cl(sr(lr.reducers),cu(vl(...hu)));lr.setListener(i=>{vo.replaceReducer(sr(i))});const vu=vo;function pu(i){var{type:e}=i,t=$t();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(J,{icon:cr});case t.VariableType.FIGURE:return d.jsx(J,{icon:hr});case t.VariableType.PANDAS:return d.jsx(J,{icon:Ks});default:return d.jsx(J,{icon:Hl})}}function Qr(i,e,t,n,r,a,s){try{var o=i[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(n,r)}function mu(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var a=i.apply(e,t);function s(l){Qr(a,n,r,s,o,"next",l)}function o(l){Qr(a,n,r,s,o,"throw",l)}s(void 0)})}}function mi(i){var{children:e,language:t}=i,[n,r]=p.useState(null),{activeThemes:a}=gl();return p.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=mu(function*(){if(e!=null&&a!=null){var u=yield or.colorize(e.toString(),t,{});s||r(u)}}),l.apply(this,arguments)}return o(),()=>{s=!0}},[a,e,t]),d.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class fu{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const po=fu;class ai{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)?[]:ml.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),n="".concat(e.getMinutes()).padStart(2,"0"),r="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(r,".").concat(a)}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 ai.isTableType(e,t)||ai.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const Qi=ai;function mo(i){var{children:e}=i;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})]})}mo.propTypes={children:$.node.isRequired};function Ji(i,e,t){return e=gu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function gu(i){var e=bu(i,"string");return typeof e=="symbol"?e:String(e)}function bu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fo extends p.Component{constructor(e){super(e),Ji(this,"timer",void 0),Ji(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:n}=this.state;return d.jsx("div",{className:X("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(zs,{className:"ml-2"}),"Running... ",Rs.formatElapsedTime(n)," ",d.jsx(k,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Vl,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Ji(fo,"defaultProps",{disabled:!1});const Cu=fo;function Tn(i,e,t){return e=Su(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Su(i){var e=Eu(i,"string");return typeof e=="symbol"?e:String(e)}function Eu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Yt extends p.PureComponent{constructor(e){super(e),Tn(this,"mouseX",void 0),Tn(this,"mouseY",void 0),Tn(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)>=Yt.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Yt.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;I(n);var r=n.indexOf(`
1
+ import{ae as sr,af as hl,ag as cl,ah as vl,ai as pl,C as d,F as J,r as p,aj as or,ak as ml,V as $,E as X,al as Gn,G as Z,am as Sn,an as Ds,a7 as te,ao as En,a6 as Ms,K as Je,U as Et,R as Fs,ap as zi,aq as Ke,D as qi,L as $e,ar as xs,as as fl,at as Is,X as Bn}from"./vendor-d09ca476.js";import{bP as lr,$ as $t,k as gl,e as Rs,B as k,N as xe,w as se,K as re,bQ as bl,b7 as Be,G as Mn,i as Q,bR as qe,bS as ks,H as qt,C as Cl,f as Kt,S as js,bT as Tt,T as wt,bU as As,bV as _s,I as Yi,X as Sl,aH as ci,u as El,aF as yl,P as Pl,aI as M,aL as oe,q as wl,aS as $s,a$ as ot,b6 as Ot,n as Ar,Q as Us,aG as _r,ay as Hs,bz as je,az as Vs,b0 as Gs,aM as Tl,o as dr,ab as Ae,a7 as $r,a2 as Bs,a6 as Ur,bW as yn,R as Hr,l as Fn,z as Ws,s as Ol,E as Nl,F as Vr,bb as Ll,bK as Ri,bq as mt,ba as vi,aQ as Dl,bu as Ml,a_ as Fl,aA as Pn,aW as nn,aK as me,bX as xl,aR as Il,aJ as dn,br as ur,bY as Rl,bZ as kl,b_ as jl,b$ as mn,a3 as Al,aY as _l,b1 as $l,aX as Ul}from"./IrisGridModelFactory-bf9684d0.js";import{L as z,R as Hl,U as Ks,V as hr,X as cr,n as zs,e as Vl,h as I,Y as Wt,Z as Gl,_ as Gr,$ as Bl,a0 as Wl,a1 as Kl,a2 as zl,v as kn,a3 as vr,a4 as qs,c as wn,a as pr,a5 as Xi,a6 as ql,a7 as Yl,a8 as Br,a9 as ri,aa as Wr,ab as Ys,ac as Xl,ad as pi,ae as Zl,T as Zi,af as Ql,ag as Jl,ah as ed,ai as td,aj as nd,M as Xs,o as Zs,b as Qs,ak as id,al as Js,am as rd,an as eo,ao as to,ap as Kr,aq as ad,ar as sd,as as od,at as ld,au as dd,av as ud,aw as hd}from"./index-2f3644e1.js";import{P as ge,t as cd,r as zr,g as vd,C as pd,u as md,e as Nt,s as no,o as fd,n as gd,q as bd}from"./usePlugins-816cdf0b.js";import"./helpers-042e6b4d.js";import"./plotly-6980623c.js";function qr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Cd(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(t),!0).forEach(function(n){Sd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):qr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Sd(i,e,t){return e=Ed(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ed(i){var e=yd(i,"string");return typeof e=="symbol"?e:String(e)}function yd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Pd=Object.freeze({}),wd=new Map,io=i=>i.api,Td=i=>i.user,ro=i=>i.storage,ao=i=>ro(i).commandHistoryStorage,so=i=>ro(i).fileStorage,Od=i=>i.defaultWorkspaceSettings,oo=i=>{var{workspace:e}=i;return e},jn=i=>{for(var e=oo(i).data.settings,t=Cd({},Od(i)),n=Object.keys(e),r=0;r<n.length;r+=1){var a=n[r];e[a]!==void 0&&(t[a]=e[a])}return t},mr=i=>jn(i).timeZone,Nd=i=>{var e;return(e=jn(i).defaultNotebookSettings)!==null&&e!==void 0?e:Pd},fr=i=>i.activeTool,Ld=i=>{var e;return(e=i.plugins)!==null&&e!==void 0?e:wd},lo="SET_ACTIVE_TOOL",Dd="SET_API",Md="SET_COMMAND_HISTORY_STORAGE",Fd="SET_FILE_STORAGE",xd="SET_PLUGINS",Id="SET_USER",uo="SET_WORKSPACE",Rd="SET_DEFAULT_WORKSPACE_SETTINGS",kd="SET_WORKSPACE_STORAGE",jd="SET_SERVER_CONFIG_VALUES";function Yr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Ft(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yr(Object(t),!0).forEach(function(n){Ad(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Yr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ad(i,e,t){return e=_d(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _d(i){var e=$d(i,"string");return typeof e=="symbol"?e:String(e)}function $d(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ud=i=>({type:uo,payload:i}),Hd=i=>(e,t)=>{e(Ud(i));var{storage:n}=t(),{workspaceStorage:r}=n;return r.save(i)},Vd=i=>(e,t)=>{var{workspace:n}=t(),{data:r}=n,a=Ft(Ft({},n),{},{data:Ft(Ft(Ft({},r),i),{},{settings:Ft(Ft({},r.settings),i.settings)})});return e(Hd(a))},Gd=i=>e=>e(Vd({settings:i})),ho=i=>({type:lo,payload:i});function Xr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ki(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xr(Object(t),!0).forEach(function(n){Bd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Xr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Bd(i,e,t){return e=Wd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Wd(i){var e=Kd(i,"string");return typeof e=="symbol"?e:String(e)}function Kd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function co(i,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case i:{var r=n.payload;return r==null?null:t!=null?ki(ki({},t),r):ki({},r)}default:return t}}}function Lt(i,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case i:return n.payload;default:return t}}}const zd=Lt(Dd,null),qd=Lt(lo,null),Yd=Lt(xd,null),Xd=Lt(Md,null),Zd=Lt(Fd,null),Qd=Lt(kd,null),Jd=sr({commandHistoryStorage:Xd,fileStorage:Zd,workspaceStorage:Qd}),eu=co(Id,null),tu=co(uo,null),nu=Lt(Rd,null),iu=Lt(jd,null);var ru={activeTool:qd,api:zd,plugins:Yd,storage:Jd,user:eu,workspace:tu,defaultWorkspaceSettings:nu,serverConfigValues:iu};const au=ru;var Zr=z.module("redux-logger"),su=i=>e=>t=>{Zr.debug("dispatching",t);var n=e(t);return Zr.debug("next state",i.getState()),n};const ou=su;var lu=z.module("redux-crashReporter"),du=i=>e=>t=>{try{return e(t)}catch(n){throw lu.error("Error executing",t," with state ",i.getState(),":",n),n}};const uu=du,hu=[ou,uu,hl];var ji;Object.entries(au).map(i=>{var[e,t]=i;return lr.register(e,t)});var cu=(ji=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&ji!==void 0?ji:pl,vo=cl(sr(lr.reducers),cu(vl(...hu)));lr.setListener(i=>{vo.replaceReducer(sr(i))});const vu=vo;function pu(i){var{type:e}=i,t=$t();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(J,{icon:cr});case t.VariableType.FIGURE:return d.jsx(J,{icon:hr});case t.VariableType.PANDAS:return d.jsx(J,{icon:Ks});default:return d.jsx(J,{icon:Hl})}}function Qr(i,e,t,n,r,a,s){try{var o=i[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(n,r)}function mu(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var a=i.apply(e,t);function s(l){Qr(a,n,r,s,o,"next",l)}function o(l){Qr(a,n,r,s,o,"throw",l)}s(void 0)})}}function mi(i){var{children:e,language:t}=i,[n,r]=p.useState(null),{activeThemes:a}=gl();return p.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=mu(function*(){if(e!=null&&a!=null){var u=yield or.colorize(e.toString(),t,{});s||r(u)}}),l.apply(this,arguments)}return o(),()=>{s=!0}},[a,e,t]),d.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class fu{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const po=fu;class ai{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)?[]:ml.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),n="".concat(e.getMinutes()).padStart(2,"0"),r="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(r,".").concat(a)}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 ai.isTableType(e,t)||ai.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const Qi=ai;function mo(i){var{children:e}=i;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})]})}mo.propTypes={children:$.node.isRequired};function Ji(i,e,t){return e=gu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function gu(i){var e=bu(i,"string");return typeof e=="symbol"?e:String(e)}function bu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fo extends p.Component{constructor(e){super(e),Ji(this,"timer",void 0),Ji(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:n}=this.state;return d.jsx("div",{className:X("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(zs,{className:"ml-2"}),"Running... ",Rs.formatElapsedTime(n)," ",d.jsx(k,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Vl,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Ji(fo,"defaultProps",{disabled:!1});const Cu=fo;function Tn(i,e,t){return e=Su(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Su(i){var e=Eu(i,"string");return typeof e=="symbol"?e:String(e)}function Eu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Yt extends p.PureComponent{constructor(e){super(e),Tn(this,"mouseX",void 0),Tn(this,"mouseY",void 0),Tn(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)>=Yt.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Yt.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;I(n);var r=n.indexOf(`
2
2
  `),a=r>-1,s=n;a&&(s=n.slice(0,r));var o=n.slice(r),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return d.jsxs("div",{className:X("error-message",{expanded:e}),children:[a&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"error-gutter",children:d.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:d.jsx(J,{icon:e?Wt:Gl,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?o:""]})]}),!a&&d.jsx("div",{className:"error-content",children:d.jsx("div",{className:"console-error-text",children:s})})]},"error")}}Tn(Yt,"defaultProps",{message:""});Tn(Yt,"mouseDragThreshold",5);const yu=Yt;function Pu(i,e,t){return e=wu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function wu(i){var e=Tu(i,"string");return typeof e=="symbol"?e:String(e)}function Tu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Jr=z.module("ConsoleHistoryItem");class go extends p.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Jr.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Jr.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,iconForType:r}=this.props,{disabledObjects:a,result:s}=t,o=t.command!=null&&t.command!=="",l=null;o&&(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(mi,{language:n,children:t.command})})]}));var u=[],h=!1;if(s){var{error:c,message:v,changes:m}=s;if(m){var{created:b,updated:g}=m;[...b,...g].forEach(x=>{h=!0;var{title:L}=x,F="".concat(L),N=e===void 0||e||(a??[]).indexOf(F)>=0,_=d.jsx(k,{kind:"primary",onClick:()=>this.handleObjectClick(x),className:"btn-console-object",disabled:N,icon:r(x.type),children:L},F);u.push(_)})}if(c!=null&&!o){var f,C="".concat((f=c.message)!==null&&f!==void 0?f:c);C||(C=c);var E=d.jsx(yu,{message:C},"result-error");u.push(E)}if(v!==void 0&&v!==""){var S=d.jsx("div",{className:"log-message",children:v},"log-message");u.push(S)}}else{h=!0;var y=d.jsx(Cu,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");u.push(y)}var O=null;return u.length>0&&(O=d.jsx(mo,{children:u})),d.jsxs("div",{className:X("console-command-result",{"console-result-buttons":h}),children:[l,O]})}}Pu(go,"defaultProps",{disabled:!1});const Ou=go;function Nu(i,e){return"".concat(i,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function Lu(i){for(var{disabled:e=!1,items:t,language:n,openObject:r,supportsType:a,iconForType:s}=i,o=[],l=0;l<t.length;l+=1){var u=t[l],h=d.jsx(Ou,{disabled:e,item:u,openObject:r,language:n,supportsType:a,iconForType:s},Nu(l,u));o.push(h)}return d.jsx("div",{className:"container-fluid console-history",children:o})}var Du={name:"Console",CLEAR:xe.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[se.CTRL,re.L],macShortcut:[se.CTRL,re.C]}),FOCUS_HISTORY:xe.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[se.CTRL,re.H],macShortcut:[se.CTRL,se.OPTION,re.H]})},Mu={name:"Command History",FOCUS_HISTORY:xe.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[se.CTRL,re.H],macShortcut:[se.CTRL,se.OPTION,re.H]}),SEND_TO_CONSOLE:xe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[re.ENTER],macShortcut:[re.ENTER]}),SEND_TO_NOTEBOOK:xe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[se.CTRL,re.ENTER],macShortcut:[se.CMD,re.ENTER]}),RUN:xe.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[se.ALT,re.R],macShortcut:[se.OPTION,re.R]})},Fu={name:"Notebook",RUN:xe.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[se.ALT,re.R],macShortcut:[se.OPTION,re.R]}),RUN_SELECTED:xe.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[se.ALT,se.SHIFT,re.R],macShortcut:[se.OPTION,se.SHIFT,re.R]}),FIND:xe.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[se.CTRL,re.F],macShortcut:[se.CMD,re.F],isEditable:!1}),MINIMAP:xe.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[se.ALT,re.M],macShortcut:[se.OPTION,re.M]}),WORDWRAP:xe.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[se.ALT,re.Z],macShortcut:[se.OPTION,re.Z]})},xu={CONSOLE:Du,COMMAND_HISTORY:Mu,NOTEBOOK:Fu};const Fe=xu,Pe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"});function Ai(i,e,t){return e=Iu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Iu(i){var e=Ru(i,"string");return typeof e=="symbol"?e:String(e)}function Ru(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var dt=z.module("MonacoCompletionProvider");class kt extends p.PureComponent{static lspToMonacoKind(e){var t=Gn.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),Ai(this,"registeredCompletionProvider",void 0),Ai(this,"registeredSignatureProvider",void 0),Ai(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=Gn.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=Gn.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=Gn.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,n;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(n=this.registeredHoverProvider)===null||n===void 0||n.dispose()}handleCompletionRequest(e,t,n){var{model:r,session:a}=this.props;if(e!==r)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:kt.monacoToLspPosition(t),context:n},o=a.getCompletionItems(s);dt.debug("Requested completion items",s);var l=o.then(u=>{dt.debug("Completion items received: ",s,u);var h=u.map(c=>{var{label:v,kind:m,detail:b,documentation:g,sortText:f,filterText:C,textEdit:E,insertTextFormat:S}=c;return{label:v,kind:kt.lspToMonacoKind(m),detail:b,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:f,filterText:C,insertText:E.text,insertTextRules:S===2?4:S,range:kt.lspToMonacoRange(E.range)}});return{incomplete:!0,suggestions:h}}).catch(u=>(dt.error("There was an error retrieving completion items",u),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,r){var a={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:s,session:o}=this.props;if(e!==s||!o.getSignatureHelp)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:kt.monacoToLspPosition(t),context:r},u=o.getSignatureHelp(l);dt.debug("Requested signature help",l);var h=u.then(c=>{dt.debug("Signatures received: ",l,u);var v=c.map(b=>{var{label:g,documentation:f,parameters:C}=b;return{documentation:(f==null?void 0:f.kind)==="markdown"?f:f==null?void 0:f.value,label:g,parameters:C??[]}});if(v.length===0)return a;var m=0;return{value:{signatures:v,activeSignature:m,activeParameter:c[m].activeParameter},dispose:()=>{}}}).catch(c=>(dt.error("There was an error retrieving completion items",c),a));return h}handleHoverRequest(e,t){var{model:n,session:r}=this.props;if(e!==n||!r.getHover)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:kt.monacoToLspPosition(t)},s=r.getHover(a);dt.debug("Requested hover",a);var o=s.then(l=>{dt.debug("Hover received: ",a,l);var{contents:u}=l;return{contents:u?[u]:[]}}).catch(l=>(dt.error("There was an error retrieving hover",l),{contents:[]}));return o}render(){return null}}const bo=kt;function ea(i,e,t,n,r,a,s){try{var o=i[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(n,r)}function ku(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var a=i.apply(e,t);function s(l){ea(a,n,r,s,o,"next",l)}function o(l){ea(a,n,r,s,o,"throw",l)}s(void 0)})}}function Ve(i,e,t){return e=ju(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ju(i){var e=Au(i,"string");return typeof e=="symbol"?e:String(e)}function Au(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var _i=z.module("ConsoleInput"),si=parseInt(bl["line-height"],10),Co=6,So=6,_u=si+Co+So,$i=100;class An extends p.PureComponent{constructor(e){super(e),Ve(this,"cancelListener",void 0),Ve(this,"commandContainer",void 0),Ve(this,"commandEditor",void 0),Ve(this,"commandHistoryIndex",void 0),Ve(this,"commandSuggestionContainer",void 0),Ve(this,"loadingPromise",void 0),Ve(this,"timestamp",void 0),Ve(this,"bufferIndex",void 0),Ve(this,"history",void 0),Ve(this,"modifiedCommands",void 0),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=Z.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:si,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(_i.debug("Command received: ",e),!n){var r;this.commandHistoryIndex=null,(r=this.commandEditor)===null||r===void 0||r.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:si,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Co,bottom:So},value:"",wordWrap:"on"},r=this.commandContainer.current;I(r),this.commandEditor=or.create(r,n),Be.setEOL(this.commandEditor),Be.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:o}=this,l=s==null?void 0:s.getPosition();I(l);var{lineNumber:u}=l,h=s==null?void 0:s.getModel();if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&u===1){o!=null?this.loadCommand(o+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&u===(h==null?void 0:h.getLineCount())){o!=null&&o>0?this.loadCommand(o-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(!a.altKey&&!a.shiftKey&&!a.metaKey&&a.keyCode===Sn.Enter&&!this.isSuggestionMenuPopulated()){var c;a.stopPropagation(),a.preventDefault();var v=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(v!==void 0){var m;this.processCommand(v),(m=this.commandEditor)===null||m===void 0||m.setValue("")}}}),Be.disableKeyBindings(this.commandEditor,[Ds.CtrlCmd|Sn.KeyF]),Be.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(Be.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,n;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(n=t.getDomNode())===null||n===void 0?void 0:n.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(n=t.querySelector(".monaco-list-rows"))===null||n===void 0?void 0:n.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,n,r,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();I(s);var o=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,o);I(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:o}),(r=this.commandEditor)===null||r===void 0||r.setScrollTop(l),(a=this.commandEditor)===null||a===void 0||a.focus()}focusEnd(){var e,t,n,r,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();I(s);var o=s.getLineCount(),l=s.getLineLength(o)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(o,l);I(u),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:o,column:l}),(r=this.commandEditor)===null||r===void 0||r.setScrollTop(u),(a=this.commandEditor)===null||a===void 0||a.focus()}clear(){var e,t,n;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,n;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),a=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(r??a),e!==null&&e>this.history.length-$i&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return ku(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:r}=e.props;e.loadingPromise=ge.makeCancelable(t.getTable(n,r??"",e.timestamp),o=>o.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+$i-1}),e.loadingPromise=ge.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=$i,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...s.items.filter((o,l,u)=>{var{name:h}=o;return l===0||h!==u[l-1].name}).map(o=>{var{name:l}=o;return l}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(o){if(e.loadingPromise=void 0,ge.isCanceled(o)){_i.debug2("Promise canceled, not loading history");return}_i.error("Error fetching history",o)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),I(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;I(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),_u),r=t>n,a={overviewRulerLanes:r?void 0:0};this.setState({commandEditorHeight:n},()=>{var s,o;(s=this.commandEditor)===null||s===void 0||s.updateOptions(a),(o=this.commandEditor)===null||o===void 0||o.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:r,isFocused:a,model:s}=this.state;return d.jsx("div",{className:X("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:X("console-input-inner-wrapper",{focus:a}),children:[d.jsx("div",{className:An.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:r}}),s&&d.jsx(bo,{model:s,language:t,session:n})]})})}}Ve(An,"defaultProps",{maxHeight:si*10,scope:null,disabled:!1});Ve(An,"INPUT_CLASS_NAME","console-input");const ta=An;function yt(i,e,t){return e=$u(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $u(i){var e=Uu(i,"string");return typeof e=="symbol"?e:String(e)}function Uu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var na="pasted values",Hu=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Ui=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ia=[".zip"];class st extends p.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Hu.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ui.some(n=>e.endsWith(n))||t&&ia.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===na?Gr:e.endsWith(".csv")?Bl:e.endsWith(".zip")?Wl:Kl}constructor(e){super(e),yt(this,"fileElem",void 0),yt(this,"divElem",void 0),yt(this,"getValidExtensions",te(t=>t?[...Ui,...ia]:[...Ui])),yt(this,"getAcceptString",te(t=>this.getValidExtensions(t).join(", "))),yt(this,"getFileTypeErrorString",te(t=>qe.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=Z.createRef(),this.divElem=Z.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:n,dragError:r}=this.props;if(e.preventDefault(),e.stopPropagation(),r!=null){n();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();I(a),st.isValidExtension(a.name,t)?this.handleFile(a):this.setState({dropError:st.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:n}=this.props;n||navigator.clipboard.readText().then(r=>{e(r),this.setState({selectedFileName:na,dropError:void 0})}).catch(r=>t(r))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Gr,action:this.handleMenuPaste,shortcut:Mn.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:r,dropError:a}=this.state,s=t??a,o=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:st.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(Q,{actions:o}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!r&&(s===void 0||s==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(J,{icon:zl})}),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(k,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),r&&(s===void 0||s==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(J,{icon:st.getIcon(r)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[r,!n&&d.jsx(k,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:kn,tooltip:"Remove"})]})]})]}),!!s&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(J,{icon:vr})}),d.jsx("label",{children:s}),s===st.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}yt(st,"defaultProps",{allowZip:!1,dragError:null});yt(st,"MULTIPLE_FILE_ERROR","Please select only one file");yt(st,"FILE_TYPE_ERROR","Filetype not supported.");const Bt=st;function Ut(i,e,t){return e=Vu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Vu(i){var e=Gu(i,"string");return typeof e=="symbol"?e:String(e)}function Gu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Dt{}Ut(Dt,"INTEGER","int");Ut(Dt,"LONG","long");Ut(Dt,"DOUBLE","double");Ut(Dt,"BOOLEAN","bool");Ut(Dt,"STRING","string");Ut(Dt,"DATE_TIME","datetime");Ut(Dt,"LOCAL_TIME","localtime");const ne=Dt;function Eo(i,e){var t=i.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(n,r)=>e(r)),t}function ra(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function aa(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ra(Object(t),!0).forEach(function(n){Le(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ra(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Le(i,e,t){return e=Bu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Bu(i){var e=Wu(i,"string");return typeof e=="symbol"?e:String(e)}function Wu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var sa="unknown",Ku=2147483647,zu=-2147483648,oa=/^[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]+)?$/,la=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Te{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case ne.STRING:return ne.STRING;case ne.INTEGER:return Te.checkInteger(e);case ne.LONG:return Te.checkLong(e);case ne.DOUBLE:return Te.checkDouble(e);case ne.BOOLEAN:return Te.checkBoolean(e);case ne.DATE_TIME:return Te.checkDateTime(e);case ne.LOCAL_TIME:return Te.checkLocalTime(e);default:return Te.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Te.isNotParsableNumber(t)?ne.STRING:Te.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Te.isNotParsableNumber(t)?ne.STRING:t.includes(".")?ne.DOUBLE:ne.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Te.isNotParsableNumber(t)?ne.STRING:ne.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ne.BOOLEAN:ne.STRING}static checkDateTime(e){return oa.test(e)?ne.DATE_TIME:ne.STRING}static checkLocalTime(e){return la.test(e)?ne.LOCAL_TIME:ne.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Te.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?ne.BOOLEAN:oa.test(e)&&e.includes(":")?ne.DATE_TIME:la.test(e)?ne.LOCAL_TIME:ne.STRING}return Te.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ne.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ne.LONG;var n=parseInt(e,10);return n>Ku||n<zu?ne.LONG:ne.INTEGER}constructor(e,t,n,r,a,s,o,l,u,h){Le(this,"onFileCompleted",void 0),Le(this,"file",void 0),Le(this,"readHeaders",void 0),Le(this,"nullString",void 0),Le(this,"onProgress",void 0),Le(this,"onError",void 0),Le(this,"types",void 0),Le(this,"chunks",void 0),Le(this,"totalChunks",void 0),Le(this,"rowCount",void 0),Le(this,"isZip",void 0),Le(this,"shouldTrim",void 0),Le(this,"zipProgress",void 0),Le(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=a,this.onProgress=s,this.onError=o,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=aa(aa({},r),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)En.parse(this.file,this.config);else{var e=Eo(this.file,this.handleNodeUpdate);En.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(sa),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,I(this.types);var r=[...this.types];n.forEach(o=>{if(o.length>=r.length){for(var l=0;l<r.length;l+=1)r[l]=Te.determineType(this.shouldTrim?o[l].trim():o[l],r[l],this.nullString);this.types=r}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
3
3
  Expected length `.concat(r.length," but found ").concat(o.length,`.
4
4
  Row = `).concat(o))}),this.chunks+=1;var a=0;this.totalChunks>0?a=Math.round(this.chunks/this.totalChunks*50):a=Math.round(this.zipProgress/2);var s=this.onProgress(a);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:n}=this;I(t),(e==null||!e.meta.aborted)&&n(t.map(r=>r===sa||r===ne.LOCAL_TIME?ne.STRING:r),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const qu=Te;function le(i,e,t){return e=Yu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Yu(i){var e=Xu(i,"string");return typeof e=="symbol"?e:String(e)}function Xu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Wn=z.module("CsvParser"),Zu=650;class Xt{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(Xt.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor(e){var{onFileCompleted:t,session:n,file:r,type:a,readHeaders:s=!0,onProgress:o,onError:l,timeZone:u,isZip:h}=e;le(this,"onFileCompleted",void 0),le(this,"session",void 0),le(this,"file",void 0),le(this,"isZip",void 0),le(this,"type",void 0),le(this,"readHeaders",void 0),le(this,"timeZone",void 0),le(this,"onProgress",void 0),le(this,"onError",void 0),le(this,"tables",void 0),le(this,"headers",void 0),le(this,"types",void 0),le(this,"rowCount",void 0),le(this,"rowsProcessed",void 0),le(this,"chunks",void 0),le(this,"totalChunks",void 0),le(this,"isComplete",void 0),le(this,"zipProgress",void 0),le(this,"consolidatedChunks",void 0),le(this,"numConsolidated",void 0),le(this,"isCancelled",void 0),le(this,"config",void 0),this.onFileCompleted=t,this.session=n,this.file=r,this.isZip=h,this.type=a,this.readHeaders=s,this.timeZone=u,this.onProgress=o,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(r.size/En.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:a.delimiter,newline:a.newline,escapeChar:a.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:a.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var n=t.length,r=new Array(e).fill(null).map(()=>new Array(n)),a=0;a<n;a+=1){var s=t[a];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
@@ -24,4 +24,4 @@ Check your internet connection.`;if(t&&n)return"Disconnected from server.";if(n)
24
24
  `).concat(zt.makeCirclePath(s,o,Cs)),F="link-select-clip-".concat(l),N=Math.atan2(o-O,s-y),_=N-bs+Math.PI,Y=N+bs+Math.PI,j=s+Math.cos(N)*gs,G=o+Math.sin(N)*gs,A=j+Math.cos(_)*ti,R=G+Math.sin(_)*ti,K=j+Math.cos(Y)*ti,H=G+Math.sin(Y)*ti,ce="".concat(j,",").concat(G," ").concat(A,",").concat(R," ").concat(K,",").concat(H),Ce=.25*r+.5*y+.25*s,Ie=.25*a+.5*O+.25*o,P=y-r+(s-y),w=O-a+(o-O),D=w/P,B=20,W=B/Math.sqrt(1+D**2),ve=W*D,T=W*-1,V=ve*-1;Number.isFinite(D)?D>0?(W*=-1,ve*=-1,T*=-1,V*=-1,T-=50-10*(Math.abs(m)%Ct),V+=10*(Math.abs(m)%Ct),W-=50-10*(Math.abs(m)%Ct),ve+=10*(Math.abs(m)%Ct)):D<0?(T+=10*(Math.abs(m)%Ct),V+=10*(Math.abs(m)%Ct),W+=10*(Math.abs(m)%Ct),ve+=10*(Math.abs(m)%Ct)):(T=15,V=10,W=-25,ve=10):(T=10,V=5,W=10,ve=-35);var q="";t!==void 0&&(t==="startsWith"?q="a*":t==="endsWith"?q="*z":q=Ae.getFilterOperatorString(t));var ae=h!=="chartLink"&&h!=="filterSource";return d.jsxs(d.Fragment,{children:[d.jsxs("svg",{className:X(e,{hovering:c}),children:[d.jsx("clipPath",{id:F,children:d.jsx("path",{d:L,clipRule:"evenodd"})}),d.jsx("path",{className:"link-select",d:x,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:"url(#".concat(F,")"),"data-testid":"link-select"}),d.jsx("path",{className:"link-background",d:x}),d.jsx("path",{className:"link-foreground",d:x}),d.jsx("circle",{className:"link-dot",cx:r,cy:a,r:"5"}),d.jsx("polygon",{className:"link-triangle",points:ce})]}),u!=null&&n&&d.jsxs(d.Fragment,{children:[ae&&d.jsx(k,{kind:"primary",className:"btn-fab btn-operator",style:{top:Ie+(D>=0?ve:V),left:Ce+(D>=0?W:T)},onClick:()=>{},icon:d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx("b",{children:q}),d.jsx(J,{icon:Wt,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:d.jsx(Kt,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),d.jsx(k,{kind:"primary",className:"btn-fab btn-delete",style:{top:Ie+(D<0?ve:V),left:Ce+(D<0?W:T)},onClick:this.handleDelete,icon:kn,tooltip:"Delete"})]})]})}}Zo(zt,"defaultProps",{className:"",isSelected:!1,onClick(){},onDelete(){}});const cm=zt;function Ss(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Es(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ss(Object(t),!0).forEach(function(n){Ir(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ss(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ir(i,e,t){return e=vm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vm(i){var e=pm(i,"string");return typeof e=="symbol"?e:String(e)}function pm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Bi=z.module("LinkerOverlayContent");class el extends p.Component{constructor(e){super(e),Ir(this,"dialogRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=Z.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){Bi.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){var{panelManager:t}=this.props,{panelId:n,columnName:r}=e,a=t.getOpenedPanelById(n);if(a!=null){if(!Xo(a))throw new Error("Panel does not have getCoordinateForColumn method: ".concat(n));try{var s=a.getCoordinateForColumn(r);if(s!=null)return s}catch{Bi.error("Could not get coordinate for column",r,a)}}var o=t.getContainerByPanelId(n);if(o==null)throw new Error("Unable to find panel container for id: ".concat(n));return M.getTabPoint(o)}handleOperatorChanged(e,t){var{links:n,onLinksUpdated:r}=this.props,a=n.map(s=>s.id===e?Es(Es({},s),{},{operator:t}):s);r(a)}handleBlur(){this.setState({mode:"select"})}handleResize(){var{dialog:e}=this.state;if(e&&this.dialogRef.current){var t=this.dialogRef.current.getBoundingClientRect(),n=Bn(e.x,0,window.innerWidth-t.width),r=Bn(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:r}})}}handleMouseMove(e){var{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){var r=this.dialogRef.current.getBoundingClientRect(),a=Bn(window.innerWidth-(e.clientX+r.width+t.x),0,window.innerWidth-r.width),s=Bn(window.innerHeight-(e.clientY+r.height+t.y),0,window.innerHeight-r.height);this.setState({dialog:{x:a,y:s}})}}handleMouseDown(e){e.preventDefault();var t={x:0,y:0};if(this.dialogRef.current){var n=this.dialogRef.current.getBoundingClientRect();t.x=n.right-(n.width+e.clientX),t.y=n.bottom-(n.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){var{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(r=>n(r))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){var{onCancel:e}=this.props;e()}render(){var{disabled:e,links:t,selectedIds:n,messageText:r,onLinkSelected:a,onLinkDeleted:s,onAllLinksDeleted:o,onDone:l}=this.props,{mouse:u,dialog:h,isDragging:c,mode:v}=this.state,m=t.map(b=>{try{var g,f,{id:C,type:E,isReversed:S,start:y,end:O,operator:x}=b,L=y.columnType,[F,N]=this.getPointFromLinkPoint(y),_=(g=u==null?void 0:u.x)!==null&&g!==void 0?g:F,Y=(f=u==null?void 0:u.y)!==null&&f!==void 0?f:N;if(O!=null&&([_,Y]=this.getPointFromLinkPoint(O)),S!=null&&S){var[j,G]=[F,N];[F,N]=[_,Y],[_,Y]=[j,G]}var A=X("linker-link",{disabled:e},{"link-filter-source":E==="filterSource"},{"link-invalid":E==="invalid"},{interactive:b.end==null},{"link-is-selected":n.has(C)},{"danger-delete":v==="delete"});return{x1:F,y1:N,x2:_,y2:Y,id:C,className:A,operator:x,startColumnType:L,type:E}}catch(R){return Bi.warn("Unable to get point for link",b,R),null}}).filter(b=>b!=null);return d.jsxs("div",{className:X("linker-overlay",{"danger-delete":v==="delete"}),children:[m.map(b=>{var{x1:g,y1:f,x2:C,y2:E,id:S,className:y,operator:O,startColumnType:x,type:L}=b;return d.jsx(cm,{className:y,id:S,x1:g,y1:f,x2:C,y2:E,onClick:a,onDelete:s,isSelected:n.has(S),operator:O,startColumnType:x,type:L,onOperatorChanged:this.handleOperatorChanged},S)}),d.jsxs("div",{className:X("linker-toast-dialog",{dragging:c}),ref:this.dialogRef,style:{bottom:h==null?void 0:h.y,right:h==null?void 0:h.x},"data-testid":"linker-toast-dialog",children:[d.jsx(k,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:hd,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!c&&d.jsx(wt,{children:"Drag to reposition"})}),d.jsx("div",{className:"toast-body",children:r}),d.jsxs("div",{className:"toast-footer",children:[d.jsx(k,{kind:"secondary",onClick:o,children:"Clear All"}),d.jsx(k,{kind:"primary",onClick:l,children:"Done"})]})]}),d.jsx(Q,{actions:[{action:this.handleEscapePressed,shortcut:Mn.LINKER_CLOSE,isGlobal:!0}]})]})}}Ir(el,"defaultProps",{disabled:"false"});const mm=el;function ys(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Ps(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ys(Object(t),!0).forEach(function(n){tl(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ys(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function tl(i,e,t){return e=fm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fm(i){var e=gm(i,"string");return typeof e=="symbol"?e:String(e)}function gm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ee=z.module("Linker"),bm=(i,e)=>({activeTool:fr(i),dh:io(i),isolatedLinkerPanelId:yr(i,e.localDashboardId),links:on(i,e.localDashboardId),timeZone:mr(i)}),Cm=Ke(bm,{setActiveTool:ho,setDashboardLinks:wr,addDashboardLinks:mc,deleteDashboardLinks:fc,setDashboardIsolatedLinkerPanelId:jo,setDashboardColumnSelectionValidator:gc});class Sm extends p.Component{constructor(e){super(e),tl(this,"getCachedLinks",te((t,n,r)=>{var a=[...t];return n!=null&&n.start!=null&&a.push(n),r!==void 0?a.filter(s=>{var o,l;return(s==null||(o=s.start)===null||o===void 0?void 0:o.panelId)===r||(s==null||(l=s.end)===null||l===void 0?void 0:l.panelId)===r||(s==null?void 0:s.end)==null}):a})),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){var{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){var{activeTool:t,layout:n}=this.props;n!==e.layout&&(this.stopListening(e.layout),this.startListening(n)),t!==e.activeTool&&(this.updateSelectionValidators(),t===at.DEFAULT&&this.reset())}componentDidCatch(e,t){Ee.error("componentDidCatch",e,t)}componentWillUnmount(){var{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.on(Ze.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(Ze.DATA_SELECTED,this.handleUpdateValues),t.on(Ze.STATE_CHANGED,this.handleStateChange),t.on(tr.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(oe.CLONED,this.handlePanelCloned),t.on(fe.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(fe.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(oe.CLOSE,this.handlePanelClosed),t.on(oe.CLOSED,this.handlePanelClosed),t.on(oe.DRAGGING,this.handlePanelDragging),t.on(oe.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.off(Ze.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(Ze.DATA_SELECTED,this.handleUpdateValues),t.off(Ze.STATE_CHANGED,this.handleStateChange),t.off(tr.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(oe.CLONED,this.handlePanelCloned),t.off(fe.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(fe.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(oe.CLOSE,this.handlePanelClosed),t.off(oe.CLOSED,this.handlePanelClosed),t.off(oe.DRAGGING,this.handlePanelDragging),t.off(oe.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){var{linkInProgress:e}=this.state;if(e==null){var{setActiveTool:t}=this.props;t(at.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){var{setActiveTool:e}=this.props;e(at.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){Ee.debug("handleFilterColumnSelect",this.isOverlayShown());var{links:n,localDashboardId:r,setActiveTool:a,setDashboardIsolatedLinkerPanelId:s}=this.props,o=M.getIdFromPanel(e),l=n.filter(u=>{var h,c;return((h=u.start)===null||h===void 0?void 0:h.panelId)===o||((c=u.end)===null||c===void 0?void 0:c.panelId)===o});if(!this.isOverlayShown()&&o!=null){a(at.LINKER),s(r,o),l.length===0&&this.columnSelected(e,t,!0,o);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){Ee.debug("handleColumnsChanged",e,t);var{links:n}=this.props,r=M.getIdFromPanel(e);if(r==null){Ee.error("Invalid panelId",e);return}var a=n.filter(s=>{var{start:o,end:l}=s;return o.panelId===r&&Gt.findColumn(t,o)==null||l!=null&&l.panelId===r&&Gt.findColumn(t,l)==null});this.deleteLinks(a)}handleGridColumnSelect(e,t){if(!ps(t)){Ee.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3?arguments[3]:void 0;if(!(r===void 0&&!this.isOverlayShown())){var{isolatedLinkerPanelId:a}=this.props,{linkInProgress:s}=this.state,o=M.getIdFromPanel(e);if(o!=null){var l=M.getComponentNameFromPanel(e),{name:u,type:h}=t;if(s==null||s.start==null){var c={id:$e.generate(),start:{panelId:o,panelComponent:l,columnName:u,columnType:h},type:"invalid",isReversed:n};Ee.debug("starting link",c),this.setState({linkInProgress:c})}else{var{links:v}=this.props,{start:m,id:b,isReversed:g}=s,f={panelId:o,panelComponent:l,columnName:u,columnType:h},C=Gt.getLinkType(g!==void 0&&g?f:m,g!==void 0&&g?m:f,r??a);switch(C){case"invalid":Ee.debug("Ignore invalid link connection",s,f);return;case"filterSource":{var E=g!==void 0&&g?m.panelId:f.panelId,S=v.filter(F=>{var{end:N}=F;return(N==null?void 0:N.panelId)===E});this.deleteLinks(S);break}case"chartLink":{var y=g===!0?m:f,O=g===!0?f:m;Ee.debug("creating chartlink",{existingLinkEnd:y,start:m,end:f});var x=v.filter(F=>{var{end:N,start:_}=F;return(_==null?void 0:_.panelId)===O.panelId&&(N==null?void 0:N.panelId)===y.panelId&&(N==null?void 0:N.columnName)===y.columnName&&(N==null?void 0:N.columnType)===y.columnType});this.deleteLinks(x);break}}var L={start:g!==void 0&&g?f:m,end:g!==void 0&&g?m:f,id:b,type:C,operator:mn.eq};Ee.info("creating link",L),this.setState({linkInProgress:void 0,selectedIds:new Set([b])},()=>{this.addLinks([L])})}}}}unsetFilterValueForLink(e){var{panelManager:t}=this.props;if(e.end){var{end:n}=e,{panelId:r,columnName:a,columnType:s}=n,o=t.getOpenedPanelById(r);o?vs(o)?o.unsetFilterValue(a,s):Ee.debug("endPanel.unsetFilterValue not implemented",o):Ee.debug("endPanel no longer exists, ignoring unsetFilterValue",r)}}setPanelFilterMap(e,t){Ee.debug("Set filter data for panel:",e,t);var{panelManager:n}=this.props,r=n.getOpenedPanelById(e);r?vs(r)?r.setFilterMap(t):Ee.debug("panel.setFilterMap not implemented",e,r):Ee.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){var{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{localDashboardId:n}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){var{setDashboardLinks:r}=this.props;r(n,[])}else if(e.length>0){var{deleteDashboardLinks:a}=this.props;a(n,e.map(s=>{var{id:o}=s;return o}))}}handleAllLinksDeleted(){var{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{var n=e.filter(r=>{var a,s;return(r==null||(a=r.start)===null||a===void 0?void 0:a.panelId)===t||(r==null||(s=r.end)===null||s===void 0?void 0:s.panelId)===t});this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){var{links:t}=this.props,n=t.find(r=>r.id===e);n?this.deleteLinks([n]):Ee.error("Unable to find link to delete",e)}handleUpdateValues(e,t){for(var n=M.getIdFromPanel(e),{dh:r,links:a,timeZone:s}=this.props,o=new Map,l=0;l<a.length;l+=1){var{start:u,end:h,operator:c}=a[l];if(u.panelId===n&&h!=null){var{panelId:v,columnName:m,columnType:b}=h,g=o.has(v)?o.get(v):new Map,f=g.has(m)===!0?g.get(m).filterList:[],{visibleIndex:C,isExpandable:E,isGrouped:S}=t[u.columnName],{value:y}=t[u.columnName],O="".concat(y);if(y===null&&E&&S&&(y=void 0),b!=null&&Ae.isDateType(b)){var x=new Bs(r,{timeZone:s,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Al.FULL_DATE_FORMAT});O=x.format(y)}var L={operator:c,text:O,value:y,startColumnIndex:C};f.push(L),g.set(m,{columnType:b,filterList:f}),o.set(v,g)}}o.forEach((F,N)=>{this.setPanelFilterMap(N,F)})}handlePanelCloned(e,t){var{links:n}=this.props,r=M.getIdFromPanel(e),a=t.id;if(r!=null){var s=Gt.cloneLinksForPanel(n,r,a);this.addLinks(s)}}handlePanelDragging(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var r=t[n],{start:a,end:s}=r;if(a.panelId===e||(s==null?void 0:s.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){Ee.debug("Panel ".concat(e," closed, deleting links.")),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){var{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){var{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var r=t[n],{start:a,end:s,id:o}=r;(a.panelId===e||(s==null?void 0:s.panelId)===e)&&this.handleLinkDeleted(o)}}isOverlayShown(){var{activeTool:e}=this.props;return e===at.LINKER}updateSelectionValidators(){var{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case at.LINKER:t(n,this.isColumnSelectionValid);break;default:t(n,void 0);break}}updateLinkInProgressType(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"invalid";this.setState(t=>{var{linkInProgress:n}=t;return n!==void 0?{linkInProgress:Ps(Ps({},n),{},{type:e})}:null})}isColumnSelectionValid(e,t){var{linkInProgress:n}=this.state,{isolatedLinkerPanelId:r}=this.props;if(t==null)return(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType(),!1;if(!ps(t))return Ee.debug2("Column is not filterable",t.description),(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType("invalid"),!1;if((n==null?void 0:n.start)==null)return!0;var{isReversed:a,start:s}=n,o=M.getIdFromPanel(e);if(o==null)return!1;var l={panelId:o,panelComponent:M.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},u=a!==void 0&&a?Gt.getLinkType(l,s,r):Gt.getLinkType(s,l,r);return this.updateLinkInProgressType(u),u!=="invalid"}render(){var{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:r,selectedIds:a,isDraggingPanel:s}=this.state,o=this.isOverlayShown(),l=r!=null&&r.start!=null,u=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return s?null:d.jsx(qi,{in:o,timeout:Zi.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:d.jsx(mm,{disabled:l,panelManager:n,links:this.getCachedLinks(e,r,t),selectedIds:a,messageText:u,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}var Em=Cm(Sm);const ym=Em;function Pm(i){nn(i);var{id:e,layout:t,panelManager:n}=i;return d.jsx(ym,{layout:t,localDashboardId:e,panelManager:n})}var wm={name:"LinkerPlugin",type:Nt.DASHBOARD_PLUGIN,component:Pm};const bf=wm;function nl(i,e,t){return e=Tm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Tm(i){var e=Om(i,"string");return typeof e=="symbol"?e:String(e)}function Om(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class tn{static getNewMarkdownTitle(e){for(var t="".concat(tn.DEFAULT_TITLE),n=0;e.indexOf(t)>=0;)n+=1,t="".concat(tn.DEFAULT_TITLE,"-").concat(n);return t}}nl(tn,"DEFAULT_TITLE","Note");nl(tn,"DEFAULT_CONTENT",`# Markdown Note
25
25
 
26
26
  This note can be edited using **markdown** for styling.`);const Wi=tn;function Nm(i){nn(i);var{id:e,layout:t,panelManager:n,registerComponent:r}=i,a=p.useCallback(o=>{var{title:l,componentState:u,props:h}=o,{panelState:c=null}=h;return u!=null&&({panelState:c=null}=u),l==null||c==null||c.content==null||c.content.length===0||c.content===Wi.DEFAULT_CONTENT?null:_l(o)},[]),s=p.useCallback(function(){var{title:o="",metadata:l={},id:u=$e.generate(),focusElement:h=M.DEFAULT_FOCUS_SELECTOR,createNewStack:c=!1,dragEvent:v=null}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=n.getOpenedPanelConfigsOfType(un.COMPONENT),b=n.getClosedPanelConfigsOfType(un.COMPONENT),g=m.map(y=>{var O;return(O=y.title)!==null&&O!==void 0?O:""}),f=o!=null&&o!==""?o:Wi.getNewMarkdownTitle(g),C=b.length>0?null:Wi.DEFAULT_CONTENT,E={type:"react-component",component:un.COMPONENT,props:{id:u,metadata:l,panelState:{content:C},localDashboardId:e},title:f,id:u},{root:S}=t;M.openComponent({root:S,config:E,focusElement:h,createNewStack:c,dragEvent:v})},[e,t,n]);return p.useEffect(function(){var l=[r(un.COMPONENT,un,$l,a)];return()=>{l.forEach(u=>u())}},[a,r]),me(t.eventHub,Yh.OPEN,s),null}var Lm={name:"MarkdownPlugin",type:Nt.DASHBOARD_PLUGIN,component:Nm};const Cf=Lm;function ws(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Ts(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ws(Object(t),!0).forEach(function(n){Dm(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ws(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Dm(i,e,t){return e=Mm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Mm(i){var e=Fm(i,"string");return typeof e=="symbol"?e:String(e)}function Fm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Rr=p.forwardRef((i,e)=>{var{localDashboardId:t,fetch:n}=i,r=qo(n,t);return d.jsx(Np,Ts(Ts({ref:e},i),r))});Rr.displayName="PandasPanelPlugin";const Sf=Rr;function Os(i,e,t,n,r,a,s){try{var o=i[a](s),l=o.value}catch(u){t(u);return}o.done?e(l):Promise.resolve(l).then(n,r)}function Ki(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var a=i.apply(e,t);function s(l){Os(a,n,r,s,o,"next",l)}function o(l){Os(a,n,r,s,o,"throw",l)}s(void 0)})}}function xm(i){var e=$t(),[t,n]=p.useState(),[r,a]=p.useState(!0),[s,o]=p.useState(!1),{fetch:l}=i,u=p.useCallback(Ki(function*(){var c=yield l();return ur.makeModel(e,c)}),[e,l]),h=p.useCallback(Ki(function*(){a(!0);var c=yield u();n(c),a(!1)}),[u]);return p.useEffect(()=>{var c=!1;function v(){return m.apply(this,arguments)}function m(){return m=Ki(function*(){var b=yield u();c||(n(b),o(!0),a(!1))}),m.apply(this,arguments)}return v(),a(!0),()=>{c=!0}},[u]),d.jsxs(d.Fragment,{children:[d.jsx(pr,{isLoaded:s,isLoading:r}),t&&d.jsx(vi,{model:t,children:d.jsx(zo,{onClick:h})})]})}var Im={name:"PandasPanel",title:"Pandas",type:Nt.WIDGET_PLUGIN,component:xm,panelComponent:Rr,supportedTypes:"pandas.DataFrame",icon:Ks};const Ef=Im;function Ns(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function pn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ns(Object(t),!0).forEach(function(n){Rm(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ns(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Rm(i,e,t){return e=km(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function km(i){var e=jm(i,"string");return typeof e=="symbol"?e:String(e)}function jm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Am=z.module("WidgetLoaderPlugin");function _m(i){var e;function t(n,r){var a=i.component,{metadata:s}=n,o=Ul(a);return d.jsx(Si,pn(pn({widgetName:s==null?void 0:s.name,widgetType:i.title},n),{},{children:o?d.jsx(a,pn(pn({},n),{},{ref:r})):d.jsx(a,pn({},n))}))}return t.displayName="WidgetLoaderPlugin(".concat((e=i.component.displayName)!==null&&e!==void 0?e:i.name,")"),p.forwardRef(t)}function $m(i){var e=no(),t=p.useMemo(()=>{var o=new Map;return e.forEach(l=>{bd(l)&&[l.supportedTypes].flat().forEach(u=>{if(u!=null&&u!==""){if(o.has(u)){var h;Am.warn("Multiple WidgetPlugins handling type ".concat(u,". Replacing ").concat((h=o.get(u))===null||h===void 0?void 0:h.name," with ").concat(l.name," to handle ").concat(u))}o.set(u,l)}})}),o},[e]);nn(i);var{id:n,layout:r,registerComponent:a}=i,s=p.useCallback(o=>{var l,{dragEvent:u,fetch:h,panelId:c=$e.generate(),widget:v}=o,{id:m,type:b}=v,g=(l=v.title)!==null&&l!==void 0?l:v.name,f=t.get(b);if(f!=null){var C={id:m,name:g,type:b},E={localDashboardId:n,metadata:C,fetch:h},S={type:"react-component",component:f.name,props:E,title:g,id:c},{root:y}=r;M.openComponent({root:y,config:S,dragEvent:u})}},[n,r,t]);return p.useEffect(()=>{var o=[...new Set(t.values())].map(l=>{var{panelComponent:u}=l;return u==null?a(l.name,_m(l)):a(l.name,u)});return()=>{o.forEach(l=>l())}},[a,t]),me(r.eventHub,oe.OPEN,s),null}var Um={name:"WidgetLoaderPlugin",type:Nt.DASHBOARD_PLUGIN,component:$m};const yf=Um;function Fi(i,e,t){return e=Hm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hm(i){var e=Vm(i,"string");return typeof e=="symbol"?e:String(e)}function Vm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Hn{}Fi(Hn,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Fi(Hn,"INPUT_FILTER","ControlType.INPUT_FILTER");Fi(Hn,"MARKDOWN","ControlType.MARKDOWN");Fi(Hn,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const Pf=Hn;var Gm=$.shape({state:$.shape({panelState:$.shape({})})}),Bm=$.shape({panelId:$.string.isRequired,columnName:$.string.isRequired,columnType:$.string.isRequired}),Ls=$.shape({panelId:$.string.isRequired,columnName:$.string.isRequired}),il=$.shape({start:Ls,end:Ls,id:$.string,isReversed:$.bool}),Wm=$.arrayOf(il),Km=$.shape({name:$.string.isRequired,operateAs:$.string.isRequired,groups:$.arrayOf($.string).isRequired,permissions:$.shape({canUsePanels:$.bool.isRequired,canCopy:$.bool.isRequired,canDownloadCsv:$.bool.isRequired,canLogout:$.bool.isRequired}).isRequired}),zm=Object.freeze({LinkPoint:Bm,Link:il,Links:Wm,Panel:Gm,User:Km});const wf=zm;var qm=(i,e)=>i[e]===null?null:$.bool,Ym=(i,e)=>i[e]===null?null:$.string,Xm=Object.freeze({nullableBoolean:qm,nullableString:Ym});const Tf=Xm;export{Bp as ChartBuilderPlugin,vf as ChartBuilderPluginConfig,tr as ChartEvent,Pi as ChartPanel,hf as ChartPanelPlugin,cf as ChartPluginConfig,Vp as ChartWidgetPlugin,Ic as CommandHistoryPanel,Tf as CommonPropTypes,We as ConsoleEvent,Hi as ConsolePanel,pf as ConsolePlugin,Pf as ControlType,At as DropdownFilterPanel,Tv as FileExplorerPanel,Xp as FilterPlugin,mf as FilterPluginConfig,Dv as FilterSetManager,Gi as FilterSetManagerPanel,ff as GridPanelPlugin,gf as GridPluginConfig,am as GridWidgetPlugin,fe as InputFilterEvent,Ln as InputFilterPanel,Ze as IrisGridEvent,In as IrisGridPanel,Pm as LinkerPlugin,bf as LinkerPluginConfig,Gt as LinkerUtils,np as LogPanel,Yh as MarkdownEvent,un as MarkdownPanel,Nm as MarkdownPlugin,Cf as MarkdownPluginConfig,uf as MockFileStorage,ie as NotebookEvent,Rt as NotebookPanel,rf as PandasEvent,Np as PandasPanel,Sf as PandasPanelPlugin,Ef as PandasPluginConfig,xm as PandasWidgetPlugin,pt as Panel,zn as TabEvent,at as ToolType,wf as UIPropTypes,$m as WidgetLoaderPlugin,yf as WidgetLoaderPluginConfig,Si as WidgetPanel,Ci as WidgetPanelTooltip,mc as addDashboardLinks,fc as deleteDashboardLinks,Pr as getColumnSelectionValidatorForDashboard,ko as getColumnsForDashboard,of as getDashboardConnection,sf as getDashboardConsoleSettings,$n as getDashboardSessionWrapper,pc as getFilterSetsForDashboard,Sr as getInputFiltersForDashboard,yr as getIsolatedLinkerPanelIdForDashboard,on as getLinksForDashboard,Er as getTableMapForDashboard,Ec as isChartPanelDehydratedProps,_o as isChartPanelFigureMetadata,On as isChartPanelTableMetadata,Sc as isGLChartPanelState,Fv as isIrisGridPanelMetadata,Mv as isLegacyIrisGridPanelMetadata,gc as setDashboardColumnSelectionValidator,lf as setDashboardConnection,bc as setDashboardConsoleSettings,Cc as setDashboardFilterSets,jo as setDashboardIsolatedLinkerPanelId,wr as setDashboardLinks,df as setDashboardSessionWrapper,Jp as useLoadTablePlugin};
27
- //# sourceMappingURL=index-d2774692.js.map
27
+ //# sourceMappingURL=index-9e246861.js.map