@deephaven/code-studio 0.40.0 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{AppRoot-d2b1d238.js → AppRoot-37271714.js} +4 -4
- package/build/assets/{AppRoot-d2b1d238.js.map → AppRoot-37271714.js.map} +1 -1
- package/build/assets/{index-431a7839.js → index-e256ebd8.js} +2 -2
- package/build/assets/{index-431a7839.js.map → index-e256ebd8.js.map} +1 -1
- package/build/assets/{index-db040c26.js → index-e5fe2591.js} +2 -2
- package/build/assets/{index-db040c26.js.map → index-e5fe2591.js.map} +1 -1
- package/build/assets/{useConnection-80b76cca.js → useConnection-831c4fc5.js} +2 -2
- package/build/assets/{useConnection-80b76cca.js.map → useConnection-831c4fc5.js.map} +1 -1
- package/build/index.html +2 -2
- package/package.json +19 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as r,G as X,r as w,I as Yu,P as U,F as z,J as _c,H as oe,K as he,L as La,M as bs,N as Ge,O as we,Q as Pc,S as Ze,T as er,U as qu,V as Xu,W as Zu,X as Qu,$ as le,R as tr,Y as ld,Z as Ue,_ as nr,a0 as Ju,a1 as Oe,a2 as _a,E as em,D as Bt,a3 as Ll,a4 as jc,a5 as sr,a6 as tm,a7 as In,a8 as nm,a9 as sm,aa as im,ab as om,ac as Pa,ad as lm,ae as am,af as rm,ag as ad,ah as dm,ai as rd,aj as cm,ak as hm,al as um,am as mm,an as gm,ao as pm,ap as mt,aq as Hc,ar as fm,as as Uc,at as Cm,au as Vc,av as Sm,aw as bm,ax as wm,ay as vm,az as dd,aA as Tm,aB as Em}from"./vendor-aaea4a59.js";import{P as be,u as Qs,T as _l,B as P,a as D,S as He,M as fe,K as ve,G as Yn,b as Jt,C as te,c as tn,D as $n,d as xi,e as Pl,f as Je,g as co,I as Ei,U as ym,h as de,i as F,j as Xs,F as Wn,k as gn,l as ir,E as Ie,m as N,n as jn,o as ws,p as tl,q as it,r as We,s as st,t as jl,v as Rm,O as Un,w as xm,x as hn,y as rn,z as Im,A as Dm,R as Hl,H as Gn,J as Ul,L as Bc,N as $c,Q as Fm,V as Nm,W as cd,X as $e,Y as hd,Z as Wc,_ as or,$ as ud,a0 as io,a1 as Gc,a2 as km,a3 as zc,a4 as Mm,a5 as nn,a6 as Am,a7 as Om,a8 as Lm,a9 as _m,aa as Pm,ab as jm,ac as Hm,ad as Um,ae as Vm,af as Bm,ag as $m,ah as Wm}from"./useConnection-
|
|
1
|
+
import{C as r,G as X,r as w,I as Yu,P as U,F as z,J as _c,H as oe,K as he,L as La,M as bs,N as Ge,O as we,Q as Pc,S as Ze,T as er,U as qu,V as Xu,W as Zu,X as Qu,$ as le,R as tr,Y as ld,Z as Ue,_ as nr,a0 as Ju,a1 as Oe,a2 as _a,E as em,D as Bt,a3 as Ll,a4 as jc,a5 as sr,a6 as tm,a7 as In,a8 as nm,a9 as sm,aa as im,ab as om,ac as Pa,ad as lm,ae as am,af as rm,ag as ad,ah as dm,ai as rd,aj as cm,ak as hm,al as um,am as mm,an as gm,ao as pm,ap as mt,aq as Hc,ar as fm,as as Uc,at as Cm,au as Vc,av as Sm,aw as bm,ax as wm,ay as vm,az as dd,aA as Tm,aB as Em}from"./vendor-aaea4a59.js";import{P as be,u as Qs,T as _l,B as P,a as D,S as He,M as fe,K as ve,G as Yn,b as Jt,C as te,c as tn,D as $n,d as xi,e as Pl,f as Je,g as co,I as Ei,U as ym,h as de,i as F,j as Xs,F as Wn,k as gn,l as ir,E as Ie,m as N,n as jn,o as ws,p as tl,q as it,r as We,s as st,t as jl,v as Rm,O as Un,w as xm,x as hn,y as rn,z as Im,A as Dm,R as Hl,H as Gn,J as Ul,L as Bc,N as $c,Q as Fm,V as Nm,W as cd,X as $e,Y as hd,Z as Wc,_ as or,$ as ud,a0 as io,a1 as Gc,a2 as km,a3 as zc,a4 as Mm,a5 as nn,a6 as Am,a7 as Om,a8 as Lm,a9 as _m,aa as Pm,ab as jm,ac as Hm,ad as Um,ae as Vm,af as Bm,ag as $m,ah as Wm}from"./useConnection-831c4fc5.js";import{e as zn,l as xn,K as en,a as md,R as Gm,b as gs,W as zm}from"./monaco-13f9c9bb.js";import{v as ja,d as Km,a as Kc,b as lr,L as Nn,c as ho,e as Bn,f as Yc,g as J,h as gd,i as Ym,j as qm,k as Xm,l as Zm,m as $t,n as Ss,o as qc,p as Kn,q as Vl,r as yi,s as Qm,t as Jm,u as pd,w as al,x as fd,y as Xc,z as eg,A as uo,B as Zc,C as tg,D as ng,T as Ye,E as ar,F as rr,G as rl,H as An,I as sg,J as ig,K as og,M as lg,N as ag,O as dr,P as vs,Q as Cd,R as mo,S as cr,U as hr,V as Qc,W as rg,X as Bl,Y as dg,Z as dl,_ as cg,$ as ur,a0 as Jc,a1 as Ws,a2 as hg,a3 as ug,a4 as mg,a5 as gg,a6 as pg,a7 as fg,a8 as Sd,a9 as ga,aa as Cg,ab as Sg,ac as bg,ad as $l,ae as Wl,af as wg,ag as vg,ah as Gl,ai as eh,aj as Tg,ak as Eg,al as yg,am as th,an as Rg,ao as xg,ap as Ig,aq as Dg,ar as Fg,as as Ng,at as kg,au as Mg,av as Ag,aw as Og,ax as Lg,ay as _g,az as Pg,aA as nh,aB as jg,aC as Ha,aD as Ua,aE as Hg,aF as Ug,aG as Vg,aH as Bg,aI as $g,aJ as Wg,aK as Gg,aL as zg,aM as Kg,aN as Yg,aO as qg,aP as Xg,aQ as Zg,aR as bd,aS as Qg,aT as Jg,aU as ep}from"./index-e5fe2591.js";import{P as cl,b as tp,h as np,p as sp,o as ip,s as op,t as lp,c as nl}from"./plotly-ebf80adc.js";import"./helpers-042e6b4d.js";class mr{static isDark(e){const t=document.createElement("div");t.style.display="none",t.style.color=e;const n=getComputedStyle(document.body.appendChild(t)).color,s=n.match(/\d+/g);let i=[];if(s)i=s.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${n}`);return document.body.removeChild(t),mr.getBrightness(i)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}const sh=mr,ap="table_",wd="column_",rp=new Set(["in","not","i","ii","k"]),dp=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"]),cp=/[^a-zA-Z0-9_$+@-]/g,hp=/[^A-Za-z0-9_$]/g;class Ps{static legalize=(e,t,n,s,i)=>{let o=e.trim().replace(/[- ]/g,"_");return s&&(rp.has(o)||dp.has(o))&&(o=t+o),o=o.replace(n,""),o||(o=t+i),Number.isNaN(Number(o.charAt(0)))||(o=t+o),o};static legalizeTableName=e=>Ps.legalize(e,ap,cp,!1,0);static legalizeColumnNames=e=>{const t=[];return e.forEach((n,s)=>{let i=Ps.legalizeColumnName(n,s);t.includes(i)&&(i=wd+s),t.push(i)}),t};static legalizeColumnName=(e,t=0)=>Ps.legalize(e,wd,hp,!0,t);static isValidTableName=e=>Ps.legalizeTableName(e)===e;static isValidColumnName=e=>Ps.legalizeColumnName(e)===e}const Ii=Ps;function up(c,e){return c?c.closest(`.${e}`):null}const mp={getClosestByClassName:up};class gp{pending=[];resolved=[];add(e,t){const n=be.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(let 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(){const e=[...this.pending,...this.resolved];for(let t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const qn=gp;class pp extends Error{isInvalid=!0}const wi=pp;function ih({type:c}){const e=Qs();switch(c){case e.VariableType.TABLE:case e.VariableType.TABLEMAP:case e.VariableType.TREETABLE:case e.VariableType.HIERARCHICALTABLE:return r.jsx(X,{icon:lr});case e.VariableType.FIGURE:return r.jsx(X,{icon:Kc});case e.VariableType.PANDAS:return r.jsx(X,{icon:Km});default:return r.jsx(X,{icon:ja})}}class fp extends w.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}container;colorize(){const{children:e}=this.props;this.container&&e!=null&&zn.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:t}=this.props;return r.jsx("div",{children:r.jsx("div",{"data-lang":t,ref:n=>{this.container=n},style:{pointerEvents:"none"},children:e})})}}const zl=fp;class Cp{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const oh=Cp;class hl{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)?[]:Yu.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:`${t}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const t=`${e.getHours()}`.padStart(2,"0"),n=`${e.getMinutes()}`.padStart(2,"0"),s=`${e.getSeconds()}`.padStart(2,"0"),i=`${e.getMilliseconds()}`.padStart(3,"0");return`${t}:${n}:${s}.${i}`}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return hl.isTableType(e,t)||hl.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const Va=hl;function lh({children:c}){return r.jsxs("div",{className:"console-history-item-result",children:[r.jsx("div",{className:"console-history-gutter",children:"-"}),r.jsx("div",{className:"console-history-content",children:c})]})}lh.propTypes={children:U.node.isRequired};class Sp extends w.Component{static defaultProps={disabled:!1};constructor(e){super(e),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}timer;startTime;updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return r.jsx("div",{className:z("console-history-result-in-progress",{disabled:e}),children:r.jsxs("span",{className:"badge",children:[r.jsx(Nn,{})," Running... ",_l.formatElapsedTime(n)," ",r.jsx(P,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:ho,tooltip:"Cancel",onClick:t,disabled:e})]})})}}const bp=Sp;class ul extends w.PureComponent{static defaultProps={message:""};static mouseDragThreshold=5;constructor(e){super(e),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}}mouseX;mouseY;isClicking;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)>=ul.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=ul.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(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;D(n);const s=n.indexOf(`
|
|
2
2
|
`),i=s>-1;let o=n;i&&(o=n.slice(0,s));const l=n.slice(s),a=t?"error-btn-link error-btn-link--active":"error-btn-link";return r.jsxs("div",{className:z("error-message",{expanded:e}),children:[i&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"error-gutter",children:r.jsx("button",{type:"button",onClick:this.handleToggleError,className:a,tabIndex:-1,children:r.jsx(X,{icon:e?Bn:Yc,transform:"left-3"})})}),r.jsxs("div",{className:"error-content",children:[r.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:o}),e?l:""]})]}),!i&&r.jsx("div",{className:"error-content",children:r.jsx("div",{className:"console-error-text",children:o})})]},"error")}}const wp=ul;const vd=J.module("ConsoleHistoryItem");class vp extends w.PureComponent{static defaultProps={disabled:!1};constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){vd.debug("handleObjectClick",e);const{openObject:t}=this.props;t(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(vd.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){const{disabled:e,item:t,language:n}=this.props,{disabledObjects:s,result:i}=t;let o=null;t.command!=null&&t.command!==""&&(o=r.jsxs("div",{className:"console-history-item-command",children:[r.jsx("div",{className:"console-history-gutter",children:">"}),r.jsx("div",{className:"console-history-content",children:r.jsx(zl,{language:n,children:t.command})})]}));const l=[];let a=!1;if(i){const{error:h,message:u,changes:m}=i;if(m){const{created:g,updated:p}=m;[...g,...p].forEach(f=>{a=!0;const{title:C}=f,S=`${C}`,b=e===void 0||e||(s??[]).indexOf(S)>=0,v=r.jsx(P,{kind:"primary",onClick:()=>this.handleObjectClick(f),className:"btn-console-object",disabled:b,icon:r.jsx(ih,{type:f.type}),children:C},S);l.push(v)})}if(h!=null&&t.command==null){let g=`${h.message??h}`;g||(g=h);const p=r.jsx(wp,{message:g},"result-error");l.push(p)}if(u!==void 0&&u!==""){const g=r.jsx("div",{className:"log-message",children:u},"log-message");l.push(g)}}else{a=!0;const h=r.jsx(bp,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(h)}let d=null;return l.length>0&&(d=r.jsx(lh,{children:l})),r.jsxs("div",{className:z("console-command-result",{"console-result-buttons":a}),children:[o,d]})}}const Tp=vp;class gr extends w.Component{static defaultProps={disabled:!1};static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,i=[];for(let o=0;o<t.length;o+=1){const l=t[o],a=r.jsx(Tp,{disabled:e,item:l,openObject:s,language:n},gr.itemKey(o,l));i.push(a)}return r.jsx("div",{className:"container-fluid console-history",children:i})}}const Ep=gr,yp={name:"Console",CLEAR:He.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[fe.CTRL,ve.L],macShortcut:[fe.CTRL,ve.C]}),FOCUS_HISTORY:He.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[fe.CTRL,ve.H],macShortcut:[fe.CTRL,fe.OPTION,ve.H]})},Rp={name:"Command History",FOCUS_HISTORY:He.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[fe.CTRL,ve.H],macShortcut:[fe.CTRL,fe.OPTION,ve.H]}),SEND_TO_CONSOLE:He.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ve.ENTER],macShortcut:[ve.ENTER]}),SEND_TO_NOTEBOOK:He.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[fe.CTRL,ve.ENTER],macShortcut:[fe.CMD,ve.ENTER]}),RUN:He.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[fe.ALT,ve.R],macShortcut:[fe.OPTION,ve.R]})},xp={name:"Notebook",RUN:He.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[fe.ALT,ve.R],macShortcut:[fe.OPTION,ve.R]}),RUN_SELECTED:He.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[fe.ALT,fe.SHIFT,ve.R],macShortcut:[fe.OPTION,fe.SHIFT,ve.R]}),FIND:He.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[fe.CTRL,ve.F],macShortcut:[fe.CMD,ve.F],isEditable:!1}),MINIMAP:He.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[fe.ALT,ve.M],macShortcut:[fe.OPTION,ve.M]}),WORDWRAP:He.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[fe.ALT,ve.Z],macShortcut:[fe.OPTION,ve.Z]})},Ip={CONSOLE:yp,COMMAND_HISTORY:Rp,NOTEBOOK:xp},Rt=Ip,ct=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Dp="#2d2a2e",Fp="#fcfcfa",Np="#fcd65b",kp="#b2b1b2",Mp="#9edc6f",Ap="#76d9e4",Op="#f95d84",Lp="#aa9af4",_p="#f95d84",Pp="#fcfcfa",jp="#7c7b7c",me={"error-foreground":"#f95d84",background:Dp,foreground:Fp,"line-height":"19px",string:Np,"string-delim":"#929192",delimiter:kp,predefined:Mp,keyword:Ap,storage:Op,number:Lp,operator:_p,identifier:Pp,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:jp,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356","text-link-foreground":"#929192","text-link-active-foreground":"#f0f0ee","editor-link-active-foreground":"#f0f0ee"},Hp="python",Up={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/}}},Vp={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"]]}},Bp={id:Hp,conf:Up,language:Vp},$p=Bp,Wp="groovy",Gp={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/}}},zp={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"]]}},Kp={id:Wp,conf:Gp,language:zp},Yp=Kp,qp="scala",Xp={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>))/}}},Zp={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"]]}},Qp={id:qp,conf:Xp,language:Zp},Jp=Qp,ef="deephavenDb",tf={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/}}},nf={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"]]}},sf={id:ef,conf:tf,language:nf},of=sf,lf="log",af={},rf={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"}]]}},df={id:lf,conf:af,language:rf},cf=df,bn=J.module("MonacoUtils");class Tn{static init({getWorker:e}={}){bn.debug("Initializing Monaco..."),e!==void 0&&Tn.registerGetWorker(e);const{registerLanguages:t,removeHashtag:n}=Tn,s=[{token:"",foreground:n(me.foreground)},{token:"string",foreground:n(me.string)},{token:"string.delim",foreground:n(me["string-delim"])},{token:"keyword",foreground:n(me.keyword)},{token:"identifier.js",foreground:n(me["identifier-js"])},{token:"delimiter",foreground:n(me.delimiter)},{token:"comment",foreground:n(me.comment)},{token:"number",foreground:n(me.number)},{token:"storage",foreground:n(me.storage)},{token:"identifier",foreground:n(me.identifier)},{token:"namespace.identifier",foreground:n(me["namespace-identifier"])},{token:"operator",foreground:n(me.operator)},{token:"predefined",foreground:n(me.predefined)},{token:"error.log",foreground:me["log-error"].substring(1)},{token:"warn.log",foreground:n(me["log-warn"])},{token:"info.log",foreground:n(me["log-info"])},{token:"stdout.log",foreground:n(me["log-stdout"])},{token:"trace.log",foreground:n(me["log-trace"])},{token:"debug.log",foreground:n(me["log-debug"])},{token:"date.log",foreground:n(me["log-date"])}],i={errorForeground:me["error-foreground"],"inputOption.activeBorder":me["input-option-active-border"],"editor.background":me.background,"editor.foreground":me.foreground,"editor.lineHighlightBackground":me["editor-line-highlight-bg"],"editorLineNumber.foreground":me["editor-line-number-foreground"],"editor.selectionBackground":me["editor-selection-background"],"editor.findMatchBackground":me["editor-find-match-background"],"editor.findMatchHighlightBackground":me["editor-find-match-highlight-background"],"editorSuggestWidget.background":me["editor-suggest-widget-background"],"editorSuggestWidget.border":me["editor-suggest-widget-border"],"editorSuggestWidget.foreground":me["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":me["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":me["editor-suggest-widget-highlightForeground"],"list.hoverBackground":me["list-hover-background"],"dropdown.background":me["context-menu-background"],"dropdown.foreground":me["context-menu-foreground"],"menu.selectionBackground":me["menu-selection-background"],"list.focusBackground":me["menu-selection-background"],"editorWidget.background":me["editor-widget-background"],"inputOption.activeBackground":me["input-option-active-background"],"inputOption.activeForeground":me["input-option-active-foreground"],focusBorder:me["focus-border"],"input.background":me["input-background"],"input.foreground":me["input-foreground"],"input.border":me["input-border"],"textLink.foreground":me["text-link-foreground"],"textLink.activeForeground":me["text-link-active-foreground"],"editorLink.activeForeground":me["editor-link-active-foreground"]};zn.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:s,colors:i}),bn.debug2("monaco theme: ",me),zn.setTheme("dh-dark"),t([of,$p,Yp,cf,Jp]),bn.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:e}}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const t=e.map(({id:n})=>n);xn.getLanguages().filter(({id:n})=>t.includes(n)).forEach(n=>{const s=n;bn.debug2("Overriding default language loader:",s.id)}),e.forEach(n=>{Tn.registerLanguage(n)})}static registerLanguage(e){bn.debug2("Registering language: ",e.id),xn.register(e),xn.onLanguage(e.id,()=>{xn.setLanguageConfiguration(e.id,e.conf),xn.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,t=zn.EndOfLineSequence.LF){e.getModel()?.setEOL(t)}static openDocument(e,t){const n=e.getModel();D(n);const s={textDocument:{uri:`${n.uri}`,languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};return bn.debug2("didOpenDocumentParams: ",s),t.openDocument(s),e.onDidChangeModelContent(o=>{const{changes:l,versionId:a}=o,d=[];for(let h=0;h<l.length;h+=1){const u=l[h],{range:m,rangeLength:g,text:p}=u,f={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:g,text:p};d.push(f)}if(d.length>0){const h={textDocument:{version:a,uri:`${n.uri}`},contentChanges:d};bn.debug2("didChangeDocumentParams",h),t.changeDocument(h)}})}static closeDocument(e,t){const n=e.getModel();D(n);const s={textDocument:{uri:`${n.uri}`}};t.closeDocument(s)}static registerPasteHandler(e){e.onDidPaste(t=>{const n=/“|”/g,s=/\u200b/g,i=/\u00A0/g,o=e.getModel();D(o);const l=o.getValueInRange(t.range);(n.test(l)||s.test(l)||i.test(l))&&o.applyEdits([{range:t.range,text:l.replace(n,'"').replace(s,"").replace(i," ")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const t=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{t.forEach(n=>{Tn.isMacPlatform()&&n.mac===""||!Tn.isMacPlatform()&&n.windows===""||Tn.removeKeybinding(e,Tn.isMacPlatform()?n.mac:n.windows)})}catch(n){bn.error(n)}}static removeKeybinding(e,t){if(t===void 0)return;const n=e._standaloneKeybindingService._getResolver()._map.get(t);n!=null?n.forEach(s=>{bn.debug2(`Removing Monaco keybinding ${t} for ${s.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${s.command}`,null,()=>{})}):bn.warn(`Did not find any keybindings to remove for ${t}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:t}=e,{keyValue:n}=t;return n===null?0:Tn.isMacPlatform()?(t.metaKey?en.CtrlCmd:0)|(t.shiftKey?en.Shift:0)|(t.altKey?en.Alt:0)|(t.ctrlKey?en.WinCtrl:0)|md.fromString(n):(t.ctrlKey?en.CtrlCmd:0)|(t.shiftKey?en.Shift:0)|(t.altKey?en.Alt:0)|(t.metaKey?en.WinCtrl:0)|md.fromString(n)}static provideLinks(e){const t=[];for(let n=1;n<=e.getLineCount();n+=1){const s=e.getLineContent(n);_c(s).filter(l=>l.type==="url"?/^https?:\/\//.test(l.value):!0).forEach(l=>{t.push({url:l.href,range:new Gm(n,l.start+1,n,l.end+1)})})}return{links:t}}}const Mt=Tn,On=J.module("MonacoCompletionProvider");class js extends w.PureComponent{static lspToMonacoKind(e){const t=xn.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){const{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),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){const{language:e,session:t}=this.props;this.registeredCompletionProvider=xn.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=xn.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=xn.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){this.registeredCompletionProvider?.dispose(),this.registeredSignatureProvider?.dispose(),this.registeredHoverProvider?.dispose()}registeredCompletionProvider;registeredSignatureProvider;registeredHoverProvider;handleCompletionRequest(e,t,n){const{model:s,session:i}=this.props;if(e!==s)return null;const o={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:js.monacoToLspPosition(t),context:n},l=i.getCompletionItems(o);return On.debug("Requested completion items",o),l.then(d=>(On.debug("Completion items received: ",o,d),{incomplete:!0,suggestions:d.map(u=>{const{label:m,kind:g,detail:p,documentation:f,sortText:C,filterText:S,textEdit:b,insertTextFormat:v}=u;return{label:m,kind:js.lspToMonacoKind(g),detail:p,documentation:f?.kind==="markdown"?f:f?.value,sortText:C,filterText:S,insertText:b.text,insertTextRules:v===2?4:v,range:js.lspToMonacoRange(b.range)}})})).catch(d=>(On.error("There was an error retrieving completion items",d),{suggestions:[]}))}handleSignatureRequest(e,t,n,s){const i={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:o,session:l}=this.props;if(e!==o||!l.getSignatureHelp)return null;const a={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:js.monacoToLspPosition(t),context:s},d=l.getSignatureHelp(a);return On.debug("Requested signature help",a),d.then(u=>{On.debug("Signatures received: ",a,d);const m=u.map(p=>{const{label:f,documentation:C,parameters:S}=p;return{documentation:C?.kind==="markdown"?C:C?.value,label:f,parameters:S??[]}});if(m.length===0)return i;const g=0;return{value:{signatures:m,activeSignature:g,activeParameter:u[g].activeParameter},dispose:()=>{}}}).catch(u=>(On.error("There was an error retrieving completion items",u),i))}handleHoverRequest(e,t){const{model:n,session:s}=this.props;if(e!==n||!s.getHover)return null;const i={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:js.monacoToLspPosition(t)},o=s.getHover(i);return On.debug("Requested hover",i),o.then(a=>{On.debug("Hover received: ",i,a);const{contents:d}=a;return{contents:d?[d]:[]}}).catch(a=>(On.error("There was an error retrieving hover",a),{contents:[]}))}render(){return null}}const ah=js;const pa=J.module("ConsoleInput"),sl=parseInt(me["line-height"],10),rh=6,ch=6,hf=sl+rh+ch,fa=100;class pr extends w.PureComponent{static defaultProps={maxHeight:sl*10,scope:null,disabled:!1};static INPUT_CLASS_NAME="console-input";constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=oe.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:sl,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()}cancelListener;commandContainer;commandEditor;commandHistoryIndex;commandSuggestionContainer;loadingPromise;timestamp;bufferIndex;history;modifiedCommands;setConsoleText(e,t=!0,n=!1){e&&(pa.debug("Command received: ",e),n||(this.commandHistoryIndex=null,this.commandEditor?.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:sl,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:rh,bottom:ch},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;D(s),this.commandEditor=zn.create(s,n),Mt.setEOL(this.commandEditor),Mt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{const i=this.commandEditor?.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{const{commandEditor:o,commandHistoryIndex:l}=this,a=o?.getPosition();D(a);const{lineNumber:d}=a,h=o?.getModel();if(i.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===h?.getLineCount()){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===gs.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const u=this.commandEditor?.getValue().trim();u!==void 0&&(this.processCommand(u),this.commandEditor?.setValue(""))}}else i.keyCode===gs.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),this.commandEditor?.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(en.CtrlCmd|gs.KeyF,()=>{}),Mt.removeConflictingKeybindings(this.commandEditor),Mt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(Mt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){return this.commandSuggestionContainer||(this.commandSuggestionContainer=this.commandEditor?.getDomNode()?.querySelector(".suggest-widget")),(this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))??!1}isSuggestionMenuPopulated(){return this.isSuggestionMenuActive()&&(this.commandSuggestionContainer?.querySelector(".monaco-list-rows")?.childElementCount??0)>0}focus(){this.commandEditor?.focus()}focusStart(){const e=this.commandEditor?.getModel();D(e);const t=e.getLineLength(1)+1,n=this.commandEditor?.getTopForPosition(1,t);D(n),this.commandEditor?.setPosition({lineNumber:1,column:t}),this.commandEditor?.setScrollTop(n),this.commandEditor?.focus()}focusEnd(){const e=this.commandEditor?.getModel();D(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=this.commandEditor?.getTopForPosition(t,n);D(s),this.commandEditor?.setPosition({lineNumber:t,column:n}),this.commandEditor?.setScrollTop(s),this.commandEditor?.focus()}clear(){this.commandEditor?.focus(),this.commandEditor?.getModel()?.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){if(e!==null&&e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,this.commandEditor?.getModel()?.setValue(t??n),e!==null&&e>this.history.length-fa&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=be.makeCancelable(e.getTable(t,n??"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+fa-1}),this.loadingPromise=be.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=fa,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i.items.filter(({name:o},l,a)=>l===0||o!==a[l-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,be.isCanceled(e)){pa.debug2("Promise canceled, not loading history");return}pa.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),D(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;D(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),hf),i={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{this.commandEditor?.updateOptions(i),this.commandEditor?.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return r.jsx("div",{className:z("console-input-wrapper",{disabled:e}),children:r.jsxs("div",{className:z("console-input-inner-wrapper",{focus:i}),children:[r.jsx("div",{className:pr.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&r.jsx(ah,{model:o,language:t,session:n})]})})}}const Td=pr;const Ed="pasted values",uf=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Ca=[".csv",".tsv",".tab",".psv",".dsv",".txt"],yd=[".zip"];class Hs extends w.Component{static defaultProps={allowZip:!1,dragError:null};static MULTIPLE_FILE_ERROR="Please select only one file";static FILE_TYPE_ERROR="Filetype not supported.";static isValidDropItem(e){return e!=null&&e.kind==="file"&&!uf.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return Ca.some(n=>e.endsWith(n))||t&&yd.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Ed?gd:e.endsWith(".csv")?Ym:e.endsWith(".zip")?qm:Xm}constructor(e){super(e),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=oe.createRef(),this.divElem=oe.createRef(),this.state={selectedFileName:""}}componentDidMount(){this.divElem.current?.addEventListener("paste",this.handlePasteEvent),this.divElem.current?.focus()}componentWillUnmount(){this.divElem.current?.removeEventListener("paste",this.handlePasteEvent)}fileElem;divElem;handleSelectFile(){this.fileElem.current&&(this.fileElem.current.value="",this.fileElem.current?.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const i=e.dataTransfer.items[0].getAsFile();D(i),Hs.isValidExtension(i.name,t)?this.handleFile(i):this.setState({dropError:Hs.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:Ed,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:gd,action:this.handleMenuPaste,shortcut:Yn.PASTE,disabled:e}]}getValidExtensions=he(e=>e?[...Ca,...yd]:[...Ca]);getAcceptString=he(e=>this.getValidExtensions(e).join(", "));getFileTypeErrorString=he(e=>Jt.join(this.getValidExtensions(e),"or"));render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=t??i,l=this.makeContextMenuItems();return r.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Hs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[r.jsx(te,{actions:l}),r.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&r.jsxs("div",{className:"message-content",children:[r.jsx("div",{className:"message-icon",children:r.jsx(X,{icon:Zm})}),r.jsx("label",{children:"Drop file (or paste values) here to import"}),r.jsx("div",{className:"message-small",children:r.jsx("label",{children:"or"})}),r.jsx(P,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&r.jsxs("div",{className:"selected-content",children:[r.jsx("div",{className:"selected-icon",children:r.jsx(X,{icon:Hs.getIcon(s)})}),r.jsxs("div",{className:"selected-text",children:[r.jsx("label",{children:"Selected File"}),r.jsxs("label",{className:"selected-name",children:[s,!n&&r.jsx(P,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:$t,tooltip:"Remove"})]})]})]}),!!o&&r.jsxs("div",{className:"message-content",children:[r.jsx("div",{className:"message-icon",children:r.jsx(X,{icon:Ss})}),r.jsx("label",{children:o}),o===Hs.FILE_TYPE_ERROR&&r.jsx("div",{className:"message-small",children:r.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}const ci=Hs;class mf{static INTEGER="int";static LONG="long";static DOUBLE="double";static BOOLEAN="bool";static STRING="string";static DATE_TIME="datetime";static LOCAL_TIME="localtime"}const ke=mf,Rd="unknown",gf=2147483647,pf=-2147483648,xd=/^[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]+)?$/,Id=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class St{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case ke.STRING:return ke.STRING;case ke.INTEGER:return St.checkInteger(e);case ke.LONG:return St.checkLong(e);case ke.DOUBLE:return St.checkDouble(e);case ke.BOOLEAN:return St.checkBoolean(e);case ke.DATE_TIME:return St.checkDateTime(e);case ke.LOCAL_TIME:return St.checkLocalTime(e);default:return St.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const t=e.replace(/,/g,"");return St.isNotParsableNumber(t)?ke.STRING:St.getNumberType(t)}static checkLong(e){const t=e.replace(/,/g,"");return St.isNotParsableNumber(t)?ke.STRING:t.includes(".")?ke.DOUBLE:ke.LONG}static checkDouble(e){const t=e.replace(/,/g,"");return St.isNotParsableNumber(t)?ke.STRING:ke.DOUBLE}static checkBoolean(e){const t=e.toLowerCase();return t==="true"||t==="false"?ke.BOOLEAN:ke.STRING}static checkDateTime(e){return xd.test(e)?ke.DATE_TIME:ke.STRING}static checkLocalTime(e){return Id.test(e)?ke.LOCAL_TIME:ke.STRING}static getTypeFromUnknown(e){const t=e.replace(/,/g,"");if(St.isNotParsableNumber(t)){const n=e.toLowerCase();return n==="true"||n==="false"?ke.BOOLEAN:xd.test(e)&&e.includes(":")?ke.DATE_TIME:Id.test(e)?ke.LOCAL_TIME:ke.STRING}return St.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ke.DOUBLE;const t=e.startsWith("-")?11:10;if(e.length>t)return ke.LONG;const n=parseInt(e,10);return n>gf||n<pf?ke.LONG:ke.INTEGER}constructor(e,t,n,s,i,o,l,a,d,h){this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=i,this.onProgress=o,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=d,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={...s,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}onFileCompleted;file;readHeaders;nullString;onProgress;onError;types;chunks;totalChunks;isZip;shouldTrim;zipProgress;config;parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;La.parse(e,this.config)}handleChunk(e,t){let{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(Rd),this.readHeaders&&(n=n.slice(1))}D(this.types);const s=[...this.types];n.forEach(l=>{if(l.length>=s.length){for(let a=0;a<s.length;a+=1)s[a]=St.determineType(this.shouldTrim?l[a].trim():l[a],s[a],this.nullString);this.types=s}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
3
3
|
Expected length ${s.length} but found ${l.length}.
|
|
4
4
|
Row = ${l}`)}),this.chunks+=1;let i=0;this.totalChunks>0?i=Math.round(this.chunks/this.totalChunks*50):i=Math.round(this.zipProgress/2),this.onProgress(i)&&t.abort()}handleComplete(e){const{types:t,onFileCompleted:n}=this;D(t),(e==null||!e.meta.aborted)&&n(t.map(s=>s===Rd?ke.STRING:s))}handleError(e){const{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const ff=St,_o=J.module("CsvParser"),Cf=650;class Xi{static generateHeaders=e=>{const t=[];for(let n=0;n<e;n+=1)t.push(Xi.generateHeaderRecursive(n));return t};static generateHeaderRecursive(e){let t="",n=e;return e>=26&&(t=t.concat(Xi.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:e,session:t,file:n,type:s,readHeaders:i=!0,onProgress:o,onError:l,timeZone:a,isZip:d}){this.onFileCompleted=e,this.session=t,this.file=n,this.isZip=d,this.type=s,this.readHeaders=i,this.timeZone=a,this.onProgress=o,this.onError=l,this.tables=[],this.chunks=0,this.totalChunks=d?0:Math.ceil(n.size/La.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:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}onFileCompleted;session;file;isZip;type;readHeaders;timeZone;onProgress;onError;tables;headers;types;chunks;totalChunks;isComplete;zipProgress;consolidatedChunks;numConsolidated;isCancelled;config;cancel(){this.isCancelled=!0}transpose(e,t){const n=t.length,s=new Array(e).fill(null).map(()=>new Array(n));for(let i=0;i<n;i+=1){const o=t[i];if(o.length<e)throw new Error(`Insufficient columns. Expected ${e} but found ${o.length}
|
|
@@ -34,9 +34,9 @@ ${l} does not exist yet.`}if(s){const{widgetName:o}=this.props;return`${o} is un
|
|
|
34
34
|
${no.makeCirclePath(s,i,Dc)}
|
|
35
35
|
${no.makeCirclePath(o,l,Dc)}`,I=`link-select-clip-${a}`,x=Math.atan2(l-E,o-T),M=x-Ic+Math.PI,k=x+Ic+Math.PI,L=o+Math.cos(x)*xc,A=l+Math.sin(x)*xc,G=L+Math.cos(M)*Qo,j=A+Math.sin(M)*Qo,K=L+Math.cos(k)*Qo,H=A+Math.sin(k)*Qo,B=`${L},${A} ${G},${j} ${K},${H}`,ee=.25*s+.5*T+.25*o,V=.25*i+.5*E+.25*l,_=T-s+(o-T),Z=(E-i+(l-E))/_;let ae=20/Math.sqrt(1+Z**2),q=ae*Z,ne=ae*-1,ue=q*-1;Number.isFinite(Z)?Z>0?(ae*=-1,q*=-1,ne*=-1,ue*=-1,ne-=50-10*(Math.abs(g)%cs),ue+=10*(Math.abs(g)%cs),ae-=50-10*(Math.abs(g)%cs),q+=10*(Math.abs(g)%cs)):Z<0?(ne+=10*(Math.abs(g)%cs),ue+=10*(Math.abs(g)%cs),ae+=10*(Math.abs(g)%cs),q+=10*(Math.abs(g)%cs)):(ne=15,ue=10,ae=-25,q=10):(ne=10,ue=5,ae=10,q=-35);let Te="";t!==void 0&&(t==="startsWith"?Te="a*":t==="endsWith"?Te="*z":Te=F.getFilterOperatorString(t));const ye=h!=="chartLink"&&h!=="filterSource";return r.jsxs(r.Fragment,{children:[r.jsxs("svg",{className:z(e,{hovering:u}),children:[r.jsx("clipPath",{id:I,children:r.jsx("path",{d:R,clipRule:"evenodd"})}),r.jsx("path",{className:"link-select",d:y,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${I})`,"data-testid":"link-select"}),r.jsx("path",{className:"link-background",d:y}),r.jsx("path",{className:"link-foreground",d:y}),r.jsx("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),r.jsx("polygon",{className:"link-triangle",points:B})]}),d!=null&&n&&r.jsxs(r.Fragment,{children:[ye&&r.jsx(P,{kind:"primary",className:"btn-fab btn-operator",style:{top:V+(Z>=0?q:ue),left:ee+(Z>=0?ae:ne)},onClick:()=>{},icon:r.jsxs("div",{className:"fa-md fa-layers",children:[r.jsx("b",{children:Te}),r.jsx(X,{icon:Bn,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:r.jsx($n,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),r.jsx(P,{kind:"primary",className:"btn-fab btn-delete",style:{top:V+(Z<0?q:ue),left:ee+(Z<0?ae:ne)},onClick:this.handleDelete,icon:$t,tooltip:"Delete"})]})]})}}const FR=no;const ka=J.module("LinkerOverlayContent");class NR extends w.Component{static defaultProps={disabled:"false"};constructor(e){super(e),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=oe.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){ka.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)}dialogRef;getPointFromLinkPoint(e){const{panelManager:t}=this.props,{panelId:n,columnName:s}=e,i=t.getOpenedPanelById(n);if(i!=null){if(!Lu(i))throw new Error(`Panel does not have getCoordinateForColumn method: ${n}`);try{const l=i.getCoordinateForColumn(s);if(l!=null)return l}catch{ka.error("Could not get coordinate for column",s,i)}}const o=t.getContainerByPanelId(n);if(o==null)throw new Error(`Unable to find panel container for id: ${n}`);return W.getTabPoint(o)}handleOperatorChanged(e,t){const{links:n,onLinksUpdated:s}=this.props,i=n.map(o=>o.id===e?{...o,operator:t}:o);s(i)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const t=this.dialogRef.current.getBoundingClientRect(),n=Oe(e.x,0,window.innerWidth-t.width),s=Oe(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:s}})}}handleMouseMove(e){const{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect(),i=Oe(window.innerWidth-(e.clientX+s.width+t.x),0,window.innerWidth-s.width),o=Oe(window.innerHeight-(e.clientY+s.height+t.y),0,window.innerHeight-s.height);this.setState({dialog:{x:i,y:o}})}}handleMouseDown(e){const t={x:0,y:0};if(this.dialogRef.current){const 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"){const{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(s=>n(s))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:t,selectedIds:n,messageText:s,onLinkSelected:i,onLinkDeleted:o,onAllLinksDeleted:l,onDone:a}=this.props,{mouse:d,dialog:h,isDragging:u,mode:m}=this.state,g=t.map(p=>{try{const{id:f,type:C,isReversed:S,start:b,end:v,operator:T}=p,E=b.columnType;let[y,R]=this.getPointFromLinkPoint(b),I=d?.x??y,x=d?.y??R;if(v!=null&&([I,x]=this.getPointFromLinkPoint(v)),S!=null&&S){const[k,L]=[y,R];[y,R]=[I,x],[I,x]=[k,L]}const M=z("linker-link",{disabled:e},{"link-filter-source":C==="filterSource"},{"link-invalid":C==="invalid"},{interactive:p.end==null},{"link-is-selected":n.has(f)},{"danger-delete":m==="delete"});return{x1:y,y1:R,x2:I,y2:x,id:f,className:M,operator:T,startColumnType:E,type:C}}catch(f){return ka.warn("Unable to get point for link",p,f),null}}).filter(p=>p!=null);return r.jsxs("div",{className:z("linker-overlay",{"danger-delete":m==="delete"}),children:[g.map(({x1:p,y1:f,x2:C,y2:S,id:b,className:v,operator:T,startColumnType:E,type:y})=>r.jsx(FR,{className:v,id:b,x1:p,y1:f,x2:C,y2:S,onClick:i,onDelete:o,isSelected:n.has(b),operator:T,startColumnType:E,type:y,onOperatorChanged:this.handleOperatorChanged},b)),r.jsxs("div",{className:z("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:h?.y,right:h?.x},"data-testid":"linker-toast-dialog",children:[r.jsx(P,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:Bl,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&r.jsx(Je,{children:"Drag to reposition"})}),r.jsx("div",{className:"toast-body",children:s}),r.jsxs("div",{className:"toast-footer",children:[r.jsx(P,{kind:"secondary",onClick:l,children:"Clear All"}),r.jsx(P,{kind:"primary",onClick:a,children:"Done"})]})]}),r.jsx(te,{actions:[{action:this.handleEscapePressed,shortcut:Yn.LINKER_CLOSE,isGlobal:!0}]})]})}}const kR=NR,dt=J.module("Linker"),MR=(c,e)=>({activeTool:ql(c),dh:Kl(c),isolatedLinkerPanelId:zr(c,e.localDashboardId),links:Fi(c,e.localDashboardId),timeZone:go(c)}),AR=mt(MR,{setActiveTool:Zl,setDashboardLinks:Yr,addDashboardLinks:ry,deleteDashboardLinks:dy,setDashboardIsolatedLinkerPanelId:Nu,setDashboardColumnSelectionValidator:cy});class OR extends w.Component{constructor(e){super(e),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(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{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){dt.error("componentDidCatch",e,t)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:t}=e;t.on(cn.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(cn.DATA_SELECTED,this.handleUpdateValues),t.on(cn.STATE_CHANGED,this.handleStateChange),t.on(qa.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(Se.CLONED,this.handlePanelCloned),t.on(Ke.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Ke.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(Se.CLOSE,this.handlePanelClosed),t.on(Se.CLOSED,this.handlePanelClosed),t.on(Se.DRAGGING,this.handlePanelDragging),t.on(Se.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:t}=e;t.off(cn.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(cn.DATA_SELECTED,this.handleUpdateValues),t.off(cn.STATE_CHANGED,this.handleStateChange),t.off(qa.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(Se.CLONED,this.handlePanelCloned),t.off(Ke.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Ke.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(Se.CLOSE,this.handlePanelClosed),t.off(Se.CLOSED,this.handlePanelClosed),t.off(Se.DRAGGING,this.handlePanelDragging),t.off(Se.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:t}=this.props;t(At.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(At.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){dt.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:n,localDashboardId:s,setActiveTool:i,setDashboardIsolatedLinkerPanelId:o}=this.props,l=W.getIdFromPanel(e),a=n.filter(d=>d.start?.panelId===l||d.end?.panelId===l);if(!this.isOverlayShown()&&l!=null){i(At.LINKER),o(s,l),a.length===0&&this.columnSelected(e,t,!0,l);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){dt.debug("handleColumnsChanged",e,t);const{links:n}=this.props,s=W.getIdFromPanel(e);if(s==null){dt.error("Invalid panelId",e);return}const i=n.filter(({start:o,end:l})=>o.panelId===s&&di.findColumn(t,o)==null||l!=null&&l.panelId===s&&di.findColumn(t,l)==null);this.deleteLinks(i)}handleGridColumnSelect(e,t){if(!Ec(t)){dt.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t,n=!1,s){if(s===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:i}=this.props,{linkInProgress:o}=this.state,l=W.getIdFromPanel(e);if(l==null)return;const a=W.getComponentNameFromPanel(e),{name:d,type:h}=t;if(o==null||o.start==null){const u={id:Ue.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:h},type:"invalid",isReversed:n};dt.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:g,isReversed:p}=o,f={panelId:l,panelComponent:a,columnName:d,columnType:h},C=di.getLinkType(p!==void 0&&p?f:m,p!==void 0&&p?m:f,s??i);switch(C){case"invalid":dt.debug("Ignore invalid link connection",o,f);return;case"filterSource":{const b=p!==void 0&&p?m.panelId:f.panelId,v=u.filter(({end:T})=>T?.panelId===b);this.deleteLinks(v);break}case"chartLink":{const b=p===!0?m:f,v=p===!0?f:m;dt.debug("creating chartlink",{existingLinkEnd:b,start:m,end:f});const T=u.filter(({end:E,start:y})=>y?.panelId===v.panelId&&E?.panelId===b.panelId&&E?.columnName===b.columnName&&E?.columnType===b.columnType);this.deleteLinks(T);break}}const S={start:p!==void 0&&p?f:m,end:p!==void 0&&p?m:f,id:g,type:C,operator:de.eq};dt.info("creating link",S),this.setState({linkInProgress:void 0,selectedIds:new Set([g])},()=>{this.addLinks([S])})}}unsetFilterValueForLink(e){const{panelManager:t}=this.props;if(e.end){const{end:n}=e,{panelId:s,columnName:i,columnType:o}=n,l=t.getOpenedPanelById(s);l?Tc(l)?l.unsetFilterValue(i,o):dt.debug("endPanel.unsetFilterValue not implemented",l):dt.debug("endPanel no longer exists, ignoring unsetFilterValue",s)}}setPanelFilterMap(e,t){dt.debug("Set filter data for panel:",e,t);const{panelManager:n}=this.props,s=n.getOpenedPanelById(e);s?Tc(s)?s.setFilterMap(t):dt.debug("panel.setFilterMap not implemented",e,s):dt.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e,t=!1){const{localDashboardId:n}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){const{setDashboardLinks:s}=this.props;s(n,[])}else if(e.length>0){const{deleteDashboardLinks:s}=this.props;s(n,e.map(({id:i})=>i))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{const n=e.filter(s=>s?.start?.panelId===t||s?.end?.panelId===t);this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){const{links:t}=this.props,n=t.find(s=>s.id===e);n?this.deleteLinks([n]):dt.error("Unable to find link to delete",e)}handleUpdateValues(e,t){const n=W.getIdFromPanel(e),{dh:s,links:i,timeZone:o}=this.props,l=new Map;for(let a=0;a<i.length;a+=1){const{start:d,end:h,operator:u}=i[a];if(d.panelId===n&&h!=null){const{panelId:m,columnName:g,columnType:p}=h,f=l.has(m)?l.get(m):new Map,C=f.has(g)===!0?f.get(g).filterList:[],{visibleIndex:S,isExpandable:b,isGrouped:v}=t[d.columnName];let{value:T}=t[d.columnName],E=`${T}`;T===null&&b&&v&&(T=void 0),p!=null&&F.isDateType(p)&&(E=new it(s,{timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Xs.FULL_DATE_FORMAT}).format(T));const y={operator:u,text:E,value:T,startColumnIndex:S};C.push(y),f.set(g,{columnType:p,filterList:C}),l.set(m,f)}}l.forEach((a,d)=>{this.setPanelFilterMap(d,a)})}handlePanelCloned(e,t){const{links:n}=this.props,s=W.getIdFromPanel(e),i=t.id;if(s!=null){const o=di.cloneLinksForPanel(n,s,i);this.addLinks(o)}}handlePanelDragging(e){const{links:t}=this.props;for(let n=0;n<t.length;n+=1){const s=t[n],{start:i,end:o}=s;if(i.panelId===e||o?.panelId===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){dt.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){const{links:t}=this.props;for(let n=0;n<t.length;n+=1){const s=t[n],{start:i,end:o,id:l}=s;(i.panelId===e||o?.panelId===e)&&this.handleLinkDeleted(l)}}getCachedLinks=he((e,t,n)=>{const s=[...e];return t!=null&&t.start!=null&&s.push(t),n!==void 0?s.filter(i=>i?.start?.panelId===n||i?.end?.panelId===n||i?.end==null):s});isOverlayShown(){const{activeTool:e}=this.props;return e===At.LINKER}updateSelectionValidators(){const{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(e="invalid"){this.setState(({linkInProgress:t})=>t!==void 0?{linkInProgress:{...t,type:e}}:null)}isColumnSelectionValid(e,t){const{linkInProgress:n}=this.state,{isolatedLinkerPanelId:s}=this.props;if(t==null)return n?.start!=null&&this.updateLinkInProgressType(),!1;if(!Ec(t))return dt.debug2("Column is not filterable",t.description),n?.start!=null&&this.updateLinkInProgressType("invalid"),!1;if(n?.start==null)return!0;const{isReversed:i,start:o}=n,l=W.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:W.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},d=i!==void 0&&i?di.getLinkType(a,o,s):di.getLinkType(o,a,s);return this.updateLinkInProgressType(d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:s,selectedIds:i,isDraggingPanel:o}=this.state,l=this.isOverlayShown(),a=s!=null&&s.start!=null,d=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 o?null:r.jsx(Bt,{in:l,timeout:Ye.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:r.jsx(kR,{disabled:a,panelManager:n,links:this.getCachedLinks(e,s,t),selectedIds:i,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const LR=AR(OR),_R=LR;function PR(c){Es(c);const{id:e,layout:t,panelManager:n}=c;return r.jsx(_R,{layout:t,localDashboardId:e,panelManager:n})}class Al{static DEFAULT_TITLE="Note";static DEFAULT_CONTENT=`# Markdown Note
|
|
36
36
|
|
|
37
|
-
This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${Al.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${Al.DEFAULT_TITLE}-${n}`;return t}}const Ma=Al;function jR(c){Es(c);const{id:e,layout:t,panelManager:n,registerComponent:s}=c,i=w.useCallback(l=>{const{title:a,componentState:d,props:h}=l;let{panelState:u=null}=h;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===Ma.DEFAULT_CONTENT?null:Ir(l)},[]),o=w.useCallback(({title:l="",metadata:a={},id:d=Ue.generate(),focusElement:h=W.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const g=n.getOpenedPanelConfigsOfType($i.COMPONENT),p=n.getClosedPanelConfigsOfType($i.COMPONENT),f=g.map(T=>T.title??""),C=l!=null&&l!==""?l:Ma.getNewMarkdownTitle(f),S=p.length>0?null:Ma.DEFAULT_CONTENT,b={type:"react-component",component:$i.COMPONENT,props:{id:d,metadata:a,panelState:{content:S},localDashboardId:e},title:C,id:d},{root:v}=t;W.openComponent({root:v,config:b,focusElement:h,createNewStack:u,dragEvent:m})},[e,t,n]);return w.useEffect(function(){const a=[s($i.COMPONENT,$i,Dr,i)];return()=>{a.forEach(d=>d())}},[i,s]),Ae(t.eventHub,Du.OPEN,o),null}function HR(c){Es(c);const{hydrate:e,id:t,layout:n,registerComponent:s}=c,i=Qs(),o=w.useCallback(({dragEvent:l,fetch:a,panelId:d=Ue.generate(),widget:h})=>{const{name:u,type:m}=h;if(m!==i.VariableType.PANDAS)return;const g={name:u,table:u},p=()=>a().then(S=>Br.makeModel(i,S)),f={type:"react-component",component:Na.COMPONENT,props:{localDashboardId:t,id:d,metadata:g,makeModel:p},title:u,id:d},{root:C}=n;W.openComponent({root:C,config:f,dragEvent:l})},[i,t,n]);return w.useEffect(function(){const a=[s(Na.COMPONENT,Na,e)];return()=>{a.forEach(d=>d())}},[e,s]),Ae(n.eventHub,Se.OPEN,o),null}class UR{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}const fs=UR;class Fc{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){const t=[],n=[];return e.forEach((s,i)=>{t.push(s),i>0&&n.push(Un.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=Un.and){return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,n,...t.filterOperators]}}static makeFilterItem(e,t,n){return{columnName:e,type:t,value:n}}}function VR(c,e,t){if(c.length>e){const n=c.length-t;return{toKeep:c.slice(n),toPrune:c.slice(0,n)}}return{toKeep:c,toPrune:[]}}const Aa=J.module("PouchStorageTable"),BR="Deephaven.";Uc.plugin(Cm);function $R(c,e){switch(c){case de.in:case de.contains:return{$regex:new RegExp(`${e}`)};case de.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case de.eq:return{$eq:e};case de.notEq:return{$neq:e};case de.greaterThan:return{$gt:e};case de.greaterThanOrEqualTo:return{$gte:e};case de.lessThan:return{$lt:e};case de.lessThanOrEqualTo:return{$lte:e};case de.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${c}`)}}function WR(c){const{filterItems:e,filterOperators:t}=c;let n=null;for(let s=0;s<e.length;s+=1){const i=e[s],{columnName:o,type:l,value:a}=i,d={[o]:$R(l,a)};if(s===0)n=d;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===Un.and)n={$and:[n,d]};else if(h===Un.or)n={$or:[n,d]};else throw new Error(`Unexpected filter operator ${h}, ${d}`)}}if(n==null)throw new Error(`Invalid filter config ${c}`);return n}function Oa(c=[]){return{$and:[...c.map(e=>WR(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function GR(c,e=!1){return[{id:e?"desc":"asc"},...c?.map(t=>({[t.column]:t.direction}))??[]]}class zR{db;changes;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e,t){this.db=new Uc(`${BR}${e}`,t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(n=>n!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const t={...e,_id:e.id};return await this.db.put(t),t}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}sendItemUpdate(e){const t=this.itemListeners.get(e.id);if(t!==void 0)for(let n=0;n<t.length;n+=1)t[n](e)}dbUpdate(e){Aa.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async fetchInfo(e){return this.db.find({selector:e,fields:[]})}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=be.makeCancelable(this.fetchInfo(Oa(this.currentFilter??[])));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!be.isCanceled(e))throw Aa.error("Unable to refreshInfo",e),e}}async fetchViewportData(e,t,n){return this.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top}))}async refreshData(){if(this.currentViewport)try{const e=Oa(this.currentFilter??[]),t=GR(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=be.makeCancelable(this.fetchViewportData(this.currentViewport,e,t));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!be.isCanceled(e))throw Aa.error("Unable to refreshData",e),e}}async refreshItem(e){const n=(await this.db.find({selector:{id:e},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(e){const t=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([s,i])=>{const o=i-s+1;return this.db.find({selector:Oa(this.currentFilter??[]),skip:s,limit:o,sort:n,fields:["id","name"]}).then(l=>{for(let a=0;a<o;a+=1){const d=s+a;t.set(d,l.docs[a])}})})),t}}const KR=zR,YR=2500,qR=2e3,Xt=J.module("PouchCommandHistoryTable");class XR extends KR{constructor(e,t){super(`CommandHistoryStorage.${e}`,{auto_compaction:!0,revs_limit:1}),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),Xt.debug("Adding table to registry",this.cacheKey),this.cache.tableRegistry.get(this.cacheKey)?.add(this)}searchText;get cacheKey(){return this.db.name}setSearch(e){Xt.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[Fc.makeFilterConfig([Fc.makeFilterItem("name",de.contains,e)])]:[])}dbUpdate(e){Xt.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}async fetchData(e){return be.withTimeout(0,async()=>{this.cache.response.has(this.cacheKey)?Xt.debug("Fetching from cache",this.searchText,this.viewport):(Xt.debug("Fetching from PouchDB",this.searchText,this.viewport),this.cache.response.set(this.cacheKey,this.db.allDocs({include_docs:!0}).then(n=>{const s=n.rows.map(l=>l.doc).filter(({name:l})=>l);Xt.debug(`Fetched ${s.length} command history items`);const{toKeep:i,toPrune:o}=VR(s,YR,qR);return o.length&&this.pruneItems(o),{docs:i}})));const t=this.cache.response.get(this.cacheKey);return this.searchText==null||this.searchText===""?t:{...t,docs:(await t).docs.filter(({name:n})=>n.toLowerCase().includes(this.searchText))}})}async fetchInfo(e){return this.fetchData(e)}async fetchViewportData(e,t,n){const s=await this.fetchData(t);return Xt.debug("Fetching viewport data",e.top,e.bottom+1,n,s),{items:(typeof n[0]=="object"&&n[0].id==="desc"?s.docs.slice(0).reverse():s.docs).slice(e.top,e.bottom+1),offset:e.top}}async pruneItems(e){if(this.cache.isPruning.get(this.cacheKey)===!0){Xt.debug("Pruning already in progress. Skipping.");return}try{Xt.debug(`Pruning ${e.length} command history items`);const t=this.cache.pauseChangeListeners(this.cacheKey);this.cache.isPruning.set(this.cacheKey,!0),await this.db.bulkDocs(e.map(n=>({...n,_deleted:!0}))),this.cache.isPruning.set(this.cacheKey,!1),t(),Xt.debug("Finished pruning command history items")}catch(t){Xt.error("An error occurred while pruning db",t)}}close(){Xt.debug("Closing table",this,this.cache.tableRegistry.get(this.cacheKey)?.size),this.cache.tableRegistry.get(this.cacheKey)?.delete(this),this.changes?.cancel(),super.close()}}const Nc=XR,kc=J.module("PouchCommandHistoryCache");class ZR{constructor(){this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}isPruning;response;tableRegistry;pauseChangeListeners(e){const t=[];return this.tableRegistry.get(e)?.forEach(n=>{n.changes&&(kc.debug(`Pausing event listeners on '${e}' table`,n),n.changes.cancel(),t.push(n))}),()=>{t.forEach(n=>{(this.tableRegistry.get(e)?.has(n)??!1)&&(kc.debug(`Resuming event listeners on '${e}' table`,n),n.listenForChanges())})}}}const QR=ZR,Mc=J.module("PouchCommandHistoryStorage");class JR{cache=new QR;updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Nc(e,this.cache)),this.updateTableMap.get(e)}async getTable(e){return new Nc(e,this.cache)}async addItem(e,t,n,s){return this.updateItem(e,{id:`${new Date().getTime()}`,name:n,data:s})}async updateItem(e,t){const n=this.getUpdateTable(e),i={...await n.refreshItem(t.id)??{},...t};return Mc.debug("Updating item",i),await n.put(i),Mc.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const ju="SET_LAYOUT_STORAGE",ex=c=>({type:ju,payload:c}),{dh:tx}=globalThis,_t=tx,Hu=""+new URL("community-wordmark-app-d2c5c1eb.svg",import.meta.url).href;const nx=J.module("SettingsUtils");function sx(c){return c.formatString!=null}function Ja(c){const e=c?.querySelector("input, select, textarea");e&&e.focus()}function Uu(c,e){return c.defaultFormatString===e.defaultFormatString}function ix(c,e){return Uu(c,e)}function ox(c,e){return Uu(c,e)}function Vu(c){return c!==""&&Ii.isValidColumnName(c)}function Cs(c,e,t){if(!e||t.formatString==null||!sx(t))return!1;switch(e){case"datetime":return it.isValid(c,t);case"decimal":return We.isValid(c,t);case"int":return st.isValid(c,t);default:return nx.warn("Trying to validate format of unknown type"),!0}}function Bu(c){const{id:e,isNewRule:t,...n}=c;return n}function $u(c,e){return Vu(e.columnName)&&Cs(c,e.columnType,e.format)}function Wu(c){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=c,l=Qs(),a=w.useMemo(()=>new gn(l,[],{timeZone:t,showTimeZone:n,showTSeparator:s}),[l,n,s,t]),d=i?it.getGlobalFormats(n,s):it.getFormats(n,s);return o!=null&&!d.includes(o)&&d.unshift(o),r.jsx(r.Fragment,{children:d.map(h=>{const u=it.makeFormat("",h,it.TYPE_GLOBAL);return r.jsx("option",{value:h,"data-testid":"time-format",children:a.getFormattedString(e,F.dataType.DATETIME,"",u)},h)})})}function lx(){return r.jsx(r.Fragment,{children:_l.TIME_ZONES.map(c=>{const{label:e,value:t}=c;return r.jsx("option",{value:t,children:e},t)})})}const _s=J.module("FormattingSectionContent");class td extends w.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:it.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:st.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:it.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ge(this.commitChanges.bind(this),td.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:l,timeZone:a,truncateNumbersWithPound:d}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=oe.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:l,timeZone:a,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:d,timestampAtMenuOpen:new Date}}componentDidMount(){Ja(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=we((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return r.jsx(Wu,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){_s.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){_s.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){_s.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s}=e;_s.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;_s.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;_s.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;_s.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:l,truncateNumbersWithPound:a}=this.state,{dh:d}=this.props,h=e.filter(p=>$u(d,p)).map(Bu)??[],{settings:u,saveSettings:m}=this.props,g={...u,formatter:h,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:a};Cs(d,F.dataType.DECIMAL,We.makeCustomFormat(o.defaultFormatString))&&(g.defaultDecimalFormatOptions=o),Cs(d,F.dataType.INT,st.makeCustomFormat(l.defaultFormatString))&&(g.defaultIntegerFormatOptions=l),m(g)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,timeZone:o,showTimeZone:l,showTSeparator:a,truncateNumbersWithPound:d}=this.state,{defaultFormatString:h=We.DEFAULT_FORMAT_STRING}=s??{},{defaultFormatString:u=st.DEFAULT_FORMAT_STRING}=i??{},m=o===e.timeZone,g=a===e.showTSeparator&&l===e.showTimeZone&&n===e.defaultDateTimeFormat,p=ix(s,e.defaultDecimalFormatOptions),f=ox(i,e.defaultIntegerFormatOptions);return r.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:r.jsxs("div",{className:"container-fluid p-0",children:[r.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),r.jsx("div",{className:"col pr-0",children:r.jsx("select",{className:"custom-select",value:o,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:r.jsx(lx,{})})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:z("btn-reset","btn-reset-time-zone",{hidden:m})})})]}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),r.jsx("div",{className:"col pr-0",children:r.jsx("select",{className:"custom-select",value:n,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(o,l,a,!0,n)})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:z("btn-reset","btn-reset-date-time",{hidden:g})})})]}),r.jsx("div",{className:"form-row",children:r.jsx("div",{className:"offset-3 col-9",children:r.jsx(tn,{checked:l??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),r.jsx("div",{className:"form-row mb-3",children:r.jsx("div",{className:"offset-3 col-9",children:r.jsx(tn,{checked:a??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),r.jsx("div",{className:"col pr-0",children:r.jsx("input",{className:z("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Cs(t,F.dataType.DECIMAL,We.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:We.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:z("btn-reset","btn-reset-decimal",{hidden:p}),"data-testid":"btn-reset-decimal"})})]}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),r.jsx("div",{className:"col pr-0",children:r.jsx("input",{className:z("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Cs(t,F.dataType.INT,st.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:st.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:z("btn-reset","btn-reset-integer",{hidden:f}),"data-testid":"btn-reset-integer"})})]}),r.jsx("div",{className:"form-row mb-3",children:r.jsx("div",{className:"offset-3 col-9",children:r.jsx(tn,{checked:d??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const ax=c=>({formatter:vh(c),defaultDateTimeFormat:Sh(c),defaultDecimalFormatOptions:bh(c),defaultIntegerFormatOptions:wh(c),dh:Kl(c),showTimeZone:Th(c),showTSeparator:Eh(c),truncateNumbersWithPound:yh(c),timeZone:go(c),settings:gt(c)}),rx=mt(ax,{saveSettings:Xl})(td);function dx(){const[c,e]=w.useState(!1),t=()=>{e(!c)};return r.jsxs(P,{kind:"ghost",onClick:t,icon:Vg,children:["Legal Notices",r.jsxs($l,{isOpen:c,toggle:t,className:"theme-bg-light",children:[r.jsx(Wl,{toggle:t,children:"Legal Notice"}),r.jsxs(Gl,{children:[r.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,494; 9,836,495; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,346,394; 10,353,893; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; 10,783,191; 10,866,943; 10,909,183; 10,915,526; 10,922,311; 10,929,394; 11,023,462; 11,126,662; 11,151,133; 11,238,036; 11,249,994; 11,263,211; 11,449,557; 11,514,037; 11,556,528; and 11,574,018. Other patents pending."}),r.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function so(c){const{children:e,isExpanded:t,sectionKey:n,title:s,onToggle:i}=c;return r.jsxs(r.Fragment,{children:[r.jsx("div",{children:r.jsxs(P,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>i(n),children:[r.jsx("div",{className:"flex-grow-1",children:s}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(X,{transform:t?"flip-v":"",icon:Bn})})]})}),r.jsx(Mm,{in:t,autoFocusOnShow:!0,children:e})]})}so.propTypes={children:U.node,isExpanded:U.bool.isRequired,sectionKey:U.string.isRequired,title:U.node.isRequired,onToggle:U.func};so.defaultProps={children:null,onToggle:()=>{}};function cx({shortcut:c,displayText:e,categoryName:t,onChange:n}){const[s,i]=w.useState(e),[o,l]=w.useState(c.getKeyState()),[a,d]=w.useState(!1),[h,u]=w.useState("");w.useEffect(function(){i(e),l(c.getKeyState())},[e,c]),w.useEffect(function(){i(nn.getDisplayText(o)),c.matchesKeyState(o)&&d(!1)},[o,c]),w.useEffect(function(){if(a){if(!nn.isValidKeyState(o)){nn.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=He.getConflictingShortcuts(o).filter(E=>E.id.startsWith(t)&&E!==c).map(E=>E.name);if(T.length){u(`Conflicts with ${T.join(", ")}`);return}u("")}else u("")},[a,o,t,c]);function m(v){if(v.stopPropagation(),v.preventDefault(),c.isEditable&&!v.repeat){const T=nn.getKeyStateFromEvent(v),E=nn.createKeyState([ve.BACKSPACE]);nn.doKeyStatesMatch(T,E)?l(nn.NULL_KEY_STATE):l(T)}}function g(v){v.stopPropagation(),v.preventDefault(),c.matchesKeyState(o)||d(!0)}function p(){ws.disableAllActions()}function f(){ws.enableAllActions()}function C(){c.setKeyState(o),d(!1),n(c)}function S(){const v=c.getKeyState();l(v),d(!1)}function b(){d(!0),l(c.getDefaultKeyState())}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"shortcut-item-container",children:[r.jsxs("label",{className:"shortcut-item-name",children:[c.name,c.tooltip!==void 0&&r.jsx(Je,{children:c.tooltip})]}),r.jsxs("div",{className:"shortcut-item-input-container",children:[r.jsx("input",{className:z("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:g,onFocus:p,onBlur:f,disabled:!c.isEditable,value:s,readOnly:!0}),!nn.doKeyStatesMatch(o,c.getDefaultKeyState())&&!h&&r.jsx(P,{className:"reset-to-default-button",kind:"ghost",icon:r.jsx(X,{icon:Ws,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:b})]})]}),a&&r.jsxs("div",{className:z("shortcut-item-message-container",{"is-invalid":h}),children:[r.jsx("div",{className:"shortcut-item-message",children:h}),r.jsxs("div",{className:"shortcut-item-message-buttons",children:[nn.isValidKeyState(o)&&r.jsx(P,{kind:"ghost",onClick:C,children:"Confirm"}),r.jsx(P,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function hx({shortcutOverrides:c={},settings:e,saveSettings:t}){const n=w.useCallback(l=>{const a=nn.isMacPlatform,d={mac:{...c.mac},windows:{...c.windows}},h=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),t({...e,shortcutOverrides:d})},[e,t,c]);let s=Array.from(He.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const i=s.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),o=s.splice(i,1);return s=s.concat(o),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(l=>r.jsx(ux,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:n},l.name))]})}function ux({name:c,shortcuts:e,saveShortcutOverrides:t}){function n(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[s,i]=w.useState(e);function o(a){const d=s.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const h=[a,...d];t(h),i(u=>[...u])}const l=w.useMemo(()=>s.map(a=>a.getDisplayText()),[s]);return r.jsxs("div",{className:"mt-3",children:[r.jsx("div",{className:"font-weight-bold",children:n(c)}),s.map((a,d)=>r.jsx(cx,{shortcut:a,displayText:l[d],categoryName:c,onChange:o},a.id))]})}const mx=c=>({settings:gt(c),shortcutOverrides:rC(c)}),gx={saveSettings:Xl},px=mt(mx,gx)(hx),fx="yyyy-MM-dd-HHmmss";function Gu(c,e="root",t=new Map([[c,""]])){const n={};return Object.entries(c).forEach(([s,i])=>{try{JSON.stringify(i),n[s]=i}catch{const l=i;if(typeof i=="bigint")n[s]=i.toString();else if(t.has(l))n[s]=`Circular ref to ${t.get(l)}`;else{const a=`${e}.${s}`;t.set(l,a),n[s]=Gu(i,a,t)}}}),n}function Cx(){const c=Tr.getState();return JSON.stringify(Gu(c),null,2)}function Sx(c){const e={uiVersion:"0.40.0",userAgent:navigator.userAgent,...c};return JSON.stringify(e,null,2)}async function bx(c=`${_t.i18n.DateTimeFormat.format(fx,new Date)}_support_logs`,e){const t=new Vc,n=t.folder(c);n.file("console.txt",Bg.getFormattedHistory()),n.file("redux.json",Cx()),n.file("metadata.json",Sx(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${c}.zip`,i.click()}const wx=[{value:F.dataType.DATETIME,label:"DateTime"},{value:F.dataType.DECIMAL,label:"Decimal"},{value:F.dataType.INT,label:"Integer"}];function vx(){const c=wx.map(e=>r.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return r.jsxs(r.Fragment,{children:[r.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),c]})}class nd extends w.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:it.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:st.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:it.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ge(this.commitChanges.bind(this),nd.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:l,timeZone:a,truncateNumbersWithPound:d}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=oe.createRef(),this.addFormatRuleButtonRef=oe.createRef(),this.lastFormatRuleIndex=h.length,this.state={formatSettings:h,formatRulesChanged:!1,showTimeZone:o,showTSeparator:l,timeZone:a,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:d,timestampAtMenuOpen:new Date}}componentDidMount(){Ja(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(n=>n.id!==e.id&&n.columnName===e.columnName&&n.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=we(()=>r.jsx(vx,{}));getCachedDateTimeFormatOptions=we((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return r.jsx(Wu,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;D(i);const o=[...i];let l={};t==="columnType"&&(l={format:""});const a={...o[e],...l,[t]:n};return o[e]=a,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,n={columnType:F.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,n],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:n}=t;return{formatSettings:n.filter((i,o)=>o!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Ja(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:l,truncateNumbersWithPound:a}=this.state,{dh:d}=this.props,h=e.filter(p=>$u(d,p)).map(Bu)??[],{settings:u,saveSettings:m}=this.props,g={...u,formatter:h,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:a};Cs(d,F.dataType.DECIMAL,We.makeCustomFormat(o.defaultFormatString))&&(g.defaultDecimalFormatOptions=o),Cs(d,F.dataType.INT,st.makeCustomFormat(l.defaultFormatString))&&(g.defaultIntegerFormatOptions=l),m(g)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const{dh:t}=this.props,n={hasColumnNameError:!1,hasFormatError:!1,message:""},s=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(n.hasColumnNameError=!0,s.push("Duplicate column name/type combo.")),Vu(e.columnName)||(n.hasColumnNameError=!0,s.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(n.hasFormatError=!0,s.push("Empty formatting rule.")):Cs(t,e.columnType,e.format)||(n.hasFormatError=!0,s.push("Invalid formatting rule.")),n.message=s.join(`
|
|
38
|
-
`)),n}renderFormatRule(e,t){const n=`input-${e}-columnName`,s=`input-${e}-columnType`,i=`input-${e}-format`,o=this.getCachedColumnTypeOptions(),l=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),a=()=>this.handleFormatRuleChange(e,"isNewRule",!1),d=u=>this.handleFormatRuleChange(e,"columnType",u.target.value),h=this.getRuleError(t);return r.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[r.jsxs("div",{className:"form-row",children:[r.jsxs("div",{className:"form-group col-7 mb-2",children:[r.jsx("label",{htmlFor:n,children:"Column Name"}),r.jsx("input",{id:n,className:z("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:l,onBlur:a})]}),r.jsxs("div",{className:"form-group col mb-2",children:[r.jsx(P,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:$t,tooltip:"Delete","aria-label":"Delete Format Rule"}),r.jsx("label",{htmlFor:s,children:"Column Type"}),r.jsx("select",{id:s,className:"custom-select",value:t.columnType,onChange:d,children:o})]})]}),r.jsx("div",{className:"form-row",children:r.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[r.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),r.jsx("div",{className:"form-row",children:r.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&r.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,n,s,i){switch(F.getNormalizedType(t)){case F.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,n,s,i);case F.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,n,s,i);case F.dataType.INT:return this.renderIntegerFormatRuleInput(e,n,s,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:l}=this.state,a=n.formatString??"";return r.jsxs("select",{className:z("custom-select",{"is-invalid":s}),value:a,id:t,onChange:d=>{const h=it.makeFormat("",d.target.value,it.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[r.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(l,i,o)]})}renderIntegerFormatRuleInput(e,t,n,s){const i=n.formatString??"";return r.jsx("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:st.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const l=st.makeFormat("",o.target.value,st.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",l)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return r.jsx("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:We.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const l=We.makeFormat("",o.target.value,We.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",l)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>r.jsx(Bt,{classNames:"fade",timeout:Ye.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=r.jsx(P,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:vs,children:"Add New Rule"});return r.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[r.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),r.jsx(Sm,{appear:e,enter:e,exit:e,children:n}),s]})}}const Tx=c=>({formatter:vh(c),defaultDateTimeFormat:Sh(c),defaultDecimalFormatOptions:bh(c),defaultIntegerFormatOptions:wh(c),dh:Kl(c),showTimeZone:Th(c),showTSeparator:Eh(c),truncateNumbersWithPound:yh(c),timeZone:go(c),settings:gt(c)}),Ex=mt(Tx,{saveSettings:Xl})(nd);class Rn extends w.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.handleLogout=this.handleLogout.bind(this),this.menuContentRef=oe.createRef(),this.broadcastChannel=new BroadcastChannel(Am),this.state={expandedSectionKey:Rn.FORMATTING_SECTION_KEY}}componentDidMount(){Rn.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}menuContentRef;broadcastChannel;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(Om(Lm))}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;bx(void 0,Object.fromEntries(e))}render(){const e="0.40.
|
|
37
|
+
This note can be edited using **markdown** for styling.`;static getNewMarkdownTitle(e){let t=`${Al.DEFAULT_TITLE}`,n=0;for(;e.indexOf(t)>=0;)n+=1,t=`${Al.DEFAULT_TITLE}-${n}`;return t}}const Ma=Al;function jR(c){Es(c);const{id:e,layout:t,panelManager:n,registerComponent:s}=c,i=w.useCallback(l=>{const{title:a,componentState:d,props:h}=l;let{panelState:u=null}=h;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===Ma.DEFAULT_CONTENT?null:Ir(l)},[]),o=w.useCallback(({title:l="",metadata:a={},id:d=Ue.generate(),focusElement:h=W.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const g=n.getOpenedPanelConfigsOfType($i.COMPONENT),p=n.getClosedPanelConfigsOfType($i.COMPONENT),f=g.map(T=>T.title??""),C=l!=null&&l!==""?l:Ma.getNewMarkdownTitle(f),S=p.length>0?null:Ma.DEFAULT_CONTENT,b={type:"react-component",component:$i.COMPONENT,props:{id:d,metadata:a,panelState:{content:S},localDashboardId:e},title:C,id:d},{root:v}=t;W.openComponent({root:v,config:b,focusElement:h,createNewStack:u,dragEvent:m})},[e,t,n]);return w.useEffect(function(){const a=[s($i.COMPONENT,$i,Dr,i)];return()=>{a.forEach(d=>d())}},[i,s]),Ae(t.eventHub,Du.OPEN,o),null}function HR(c){Es(c);const{hydrate:e,id:t,layout:n,registerComponent:s}=c,i=Qs(),o=w.useCallback(({dragEvent:l,fetch:a,panelId:d=Ue.generate(),widget:h})=>{const{name:u,type:m}=h;if(m!==i.VariableType.PANDAS)return;const g={name:u,table:u},p=()=>a().then(S=>Br.makeModel(i,S)),f={type:"react-component",component:Na.COMPONENT,props:{localDashboardId:t,id:d,metadata:g,makeModel:p},title:u,id:d},{root:C}=n;W.openComponent({root:C,config:f,dragEvent:l})},[i,t,n]);return w.useEffect(function(){const a=[s(Na.COMPONENT,Na,e)];return()=>{a.forEach(d=>d())}},[e,s]),Ae(n.eventHub,Se.OPEN,o),null}class UR{static DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";static INPUT_FILTER="ControlType.INPUT_FILTER";static MARKDOWN="ControlType.MARKDOWN";static FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER"}const fs=UR;class Fc{static makeSortConfig(e,t){return{column:e,direction:t}}static makeFilterConfig(e){const t=[],n=[];return e.forEach((s,i)=>{t.push(s),i>0&&n.push(Un.and)}),{filterItems:t,filterOperators:n}}static combineFilterConfigs(e,t,n=Un.and){return{filterItems:[...e.filterItems,...t.filterItems],filterOperators:[...e.filterOperators,n,...t.filterOperators]}}static makeFilterItem(e,t,n){return{columnName:e,type:t,value:n}}}function VR(c,e,t){if(c.length>e){const n=c.length-t;return{toKeep:c.slice(n),toPrune:c.slice(0,n)}}return{toKeep:c,toPrune:[]}}const Aa=J.module("PouchStorageTable"),BR="Deephaven.";Uc.plugin(Cm);function $R(c,e){switch(c){case de.in:case de.contains:return{$regex:new RegExp(`${e}`)};case de.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case de.eq:return{$eq:e};case de.notEq:return{$neq:e};case de.greaterThan:return{$gt:e};case de.greaterThanOrEqualTo:return{$gte:e};case de.lessThan:return{$lt:e};case de.lessThanOrEqualTo:return{$lte:e};case de.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${c}`)}}function WR(c){const{filterItems:e,filterOperators:t}=c;let n=null;for(let s=0;s<e.length;s+=1){const i=e[s],{columnName:o,type:l,value:a}=i,d={[o]:$R(l,a)};if(s===0)n=d;else if(n!==null&&s-1<t.length){const h=t[s-1];if(h===Un.and)n={$and:[n,d]};else if(h===Un.or)n={$or:[n,d]};else throw new Error(`Unexpected filter operator ${h}, ${d}`)}}if(n==null)throw new Error(`Invalid filter config ${c}`);return n}function Oa(c=[]){return{$and:[...c.map(e=>WR(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function GR(c,e=!1){return[{id:e?"desc":"asc"},...c?.map(t=>({[t.column]:t.direction}))??[]]}class zR{db;changes;listeners=[];itemListeners=new Map;currentSize=0;currentViewport;currentReverse=!1;currentFilter=null;currentSort=null;infoUpdatePromise;viewportUpdatePromise;currentViewportData;constructor(e,t){this.db=new Uc(`${BR}${e}`,t),this.db._remote=!1,this.listenForChanges(),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}listenForChanges(){this.changes=this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this))}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}onItemUpdate(e,t){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),t]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(n=>n!==t))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const t={...e,_id:e.id};return await this.db.put(t),t}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}sendItemUpdate(e){const t=this.itemListeners.get(e.id);if(t!==void 0)for(let n=0;n<t.length;n+=1)t[n](e)}dbUpdate(e){Aa.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async fetchInfo(e){return this.db.find({selector:e,fields:[]})}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=be.makeCancelable(this.fetchInfo(Oa(this.currentFilter??[])));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!be.isCanceled(e))throw Aa.error("Unable to refreshInfo",e),e}}async fetchViewportData(e,t,n){return this.db.find({selector:t,skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(s=>({items:s.docs,offset:e.top}))}async refreshData(){if(this.currentViewport)try{const e=Oa(this.currentFilter??[]),t=GR(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=be.makeCancelable(this.fetchViewportData(this.currentViewport,e,t));const n=await this.viewportUpdatePromise;return this.currentViewportData=n,this.sendUpdate(),n}catch(e){if(!be.isCanceled(e))throw Aa.error("Unable to refreshData",e),e}}async refreshItem(e){const n=(await this.db.find({selector:{id:e},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(e){const t=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([s,i])=>{const o=i-s+1;return this.db.find({selector:Oa(this.currentFilter??[]),skip:s,limit:o,sort:n,fields:["id","name"]}).then(l=>{for(let a=0;a<o;a+=1){const d=s+a;t.set(d,l.docs[a])}})})),t}}const KR=zR,YR=2500,qR=2e3,Xt=J.module("PouchCommandHistoryTable");class XR extends KR{constructor(e,t){super(`CommandHistoryStorage.${e}`,{auto_compaction:!0,revs_limit:1}),this.cache=t,this.cache.tableRegistry.has(this.cacheKey)||this.cache.tableRegistry.set(this.cacheKey,new Set),Xt.debug("Adding table to registry",this.cacheKey),this.cache.tableRegistry.get(this.cacheKey)?.add(this)}searchText;get cacheKey(){return this.db.name}setSearch(e){Xt.debug("Setting search filters",e),this.searchText=e.trim().toLowerCase(),this.setFilters(e?[Fc.makeFilterConfig([Fc.makeFilterItem("name",de.contains,e)])]:[])}dbUpdate(e){Xt.debug("Clearing cache and refreshing data",e),this.cache.response.delete(this.cacheKey),super.dbUpdate(e)}async fetchData(e){return be.withTimeout(0,async()=>{this.cache.response.has(this.cacheKey)?Xt.debug("Fetching from cache",this.searchText,this.viewport):(Xt.debug("Fetching from PouchDB",this.searchText,this.viewport),this.cache.response.set(this.cacheKey,this.db.allDocs({include_docs:!0}).then(n=>{const s=n.rows.map(l=>l.doc).filter(({name:l})=>l);Xt.debug(`Fetched ${s.length} command history items`);const{toKeep:i,toPrune:o}=VR(s,YR,qR);return o.length&&this.pruneItems(o),{docs:i}})));const t=this.cache.response.get(this.cacheKey);return this.searchText==null||this.searchText===""?t:{...t,docs:(await t).docs.filter(({name:n})=>n.toLowerCase().includes(this.searchText))}})}async fetchInfo(e){return this.fetchData(e)}async fetchViewportData(e,t,n){const s=await this.fetchData(t);return Xt.debug("Fetching viewport data",e.top,e.bottom+1,n,s),{items:(typeof n[0]=="object"&&n[0].id==="desc"?s.docs.slice(0).reverse():s.docs).slice(e.top,e.bottom+1),offset:e.top}}async pruneItems(e){if(this.cache.isPruning.get(this.cacheKey)===!0){Xt.debug("Pruning already in progress. Skipping.");return}try{Xt.debug(`Pruning ${e.length} command history items`);const t=this.cache.pauseChangeListeners(this.cacheKey);this.cache.isPruning.set(this.cacheKey,!0),await this.db.bulkDocs(e.map(n=>({...n,_deleted:!0}))),this.cache.isPruning.set(this.cacheKey,!1),t(),Xt.debug("Finished pruning command history items")}catch(t){Xt.error("An error occurred while pruning db",t)}}close(){Xt.debug("Closing table",this,this.cache.tableRegistry.get(this.cacheKey)?.size),this.cache.tableRegistry.get(this.cacheKey)?.delete(this),this.changes?.cancel(),super.close()}}const Nc=XR,kc=J.module("PouchCommandHistoryCache");class ZR{constructor(){this.isPruning=new Map,this.response=new Map,this.tableRegistry=new Map}isPruning;response;tableRegistry;pauseChangeListeners(e){const t=[];return this.tableRegistry.get(e)?.forEach(n=>{n.changes&&(kc.debug(`Pausing event listeners on '${e}' table`,n),n.changes.cancel(),t.push(n))}),()=>{t.forEach(n=>{(this.tableRegistry.get(e)?.has(n)??!1)&&(kc.debug(`Resuming event listeners on '${e}' table`,n),n.listenForChanges())})}}}const QR=ZR,Mc=J.module("PouchCommandHistoryStorage");class JR{cache=new QR;updateTableMap=new Map;getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new Nc(e,this.cache)),this.updateTableMap.get(e)}async getTable(e){return new Nc(e,this.cache)}async addItem(e,t,n,s){return this.updateItem(e,{id:`${new Date().getTime()}`,name:n,data:s})}async updateItem(e,t){const n=this.getUpdateTable(e),i={...await n.refreshItem(t.id)??{},...t};return Mc.debug("Updating item",i),await n.put(i),Mc.debug("Update saved"),t}listenItem(e,t,n){return this.getUpdateTable(e).onItemUpdate(t,n)}}const ju="SET_LAYOUT_STORAGE",ex=c=>({type:ju,payload:c}),{dh:tx}=globalThis,_t=tx,Hu=""+new URL("community-wordmark-app-d2c5c1eb.svg",import.meta.url).href;const nx=J.module("SettingsUtils");function sx(c){return c.formatString!=null}function Ja(c){const e=c?.querySelector("input, select, textarea");e&&e.focus()}function Uu(c,e){return c.defaultFormatString===e.defaultFormatString}function ix(c,e){return Uu(c,e)}function ox(c,e){return Uu(c,e)}function Vu(c){return c!==""&&Ii.isValidColumnName(c)}function Cs(c,e,t){if(!e||t.formatString==null||!sx(t))return!1;switch(e){case"datetime":return it.isValid(c,t);case"decimal":return We.isValid(c,t);case"int":return st.isValid(c,t);default:return nx.warn("Trying to validate format of unknown type"),!0}}function Bu(c){const{id:e,isNewRule:t,...n}=c;return n}function $u(c,e){return Vu(e.columnName)&&Cs(c,e.columnType,e.format)}function Wu(c){const{timestamp:e,timeZone:t,showTimeZone:n,showTSeparator:s,isGlobalOptions:i,legacyGlobalFormat:o}=c,l=Qs(),a=w.useMemo(()=>new gn(l,[],{timeZone:t,showTimeZone:n,showTSeparator:s}),[l,n,s,t]),d=i?it.getGlobalFormats(n,s):it.getFormats(n,s);return o!=null&&!d.includes(o)&&d.unshift(o),r.jsx(r.Fragment,{children:d.map(h=>{const u=it.makeFormat("",h,it.TYPE_GLOBAL);return r.jsx("option",{value:h,"data-testid":"time-format",children:a.getFormattedString(e,F.dataType.DATETIME,"",u)},h)})})}function lx(){return r.jsx(r.Fragment,{children:_l.TIME_ZONES.map(c=>{const{label:e,value:t}=c;return r.jsx("option",{value:t,children:e},t)})})}const _s=J.module("FormattingSectionContent");class td extends w.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:it.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:st.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:it.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ge(this.commitChanges.bind(this),td.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:l,timeZone:a,truncateNumbersWithPound:d}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=oe.createRef(),this.state={formatSettings:h,showTimeZone:o,showTSeparator:l,timeZone:a,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:d,timestampAtMenuOpen:new Date}}componentDidMount(){Ja(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;getCachedDateTimeFormatOptions=we((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return r.jsx(Wu,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleDefaultDateTimeFormatChange(e){_s.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){_s.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){_s.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s}=e;_s.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:t}=e;_s.debug("handleResetTimeZone"),this.setState({timeZone:t},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:t}=e;_s.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:t}=e;_s.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:t},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:l,truncateNumbersWithPound:a}=this.state,{dh:d}=this.props,h=e.filter(p=>$u(d,p)).map(Bu)??[],{settings:u,saveSettings:m}=this.props,g={...u,formatter:h,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:a};Cs(d,F.dataType.DECIMAL,We.makeCustomFormat(o.defaultFormatString))&&(g.defaultDecimalFormatOptions=o),Cs(d,F.dataType.INT,st.makeCustomFormat(l.defaultFormatString))&&(g.defaultIntegerFormatOptions=l),m(g)}render(){const{defaults:e,dh:t}=this.props,{defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,timeZone:o,showTimeZone:l,showTSeparator:a,truncateNumbersWithPound:d}=this.state,{defaultFormatString:h=We.DEFAULT_FORMAT_STRING}=s??{},{defaultFormatString:u=st.DEFAULT_FORMAT_STRING}=i??{},m=o===e.timeZone,g=a===e.showTSeparator&&l===e.showTimeZone&&n===e.defaultDateTimeFormat,p=ix(s,e.defaultDecimalFormatOptions),f=ox(i,e.defaultIntegerFormatOptions);return r.jsx("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:r.jsxs("div",{className:"container-fluid p-0",children:[r.jsx("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),r.jsx("div",{className:"col pr-0",children:r.jsx("select",{className:"custom-select",value:o,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:r.jsx(lx,{})})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:z("btn-reset","btn-reset-time-zone",{hidden:m})})})]}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),r.jsx("div",{className:"col pr-0",children:r.jsx("select",{className:"custom-select",value:n,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(o,l,a,!0,n)})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:z("btn-reset","btn-reset-date-time",{hidden:g})})})]}),r.jsx("div",{className:"form-row",children:r.jsx("div",{className:"offset-3 col-9",children:r.jsx(tn,{checked:l??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),r.jsx("div",{className:"form-row mb-3",children:r.jsx("div",{className:"offset-3 col-9",children:r.jsx(tn,{checked:a??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),r.jsx("div",{className:"col pr-0",children:r.jsx("input",{className:z("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Cs(t,F.dataType.DECIMAL,We.makeCustomFormat(h))}),"data-lpignore":!0,placeholder:We.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:h,onChange:this.handleDefaultDecimalFormatChange})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:z("btn-reset","btn-reset-decimal",{hidden:p}),"data-testid":"btn-reset-decimal"})})]}),r.jsxs("div",{className:"form-row mb-2",children:[r.jsx("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),r.jsx("div",{className:"col pr-0",children:r.jsx("input",{className:z("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Cs(t,F.dataType.INT,st.makeCustomFormat(u))}),"data-lpignore":!0,placeholder:st.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:u,onChange:this.handleDefaultIntegerFormatChange})}),r.jsx("div",{className:"col-1 btn-col",children:r.jsx(P,{kind:"ghost",icon:Ws,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:z("btn-reset","btn-reset-integer",{hidden:f}),"data-testid":"btn-reset-integer"})})]}),r.jsx("div",{className:"form-row mb-3",children:r.jsx("div",{className:"offset-3 col-9",children:r.jsx(tn,{checked:d??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}}const ax=c=>({formatter:vh(c),defaultDateTimeFormat:Sh(c),defaultDecimalFormatOptions:bh(c),defaultIntegerFormatOptions:wh(c),dh:Kl(c),showTimeZone:Th(c),showTSeparator:Eh(c),truncateNumbersWithPound:yh(c),timeZone:go(c),settings:gt(c)}),rx=mt(ax,{saveSettings:Xl})(td);function dx(){const[c,e]=w.useState(!1),t=()=>{e(!c)};return r.jsxs(P,{kind:"ghost",onClick:t,icon:Vg,children:["Legal Notices",r.jsxs($l,{isOpen:c,toggle:t,className:"theme-bg-light",children:[r.jsx(Wl,{toggle:t,children:"Legal Notice"}),r.jsxs(Gl,{children:[r.jsx("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,494; 9,836,495; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,346,394; 10,353,893; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; 10,783,191; 10,866,943; 10,909,183; 10,915,526; 10,922,311; 10,929,394; 11,023,462; 11,126,662; 11,151,133; 11,238,036; 11,249,994; 11,263,211; 11,449,557; 11,514,037; 11,556,528; and 11,574,018. Other patents pending."}),r.jsxs("p",{children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function so(c){const{children:e,isExpanded:t,sectionKey:n,title:s,onToggle:i}=c;return r.jsxs(r.Fragment,{children:[r.jsx("div",{children:r.jsxs(P,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>i(n),children:[r.jsx("div",{className:"flex-grow-1",children:s}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(X,{transform:t?"flip-v":"",icon:Bn})})]})}),r.jsx(Mm,{in:t,autoFocusOnShow:!0,children:e})]})}so.propTypes={children:U.node,isExpanded:U.bool.isRequired,sectionKey:U.string.isRequired,title:U.node.isRequired,onToggle:U.func};so.defaultProps={children:null,onToggle:()=>{}};function cx({shortcut:c,displayText:e,categoryName:t,onChange:n}){const[s,i]=w.useState(e),[o,l]=w.useState(c.getKeyState()),[a,d]=w.useState(!1),[h,u]=w.useState("");w.useEffect(function(){i(e),l(c.getKeyState())},[e,c]),w.useEffect(function(){i(nn.getDisplayText(o)),c.matchesKeyState(o)&&d(!1)},[o,c]),w.useEffect(function(){if(a){if(!nn.isValidKeyState(o)){nn.isAllowedKey(o.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const T=He.getConflictingShortcuts(o).filter(E=>E.id.startsWith(t)&&E!==c).map(E=>E.name);if(T.length){u(`Conflicts with ${T.join(", ")}`);return}u("")}else u("")},[a,o,t,c]);function m(v){if(v.stopPropagation(),v.preventDefault(),c.isEditable&&!v.repeat){const T=nn.getKeyStateFromEvent(v),E=nn.createKeyState([ve.BACKSPACE]);nn.doKeyStatesMatch(T,E)?l(nn.NULL_KEY_STATE):l(T)}}function g(v){v.stopPropagation(),v.preventDefault(),c.matchesKeyState(o)||d(!0)}function p(){ws.disableAllActions()}function f(){ws.enableAllActions()}function C(){c.setKeyState(o),d(!1),n(c)}function S(){const v=c.getKeyState();l(v),d(!1)}function b(){d(!0),l(c.getDefaultKeyState())}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"shortcut-item-container",children:[r.jsxs("label",{className:"shortcut-item-name",children:[c.name,c.tooltip!==void 0&&r.jsx(Je,{children:c.tooltip})]}),r.jsxs("div",{className:"shortcut-item-input-container",children:[r.jsx("input",{className:z("form-control",{"is-invalid":h}),onKeyDown:m,onKeyUp:g,onFocus:p,onBlur:f,disabled:!c.isEditable,value:s,readOnly:!0}),!nn.doKeyStatesMatch(o,c.getDefaultKeyState())&&!h&&r.jsx(P,{className:"reset-to-default-button",kind:"ghost",icon:r.jsx(X,{icon:Ws,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:b})]})]}),a&&r.jsxs("div",{className:z("shortcut-item-message-container",{"is-invalid":h}),children:[r.jsx("div",{className:"shortcut-item-message",children:h}),r.jsxs("div",{className:"shortcut-item-message-buttons",children:[nn.isValidKeyState(o)&&r.jsx(P,{kind:"ghost",onClick:C,children:"Confirm"}),r.jsx(P,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function hx({shortcutOverrides:c={},settings:e,saveSettings:t}){const n=w.useCallback(l=>{const a=nn.isMacPlatform,d={mac:{...c.mac},windows:{...c.windows}},h=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete h[u.id]:h[u.id]=u.getKeyState()}),t({...e,shortcutOverrides:d})},[e,t,c]);let s=Array.from(He.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const i=s.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),o=s.splice(i,1);return s=s.concat(o),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),s.map(l=>r.jsx(ux,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:n},l.name))]})}function ux({name:c,shortcuts:e,saveShortcutOverrides:t}){function n(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[s,i]=w.useState(e);function o(a){const d=s.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const h=[a,...d];t(h),i(u=>[...u])}const l=w.useMemo(()=>s.map(a=>a.getDisplayText()),[s]);return r.jsxs("div",{className:"mt-3",children:[r.jsx("div",{className:"font-weight-bold",children:n(c)}),s.map((a,d)=>r.jsx(cx,{shortcut:a,displayText:l[d],categoryName:c,onChange:o},a.id))]})}const mx=c=>({settings:gt(c),shortcutOverrides:rC(c)}),gx={saveSettings:Xl},px=mt(mx,gx)(hx),fx="yyyy-MM-dd-HHmmss";function Gu(c,e="root",t=new Map([[c,""]])){const n={};return Object.entries(c).forEach(([s,i])=>{try{JSON.stringify(i),n[s]=i}catch{const l=i;if(typeof i=="bigint")n[s]=i.toString();else if(t.has(l))n[s]=`Circular ref to ${t.get(l)}`;else{const a=`${e}.${s}`;t.set(l,a),n[s]=Gu(i,a,t)}}}),n}function Cx(){const c=Tr.getState();return JSON.stringify(Gu(c),null,2)}function Sx(c){const e={uiVersion:"0.40.1",userAgent:navigator.userAgent,...c};return JSON.stringify(e,null,2)}async function bx(c=`${_t.i18n.DateTimeFormat.format(fx,new Date)}_support_logs`,e){const t=new Vc,n=t.folder(c);n.file("console.txt",Bg.getFormattedHistory()),n.file("redux.json",Cx()),n.file("metadata.json",Sx(e));const s=await t.generateAsync({type:"blob"}),i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=`${c}.zip`,i.click()}const wx=[{value:F.dataType.DATETIME,label:"DateTime"},{value:F.dataType.DECIMAL,label:"Decimal"},{value:F.dataType.INT,label:"Integer"}];function vx(){const c=wx.map(e=>r.jsx("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return r.jsxs(r.Fragment,{children:[r.jsx("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),c]})}class nd extends w.PureComponent{static defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:it.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:st.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:it.DEFAULT_TIME_ZONE_ID}};static inputDebounceTime=250;constructor(e){super(e),this.debouncedCommitChanges=Ge(this.commitChanges.bind(this),nd.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:t,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:l,timeZone:a,truncateNumbersWithPound:d}=e,h=t.map((u,m)=>({...u,id:m}));this.containerRef=oe.createRef(),this.addFormatRuleButtonRef=oe.createRef(),this.lastFormatRuleIndex=h.length,this.state={formatSettings:h,formatRulesChanged:!1,showTimeZone:o,showTSeparator:l,timeZone:a,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:d,timestampAtMenuOpen:new Date}}componentDidMount(){Ja(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}debouncedCommitChanges;containerRef;addFormatRuleButtonRef;lastFormatRuleIndex;isDuplicateRule(e){const{formatSettings:t}=this.state;return t.some(n=>n.id!==e.id&&n.columnName===e.columnName&&n.columnType===e.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}getCachedColumnTypeOptions=we(()=>r.jsx(vx,{}));getCachedDateTimeFormatOptions=we((e,t,n,s=!1,i)=>{const{timestampAtMenuOpen:o}=this.state;return r.jsx(Wu,{timestamp:o,timeZone:e,showTimeZone:t,showTSeparator:n,isGlobalOptions:s,legacyGlobalFormat:i})});handleFormatRuleChange(e,t,n){this.setState(s=>{const{formatSettings:i}=s;D(i);const o=[...i];let l={};t==="columnType"&&(l={format:""});const a={...o[e],...l,[t]:n};return o[e]=a,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:t}=e,n={columnType:F.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...t,n],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(t=>{const{formatSettings:n}=t;return{formatSettings:n.filter((i,o)=>o!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),Ja(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:l,truncateNumbersWithPound:a}=this.state,{dh:d}=this.props,h=e.filter(p=>$u(d,p)).map(Bu)??[],{settings:u,saveSettings:m}=this.props,g={...u,formatter:h,defaultDateTimeFormat:t,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:a};Cs(d,F.dataType.DECIMAL,We.makeCustomFormat(o.defaultFormatString))&&(g.defaultDecimalFormatOptions=o),Cs(d,F.dataType.INT,st.makeCustomFormat(l.defaultFormatString))&&(g.defaultIntegerFormatOptions=l),m(g)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(e){const{dh:t}=this.props,n={hasColumnNameError:!1,hasFormatError:!1,message:""},s=[];return e.isNewRule!==void 0&&e.isNewRule||(this.isDuplicateRule(e)&&(n.hasColumnNameError=!0,s.push("Duplicate column name/type combo.")),Vu(e.columnName)||(n.hasColumnNameError=!0,s.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format.formatString!==void 0&&e.format.formatString.length===0?(n.hasFormatError=!0,s.push("Empty formatting rule.")):Cs(t,e.columnType,e.format)||(n.hasFormatError=!0,s.push("Invalid formatting rule.")),n.message=s.join(`
|
|
38
|
+
`)),n}renderFormatRule(e,t){const n=`input-${e}-columnName`,s=`input-${e}-columnType`,i=`input-${e}-format`,o=this.getCachedColumnTypeOptions(),l=u=>this.handleFormatRuleChange(e,"columnName",u.target.value),a=()=>this.handleFormatRuleChange(e,"isNewRule",!1),d=u=>this.handleFormatRuleChange(e,"columnType",u.target.value),h=this.getRuleError(t);return r.jsxs("fieldset",{className:"container-fluid format-rule-container",children:[r.jsxs("div",{className:"form-row",children:[r.jsxs("div",{className:"form-group col-7 mb-2",children:[r.jsx("label",{htmlFor:n,children:"Column Name"}),r.jsx("input",{id:n,className:z("form-control",{"is-invalid":h.hasColumnNameError}),"data-lpignore":!0,type:"text",value:t.columnName,onChange:l,onBlur:a})]}),r.jsxs("div",{className:"form-group col mb-2",children:[r.jsx(P,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(e),icon:$t,tooltip:"Delete","aria-label":"Delete Format Rule"}),r.jsx("label",{htmlFor:s,children:"Column Type"}),r.jsx("select",{id:s,className:"custom-select",value:t.columnType,onChange:d,children:o})]})]}),r.jsx("div",{className:"form-row",children:r.jsxs("div",{className:"form-group col-12 d-flex mb-2",children:[r.jsx("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(e,t.columnType,i,t.format,h.hasFormatError)]})}),r.jsx("div",{className:"form-row",children:r.jsx("div",{className:"form-group col-12 d-flex mb-2",children:h.message&&r.jsx("p",{className:"text-danger",children:h.message})})})]},e)}renderFormatRuleInput(e,t,n,s,i){switch(F.getNormalizedType(t)){case F.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,n,s,i);case F.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,n,s,i);case F.dataType.INT:return this.renderIntegerFormatRuleInput(e,n,s,i);default:throw new Error(`Unrecognized column type: ${t}`)}}renderDateTimeFormatRuleInput(e,t,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:l}=this.state,a=n.formatString??"";return r.jsxs("select",{className:z("custom-select",{"is-invalid":s}),value:a,id:t,onChange:d=>{const h=it.makeFormat("",d.target.value,it.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",h)},children:[r.jsx("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(l,i,o)]})}renderIntegerFormatRuleInput(e,t,n,s){const i=n.formatString??"";return r.jsx("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:st.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const l=st.makeFormat("",o.target.value,st.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",l)}})}renderDecimalFormatRuleInput(e,t,n,s){const i=n.formatString??"";return r.jsx("input",{className:z("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:t,placeholder:We.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const l=We.makeFormat("",o.target.value,We.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(e,"format",l)}})}render(){const{formatRulesChanged:e,formatSettings:t}=this.state,n=t.map((i,o)=>r.jsx(Bt,{classNames:"fade",timeout:Ye.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=r.jsx(P,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:vs,children:"Add New Rule"});return r.jsxs("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[r.jsx("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),r.jsx(Sm,{appear:e,enter:e,exit:e,children:n}),s]})}}const Tx=c=>({formatter:vh(c),defaultDateTimeFormat:Sh(c),defaultDecimalFormatOptions:bh(c),defaultIntegerFormatOptions:wh(c),dh:Kl(c),showTimeZone:Th(c),showTSeparator:Eh(c),truncateNumbersWithPound:yh(c),timeZone:go(c),settings:gt(c)}),Ex=mt(Tx,{saveSettings:Xl})(nd);class Rn extends w.Component{static defaultProps={onDone:()=>{}};static FORMATTING_SECTION_KEY="SettingsMenu.formatting";static COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";static APPLICATION_SECTION_KEY="ApplicationMenu.settings";static SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";static focusFirstInputInContainer(e){const t=e?.querySelector("input, select, textarea");t&&t.focus()}constructor(e){super(e),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.handleLogout=this.handleLogout.bind(this),this.menuContentRef=oe.createRef(),this.broadcastChannel=new BroadcastChannel(Am),this.state={expandedSectionKey:Rn.FORMATTING_SECTION_KEY}}componentDidMount(){Rn.focusFirstInputInContainer(this.menuContentRef.current)}componentWillUnmount(){this.broadcastChannel.close()}menuContentRef;broadcastChannel;isSectionExpanded(e){const{expandedSectionKey:t}=this.state;return t===e}handleLogout(){this.broadcastChannel.postMessage(Om(Lm))}handleScrollTo(e,t){this.menuContentRef.current?.scrollTo(e,t)}handleSectionToggle(e){this.setState(t=>({expandedSectionKey:t.expandedSectionKey===e?void 0:e}))}handleClose(){const{onDone:e}=this.props;e()}handleExportSupportLogs(){const{serverConfigValues:e}=this.props;bx(void 0,Object.fromEntries(e))}render(){const e="0.40.1",t="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s,user:i}=this.props,o=s.get("barrage.version"),l=s.get("java.version"),a=s.get("deephaven.version"),d=(g,p)=>r.jsxs(r.Fragment,{children:[r.jsx("div",{children:g}),r.jsx("div",{children:p})]}),h=i.displayName??i.name,u=i.image!=null&&i.image!=="",m=h!=="";return r.jsxs("div",{className:"app-settings-menu",children:[r.jsxs("header",{className:"app-settings-menu-header",children:[r.jsxs("div",{className:"user-info",children:[r.jsxs("div",{className:"user-image",children:[!u&&r.jsx(X,{icon:$g,transform:"grow-8"}),u&&r.jsx("img",{src:i.image,alt:h})]}),r.jsxs("div",{className:"user-details",children:[m&&r.jsxs("div",{className:"user-name",children:[h,i.operateAs!=null&&i.name!==i.operateAs&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"font-weight-light font-italic",children:[" ","as"," "]}),r.jsxs("span",{className:"operating-as-user",children:[r.jsx(X,{icon:Wg,className:"mr-1"}),i.operateAs]})]})]}),i.permissions.canLogout&&r.jsx("button",{type:"button",className:"btn btn-link",onClick:this.handleLogout,children:"logout"})]})]}),r.jsx(P,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:r.jsx(X,{icon:ho,transform:"grow-4"}),tooltip:"Close"})]}),r.jsxs("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[r.jsx("h5",{children:"Settings"}),r.jsx("hr",{className:"my-0"}),r.jsx(so,{sectionKey:Rn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(Rn.FORMATTING_SECTION_KEY),title:r.jsxs(r.Fragment,{children:[r.jsx(X,{icon:Gg,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:r.jsx(rx,{})}),r.jsx(so,{sectionKey:Rn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(Rn.COLUMN_SPECIFIC_SECTION_KEY),title:r.jsxs(r.Fragment,{children:[r.jsx(X,{icon:zg,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:r.jsx(Ex,{scrollTo:this.handleScrollTo})}),r.jsx(so,{sectionKey:Rn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(Rn.SHORTCUT_SECTION_KEY),title:r.jsxs(r.Fragment,{children:[r.jsx(X,{icon:Kg,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:r.jsx(px,{})}),r.jsxs("div",{className:"app-settings-footer",children:[r.jsxs("div",{className:"app-settings-footer-section",children:[r.jsxs("div",{className:"app-settings-footer-item",children:[r.jsx("div",{className:"font-weight-bold",children:"Support"}),r.jsxs("div",{children:["GitHub: ",r.jsx("a",{href:t,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:t})]}),r.jsx(P,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),r.jsxs("div",{className:"app-settings-footer-item",children:[r.jsx("div",{className:"font-weight-bold",children:"Documentation"}),r.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),r.jsxs("div",{className:"app-settings-footer-item",children:[r.jsx("div",{className:"font-weight-bold",children:"Version"}),r.jsxs("span",{className:"d-inline-block text-muted",children:[a," ",r.jsx(X,{icon:Yg}),r.jsxs(Je,{interactive:!0,children:[r.jsxs("div",{className:"detailed-server-config",children:[d("Engine Version",a),d("Web UI Version",e),d("Java Version",l),d("Barrage Version",o)]}),r.jsx(jl,{tooltip:"Copy version numbers",copy:`Engine Version: ${a}
|
|
39
39
|
Web UI Version: ${e}
|
|
40
40
|
Java Version: ${l}
|
|
41
41
|
Barrage Version: ${o}`,children:"Copy Versions"})]})]})]}),r.jsx("div",{className:"app-settings-footer-item",children:r.jsx(dx,{})})]}),r.jsx("div",{className:"app-settings-footer-section",children:r.jsx("div",{className:"logo",children:r.jsx("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:r.jsx("img",{src:Hu,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}}const Ac=10;function Ci(c){const{forwardedProps:{menuItem:{action:e,title:t,disabled:n},iconElement:s,displayShortcut:i,isMouseSelected:o,isKeyboardSelected:l,closeMenu:a}}=c,d=w.useRef(),h=w.useRef(),u=w.useRef(null),[m,g]=w.useState(!1),p=w.useCallback(S=>{d.current!=null&&h.current!=null&&u.current&&(Math.abs(d.current-S.clientX)>=Ac||Math.abs(h.current-S.clientY)>=Ac)&&(g(!0),window.removeEventListener("mousemove",p),a(),e(S),u.current=null)},[e,a]);function f(S){d.current=S.clientX,h.current=S.clientY,u.current=S.target,window.addEventListener("mousemove",p)}function C(S){u.current===S.target&&(g(!0),a(),e(),window.removeEventListener("mousemove",p)),u.current=null}return w.useEffect(function(){return function(){return window.removeEventListener("mousemove",p)}},[p]),r.jsxs("button",{type:"button",className:z("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":l&&!n}),onMouseDown:f,onMouseUp:C,disabled:m,children:[r.jsx("span",{className:z("icon"),children:s}),r.jsx("span",{className:"title",children:t}),r.jsx("span",{className:"shortcut",children:i})]})}function sd(c){const{handleControlSelect:e,handleToolSelect:t,onClearFilter:n}=c,s=w.useMemo(()=>[{title:"Input Filter",icon:qg,menuElement:r.jsx(Ci,{}),action:i=>{e(fs.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:th,menuElement:r.jsx(Ci,{}),action:i=>{e(fs.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:Xg,menuElement:r.jsx(Ci,{}),action:i=>{e(fs.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:Ha,menuElement:r.jsx(Ci,{}),action:i=>{e(fs.FILTER_SET_MANAGER,i)},order:25},{disabled:!0,menuElement:r.jsx("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Qc,action:()=>{t(At.LINKER)},order:40,shortcut:Yn.LINKER},{disabled:!0,menuElement:r.jsx("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Zg,action:()=>{n()},order:60,shortcut:Ht.TABLE.CLEAR_ALL_FILTERS}],[e,t,n]);return r.jsx($n,{popperClassName:"controls-menu-popper",actions:s})}sd.propTypes={handleControlSelect:U.func,handleToolSelect:U.func,onClearFilter:U.func};sd.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Ci.propTypes={forwardedProps:U.shape({iconElement:U.node,displayShortcut:U.string,isMouseSelected:U.bool.isRequired,isKeyboardSelected:U.bool.isRequired,closeMenu:U.func.isRequired,menuItem:U.shape({action:U.func,title:U.string,disabled:U.bool}).isRequired})};Ci.defaultProps={forwardedProps:null};const yx=Ts(ju,null),Rx={layoutStorage:yx},xx=c=>c.layoutStorage,Ix=c=>c.serverConfigValues;Object.entries(Rx).map(([c,e])=>po.register(c,e));const Oc=10;function Dx(c){const{onExportLayout:e,onImportLayout:t,onResetLayout:n,onSelect:s,widgets:i=[]}=c,[o,l]=w.useState(!1),[a,d]=w.useState(""),h=w.useRef(null),u=w.useRef(),m=w.useCallback((T,E)=>{T!=null&&s(T,E)},[s]),g=w.useCallback(T=>{d(T.target.value)},[]),p=w.useCallback(T=>{u.current!=null&&(Math.abs(u.current.x-T.clientX)>=Oc||Math.abs(u.current.y-T.clientY)>=Oc)&&(l(!0),window.removeEventListener("mousemove",p),m(u.current.widget,T),u.current=void 0)},[u,m]),f=w.useCallback((T,E)=>{u.current={x:T.clientX,y:T.clientY,widget:E},window.addEventListener("mousemove",p)},[p]),C=w.useCallback((T,E)=>{window.removeEventListener("mousemove",p),u.current?.widget===E&&(l(!0),m(E)),u.current=void 0},[p,u,m]),S=w.useMemo(()=>i.filter(T=>a?T.name?.toLowerCase().includes(a.toLowerCase()):!0),[a,i]).sort((T,E)=>T.name?.localeCompare(E.name??"")??0),b=w.useMemo(()=>S.map(T=>r.jsx("li",{children:r.jsxs(P,{kind:"ghost","data-testid":`panel-list-item-${T.name??""}-button`,onMouseDown:E=>{f(E,T)},onMouseUp:E=>{C(E,T)},onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&m(T)},disabled:o,onClick:()=>{},children:[r.jsx(ih,{type:T.type})," ",T.name??""]})},T.name)),[S,o,f,C,m]),v=w.useMemo(()=>b.length===0?r.jsx("span",{children:"No bound variables found."}):null,[b]);return r.jsxs("div",{className:"widget-list-container d-flex flex-column",children:[r.jsx("div",{className:"widget-list-header",children:r.jsx(xi,{value:a,placeholder:"Find Table, Plot or Widget",onChange:g,ref:h})}),r.jsxs("ul",{className:"widget-list flex-grow-1",children:[v&&r.jsx("li",{className:"widget-list-message",children:v}),!v&&b]}),r.jsx("div",{children:r.jsx("hr",{})}),r.jsxs("div",{className:"widget-list-footer",children:[r.jsxs(P,{kind:"ghost",onClick:e,children:[r.jsxs("div",{className:"fa-md fa-layers",children:[r.jsx(X,{mask:ja,icon:bd,transform:"right-5 down-5"}),r.jsx(X,{icon:bd,transform:"right-8 down-6"})]}),"Export Layout"]}),r.jsxs(P,{kind:"ghost",onClick:t,children:[r.jsxs("div",{className:"fa-md fa-layers",children:[r.jsx(X,{mask:ja,icon:Ua,transform:"right-5 down-5"}),r.jsx(X,{icon:Ua,transform:"right-8 down-6"})]}),"Import Layout"]}),r.jsx(P,{kind:"ghost",icon:Ws,onClick:n,tooltip:"Reset Layout"})]})]})}const Fx=async(c,e,t,n)=>{let s,i,o,l;if(il(t)?(s=t.settings,i=t.table,o=void 0,l=t.tableSettings):(s={},i="",o=t.figure,l={}),n!==void 0&&(n.tableSettings!=null&&(l=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const h={title:o,name:o,type:c.VariableType.FIGURE},u=await e.getObject(h);return pl.makeModel(c,s,u)}const a={title:o,name:i,type:c.VariableType.TABLE},d=await e.getObject(a);return new Ce(c).applyTableSettings(d,l,go(Tr.getState())),pl.makeModelFromSettings(c,s,d)},Nx=async(c,e,t,n=c.VariableType.TABLE)=>{const{table:s}=t,i={title:s,name:s,type:n},o=await e.getObject(i);return Br.makeModel(c,o)};function kx({onAutoFillClick:c=()=>{}}){return r.jsxs("div",{className:"empty-dashboard-container",children:[r.jsxs("div",{className:"hint-container",children:[r.jsx(X,{icon:eh})," ",r.jsx("br",{}),"Use the panel list to add objects from a query."]}),r.jsxs("div",{className:"empty-dashboard",children:[r.jsx("div",{className:"add-panels-hint",children:"Drag Panels Here"}),r.jsx(P,{kind:"tertiary",onClick:c,children:"Auto fill objects"})]})]})}function Mx(c){return c.version===2}function Ax(c){return Array.isArray(c)}const Jo=J.module("UserLayoutUtils"),Ox={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:fi.COMPONENT,title:fi.TITLE,isClosable:!1},{type:"react-component",component:Ml.COMPONENT,title:Ml.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:xl.COMPONENT,title:xl.TITLE,isClosable:!1},{type:"react-component",component:Dl.COMPONENT,title:Dl.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},Lx={layoutConfig:[],links:[],filterSets:[],version:2};function zu(c){if(Mx(c))return c;if(Ax(c))return{layoutConfig:c,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${c}`)}async function _x(c,e=!0){try{const t=await c.getLayouts();if(t.length>0)try{const n=await c.getLayout(t[0]);return zu(n)}catch(n){Jo.error("Unable to load layout",t[0],":",n),Jo.warn("No valid layouts found, falling back to default layout")}}catch(t){Jo.error("Unable to fetch layout list",t),Jo.warn("Falling back to default layout")}return e?Ox:Lx}function Px(c){const{filterSets:e,layoutConfig:t,links:n}=c;return{filterSets:e,layoutConfig:t,links:n,version:2}}const ll={exportLayout:Px,getDefaultLayout:_x,normalizeLayout:zu},el=J.module("DownloadServiceWorkerUtils");class ro{static DOWNLOAD_PATH="/download/";static registerOnLoaded(){new URL("./",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const t=new URL("./download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(t).then(n=>{n.update(),el.info("Registering service worker on ",t,n)}).catch(n=>{el.error("Failed to register service worker",n)})}):el.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const t=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(ro.DOWNLOAD_PATH));if(t&&t.active)return el.info("Download service worker is active."),t.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}}const nt=J.module("AppMainContainer");class Si extends w.Component{static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,t){return Ka.hydrate({...e,unzip:n=>Vc.loadAsync(n).then(s=>Object.values(s.files))},t)}static handleRefresh(){nt.info("Refreshing application"),window.location.reload()}constructor(e){super(e),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleReconnectAuthFailed=this.handleReconnectAuthFailed.bind(this),this.importElement=oe.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(At.LINKER)},shortcut:Yn.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Ht.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{nt.debug("Consume unhandled save shortcut")},shortcut:Yn.SAVE,isGlobal:!0}],isAuthFailed:!1,isDisconnected:!1,isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}componentDidMount(){this.initWidgets(),this.startListeningForDisconnect(),window.addEventListener("beforeunload",Si.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:t}=this.props;e.dashboardData!==t&&this.handleDataChange(t)}componentWillUnmount(){this.deinitWidgets(),this.stopListeningForDisconnect(),window.removeEventListener("beforeunload",Si.handleWindowBeforeUnload)}goldenLayout;importElement;widgetListenerRemover;initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){nt.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(t=>{nt.debug("Got updates",t),this.setState(({widgets:n})=>{const{updated:s,created:i,removed:o}=t,l=[...s,...o],a=n.filter(h=>!l.some(u=>u.name===h.name));return[...s,...i].forEach(h=>{h.name!=null&&h.name!==""&&a.push(h)}),{widgets:a}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:t}=e.params;if(t){const{session:n,sessionConfig:s}=this.props;if(n==null||s==null){nt.error("No session available to open notebook URL",t);return}const i={id:`/${t}`,itemName:`/${t}`},o=s.type,l={value:null,language:o};this.emitLayoutEvent(_e.SELECT_NOTEBOOK,n,o,l,i,!0)}}sendClearFilter(){this.emitLayoutEvent(Ke.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...t){this.goldenLayout?.eventHub.emit(e,...t)}handleError(e){be.isCanceled(e)||nt.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,t=null){switch(nt.debug("handleControlSelect",e),e){case fs.DROPDOWN_FILTER:this.emitLayoutEvent(Ke.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:t});break;case fs.INPUT_FILTER:this.emitLayoutEvent(Ke.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:t});break;case fs.MARKDOWN:this.emitLayoutEvent(Du.OPEN,{title:"Markdown",type:e,dragEvent:t});break;case fs.FILTER_SET_MANAGER:this.emitLayoutEvent(Ke.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:t});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){nt.debug("handleToolSelect",e);const{activeTool:t,setActiveTool:n}=this.props;n(t===e?At.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:t}=this.props,{closed:n,filterSets:s,links:i}=e;t({closed:n,filterSets:s,links:i})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:t}=this.props;t({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,t){this.setState({isPanelsMenuShown:!1}),nt.debug("handleWidgetSelect",e,t),this.openWidget(e,t)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;nt.debug("handleAutoFillClick",e);const t=e.sort((n,s)=>n.title!=null&&s.title!=null?n.title.localeCompare(s.title):0);for(let n=0;n<t.length;n+=1)this.openWidget(t[n])}handleExportLayoutClick(){nt.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:t}=e,n=ll.exportLayout(t);nt.info("handleExportLayoutClick exportedConfig",n);const s=new Blob([JSON.stringify(n)],{type:"application/json"}),i=_t.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),o=document.createElement("a");o.href=URL.createObjectURL(s),o.download=`deephaven-app-layout-${i}.json`,o.click()}catch(e){nt.error("Unable to export layout",e)}}handleImportLayoutClick(){nt.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){nt.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}handleDisconnect(){nt.info("Disconnected from server"),this.setState({isDisconnected:!0})}handleReconnect(){nt.info("Reconnected to server"),this.setState({isDisconnected:!1})}handleReconnectAuthFailed(){nt.warn("Reconnect authentication failed"),this.setState({isAuthFailed:!0})}async importLayoutFile(e){try{const{updateDashboardData:t,updateWorkspaceData:n}=this.props,s=await e.text(),i=JSON.parse(s),{filterSets:o,layoutConfig:l,links:a}=ll.normalizeLayout(i);n({layoutConfig:l}),t(un,{filterSets:o,links:a})}catch(t){nt.error("Unable to import layout",t)}}async resetLayout(){const{layoutStorage:e,session:t}=this.props,{filterSets:n,layoutConfig:s,links:i}=await ll.getDefaultLayout(e,t!==void 0),{updateDashboardData:o,updateWorkspaceData:l}=this.props;l({layoutConfig:s}),o(un,{filterSets:n,links:i})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:t}=e,n=t.getData("Text"),s=/“|”/g;s.test(n)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,n.replace(s,'"')))}handleLoadTablePlugin(e){const{plugins:t}=this.props,n=t.get(e);if(n!=null&&n.TablePlugin!=null)return n.TablePlugin;const s=`Unable to find table plugin ${e}.`;return nt.error(s),r.jsx("div",{className:"error-message",children:`${s}`})}startListeningForDisconnect(){const{connection:e}=this.props;e.addEventListener(_t.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(_t.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.addEventListener(_t.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}stopListeningForDisconnect(){const{connection:e}=this.props;e.removeEventListener(_t.IdeConnection.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(_t.IdeConnection.EVENT_RECONNECT,this.handleReconnect),e.removeEventListener(_t.CoreClient.EVENT_RECONNECT_AUTH_FAILED,this.handleReconnectAuthFailed)}hydrateDefault(e,t){const{connection:n}=this.props,{metadata:s}=e;if(s?.type!=null&&(s?.id!=null||s?.name!=null)){const i=s.id!=null?{type:s.type,id:s.id}:{type:s.type,name:s.name,title:s.name};return{fetch:()=>n.getObject(i),localDashboardId:t,...e}}return Ka.hydrate(e,t)}hydrateGrid(e,t){return this.hydrateTable(e,t,e.metadata.type??_t.VariableType.TABLE)}hydratePandas(e,t){return this.hydrateTable(e,t,_t.VariableType.PANDAS)}hydrateTable(e,t,n=_t.VariableType.TABLE){const{connection:s}=this.props;return{...e,getDownloadWorker:ro.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:t,makeModel:()=>Nx(_t,s,e.metadata,n)}}hydrateChart(e,t){const{connection:n}=this.props;return{...e,localDashboardId:t,makeModel:()=>{const{metadata:s,panelState:i}=e;return Fx(_t,n,s,i)}}}openWidget(e,t){const{connection:n}=this.props;this.emitLayoutEvent(Se.OPEN,{dragEvent:t,fetch:()=>n.getObject(e),widget:e})}getDashboardPlugins=he(e=>[...e.entries()].filter(([,t])=>t.DashboardPlugin!=null).map(([t,{DashboardPlugin:n}])=>r.jsx(n,{},t)));render(){const{activeTool:e,plugins:t,user:n,workspace:s,serverConfigValues:i}=this.props,{data:o}=s,{layoutConfig:l}=o,{permissions:a}=n,{canUsePanels:d}=a,{contextActions:h,isAuthFailed:u,isDisconnected:m,isPanelsMenuShown:g,isSettingsMenuShown:p,widgets:f}=this.state,C=this.getDashboardPlugins(t);return r.jsxs("div",{className:z("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[r.jsx("nav",{className:"nav-container",children:r.jsxs("div",{className:"app-main-top-nav-menus",children:[r.jsx("img",{src:Hu,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),r.jsxs("div",{children:[r.jsxs(P,{kind:"ghost",className:"btn-panels-menu",icon:Qg,onClick:()=>{},children:["Controls",r.jsx(sd,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&r.jsxs(P,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:Jg,children:["Panels",r.jsx(Ul,{isShown:g,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:r.jsx(Dx,{widgets:f,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),r.jsx(P,{kind:"ghost",className:z("btn-settings-menu",{"text-warning":n.operateAs!=null&&n.operateAs!==n.name}),onClick:this.handleSettingsMenuShow,icon:r.jsx(X,{icon:uo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),r.jsxs(fb,{emptyDashboard:r.jsx(kx,{onAutoFillClick:this.handleAutoFillClick}),id:un,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[r.jsx(IR,{hydrate:this.hydrateGrid,getDownloadWorker:ro.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),r.jsx(TR,{hydrate:this.hydrateChart}),r.jsx(ER,{}),r.jsx(RR,{hydrateConsole:Si.hydrateConsole,notebooksUrl:new URL("notebooks/",document.baseURI).href}),r.jsx(xR,{}),r.jsx(HR,{hydrate:this.hydratePandas}),r.jsx(jR,{}),r.jsx(PR,{}),C]}),r.jsx(Bt,{in:p,timeout:Ye.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx(Rn,{serverConfigValues:i,onDone:this.handleSettingsMenuHide,user:n})}),r.jsx(te,{actions:h}),r.jsx("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}),r.jsx(_m,{isOpen:m&&!u,debounceMs:250,children:r.jsx(Pm,{icon:ep,title:r.jsxs(r.Fragment,{children:[r.jsx(Nn,{})," Attempting to reconnect..."]}),subtitle:"Please check your network connection."})}),r.jsx(io,{confirmButtonText:"Refresh",onConfirm:Si.handleRefresh,isOpen:u,headerText:"Authentication failed",bodyText:"Credentials are invalid. Please refresh your browser to try and reconnect."})]})}}const jx=c=>({activeTool:ql(c),dashboardData:Ot(c,un),layoutStorage:xx(c),plugins:cC(c),connection:oy(c,un),session:Zs(c,un)?.session,sessionConfig:Zs(c,un)?.config,user:ph(c),workspace:Yl(c),serverConfigValues:Ix(c)}),Hx=mt(jx,{setActiveTool:Zl,updateDashboardData:kn,updateWorkspaceData:Lh})(bm(Si));function Ux(){return r.jsxs("div",{className:"app",children:[r.jsx(Hx,{}),r.jsx(zc,{})]})}const Vx=J.module("LocalWorkspaceStorage");class bi{static STORAGE_KEY="deephaven.WorkspaceStorage";static async makeDefaultWorkspaceData(e,t){const{filterSets:n,links:s,layoutConfig:i}=await ll.getDefaultLayout(e,t?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:it.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:it.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:We.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:st.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(e,t){return{data:await bi.makeDefaultWorkspaceData(e,t)}}layoutStorage;constructor(e){this.layoutStorage=e}async load(e){try{return JSON.parse(localStorage.getItem(bi.STORAGE_KEY)??"")}catch{return Vx.info("Unable to load workspace data, initializing to default data"),bi.makeDefaultWorkspace(this.layoutStorage,e)}}async save(e){return localStorage.setItem(bi.STORAGE_KEY,JSON.stringify(e)),e}}class Bx{storageService;root;constructor(e,t=""){this.storageService=e,this.root=t}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(t=>t.basename)}async getLayout(e){const n=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(n)}}const zi=J.module("GrpcFileStorageTable");class Ol{static REFRESH_DEBOUNCE=50;storageService;baseRoot;root;currentSize=0;currentViewport;listeners=[];viewportUpdatePromise;currentViewportData;childTables=new Map;constructor(e,t="",n=t){this.storageService=e,this.baseRoot=t,this.root=n,n===t&&(this.doRefresh=Ge(this.doRefresh.bind(this),Ol.REFRESH_DEBOUNCE))}removeBaseRoot(e){return ge.removeRoot(this.baseRoot,e)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(e){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(e,t){const n=e.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${e}`);const i=n.join("/");if(t){if(!this.childTables.has(s)){const o=new Ol(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}i&&this.childTables.get(s)?.setExpanded(i,t)}else this.childTables.has(s)&&(i?this.childTables.get(s)?.setExpanded(i,t):this.childTables.delete(s));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(e){throw new Error("Method not implemented.")}setViewport(e){this.currentViewport=e,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(t=>t!==e)}}doRefresh(e){zi.debug2("doRefresh",this.root),e(this.fetchData())}refresh(){zi.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const e=new Promise(n=>{this.doRefresh(n)}),t=be.makeCancelable(e.then(n=>{if(this.viewportUpdatePromise!==t)throw new Pl;return this.currentViewportData=n,this.sendUpdate(),n}));t.catch(n=>{be.isCanceled(n)||zi.error("Error updating viewport",n)}),this.viewportUpdatePromise=t}refreshInternal(){try{this.refresh()}catch(e){be.isCanceled(e)||zi.error("Unable to refresh data",e)}}async fetchData(){const{currentViewport:e}=this;if(!e)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:l}=i;if(l===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const a=this.childTables.get(o);if(a!=null){a.setViewport({top:0,bottom:e.bottom-s});const d=await a.getViewportData();n.splice(s+1,0,...d.items)}}}return this.currentSize=n.length,zi.debug2(this.root,"items",n,e),n=n.slice(e.top,e.bottom),{items:n,offset:e.top}}sendUpdate(){const{listeners:e}=this,t=this.currentViewportData??{items:[],offset:0};for(let n=0;n<e.length;n+=1)e[n](t)}}const $x=J.module("GrpcFileStorage");class id{static REFRESH_THROTTLE=150;storageService;tables=[];root;constructor(e,t=""){this.storageService=e,this.root=t}removeRoot(e){return ge.removeRoot(this.root,e)}addRoot(e){return ge.addRoot(this.root,e)}async createDirectory(e){return await this.storageService.createDirectory(this.addRoot(e)),this.refreshTables(),{type:"directory",id:e,filename:e,basename:ge.getBaseName(e)}}async getTable(){const e=new Ol(this.storageService,this.root);return this.tables.push(e),e}async saveFile(e){const t=dh.storage.FileContents.text(e.content);return await this.storageService.saveFile(this.addRoot(e.filename),t,!0),this.refreshTables(),e}async loadFile(e){const n=await(await this.storageService.loadFile(this.addRoot(e))).text();return{filename:e,basename:ge.getBaseName(e),content:n}}async deleteFile(e){await this.storageService.deleteItem(this.addRoot(e)),this.refreshTables()}async moveFile(e,t){await this.storageService.moveItem(this.addRoot(e),this.addRoot(t)),this.refreshTables()}async info(e){const t=await this.storageService.listItems(this.addRoot(ge.getPath(e)),ge.getBaseName(e));if(t.length===0)throw new Zr;if(t.length>1)throw $x.error("More than one matching file found, should never happen.",t),new Error("More than one matching file found");const n=t[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}refreshTables=bs(()=>{this.tables.forEach(e=>e.refresh())},id.REFRESH_THROTTLE)}const Wx=J.module("AppInit");function od(c){const{workspace:e,setActiveTool:t,setApi:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:l,setDashboardConnection:a,setDashboardSessionWrapper:d,setPlugins:h,setUser:u,setWorkspace:m,setWorkspaceStorage:g,setServerConfigValues:p}=c,f=Qs(),C=jm(),S=Hm(),b=Um(),v=w.useContext(Vm),T=w.useContext(Bm),[E,y]=w.useState();w.useEffect(function(){h(b)},[b,h]),w.useEffect(function(){async function k(){try{const L=await $m(),A=await Wm(f,S,L),G=C.getStorageService(),j=new Bx(G,"/layouts"),K=new id(G,"/notebooks"),H=new bi(j),B=new JR,[ee,V]=await Promise.all([C.getServerConfigValues(),H.load({isConsoleAvailable:A!==void 0})]),{data:_}=V,{settings:$}=_;$.defaultDecimalFormatOptions===void 0&&($.defaultDecimalFormatOptions={defaultFormatString:We.DEFAULT_FORMAT_STRING}),$.defaultIntegerFormatOptions===void 0&&($.defaultIntegerFormatOptions={defaultFormatString:st.DEFAULT_FORMAT_STRING}),$.truncateNumbersWithPound===void 0&&($.truncateNumbersWithPound=!1);const{shortcutOverrides:Z={}}=$,ae=nn.isMacPlatform?Z.mac??{}:Z.windows??{};Object.entries(ae).forEach(([ye,rt])=>{He.get(ye)?.setKeyState(rt)});const q={filterSets:_.filterSets,links:_.links},ne=new Map(ee),ue="",Te={name:ue,operateAs:ue,groups:[],...v,permissions:{isACLEditor:!1,isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ne.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ne.get("internal.webClient.appInit.canDownloadCsv")!=="false",canLogout:!0,...T}};n(f),t(At.DEFAULT),p(ne),s(B),i(un,q),o(K),l(j),a(un,S),A!==void 0&&d(un,A),u(Te),g(H),m(V)}catch(L){Wx.error(L),y(L)}}k()},[f,C,S,t,n,s,i,o,l,a,d,u,m,g,p,v,T]);const R=e==null&&E==null,I=!R&&E==null,x=E!=null?`${E}`:null;return r.jsxs(r.Fragment,{children:[I&&r.jsx(Ux,{}),r.jsx(Vl,{isLoading:R&&x==null,isLoaded:I,errorMessage:x})]})}od.propTypes={workspace:U.shape({}),workspaceStorage:U.shape({close:U.func}),setActiveTool:U.func.isRequired,setApi:U.func.isRequired,setCommandHistoryStorage:U.func.isRequired,setDashboardData:U.func.isRequired,setFileStorage:U.func.isRequired,setLayoutStorage:U.func.isRequired,setDashboardConnection:U.func.isRequired,setDashboardSessionWrapper:U.func.isRequired,setPlugins:U.func.isRequired,setUser:U.func.isRequired,setWorkspace:U.func.isRequired,setWorkspaceStorage:U.func.isRequired};od.defaultProps={workspace:null,workspaceStorage:null};const Gx=c=>({workspace:Yl(c),workspaceStorage:aC(c)}),Lc=mt(Gx,{setActiveTool:Zl,setApi:uC,setCommandHistoryStorage:gC,setDashboardData:ou,setFileStorage:pC,setLayoutStorage:ex,setDashboardConnection:ly,setDashboardSessionWrapper:ay,setPlugins:CC,setUser:hC,setWorkspace:Oh,setWorkspaceStorage:mC,setServerConfigValues:SC})(od),zx=document.location.pathname;function Kx(){return r.jsx(wm,{basename:zx,children:r.jsxs(vm,{children:[r.jsx(dd,{exact:!0,path:"/",component:Lc}),r.jsx(dd,{path:"/notebooks/:notebookPath+",component:Lc}),r.jsx(Tm,{from:"*",to:"/"})]})})}function tI(){return ro.registerOnLoaded(),Mt.init({getWorker:()=>new zm}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,r.jsx(Em,{store:Tr,children:r.jsx(Kx,{})})}export{tI as AppRoot,tI as default};
|
|
42
|
-
//# sourceMappingURL=AppRoot-
|
|
42
|
+
//# sourceMappingURL=AppRoot-37271714.js.map
|